stdcpp/tsrc/Stdcpp_test/stlport/auto/stlport_alg/src/alg5.cpp
changeset 31 ce057bb09d0b
child 34 5fae379060a7
equal deleted inserted replaced
30:e20de85af2ee 31:ce057bb09d0b
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18  
       
    19 // STLport regression testsuite component.
       
    20 // To compile as a separate example, please #define MAIN.
       
    21 
       
    22 #include <iostream>
       
    23 #include <deque>
       
    24 #include <algorithm>
       
    25 
       
    26 
       
    27 #ifdef MAIN
       
    28 #define alg5_test main
       
    29 #endif
       
    30 
       
    31 #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
       
    32 using namespace std;
       
    33 #endif
       
    34 int alg5_test(int, char**)
       
    35 {
       
    36  
       
    37   cout<<"Results of alg5_test:"<<endl;
       
    38   int failures = 0;
       
    39   //result array
       
    40   int res_arr[4] = { 1962, 1992, 2001, 1999};
       
    41 
       
    42   deque<int> years;
       
    43   years.push_back(1962);
       
    44   years.push_back(1992);
       
    45   years.push_back(2001);
       
    46   years.push_back(1999);
       
    47   deque<int>::iterator i;
       
    48   int j = 0;
       
    49   for(i = years.begin(); i != years.end(); i++, j++)
       
    50   {
       
    51   	cout << *i << endl;
       
    52   	if (*i != res_arr[j])
       
    53   		failures++;
       
    54   }
       
    55 
       
    56   if (!failures)
       
    57   	 return 0;
       
    58   else 
       
    59   return 1;
       
    60 }