stdcpp/tsrc/Stdcpp_test/stlport/auto/stlport_inplmrg/src/inplmrg1.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 // STLport regression testsuite component.
       
    19 // To compile as a separate example, please #define MAIN.
       
    20 
       
    21 #include <algorithm>
       
    22 #include <iostream>
       
    23 
       
    24 #ifdef MAIN 
       
    25 #define inplmrg1_test main
       
    26 #endif
       
    27 
       
    28 #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
       
    29 using namespace std;
       
    30 #endif
       
    31 int inplmrg1_test(int, char**)
       
    32 {
       
    33 	  cout<<"Results of inplmrg1_test:"<<endl;
       
    34 int numbers[6] = { 1, 10, 42, 3, 16, 32 };
       
    35 int failures = 0;
       
    36   int i;
       
    37   for(i = 0; i < 6; i++)
       
    38     cout << numbers[i] << ' ';
       
    39   cout << endl;
       
    40   inplace_merge(numbers, numbers + 3, numbers + 6);
       
    41   for(i = 0; i < 6; i++)
       
    42     cout << numbers[i] << ' ';
       
    43   cout << endl;
       
    44   if(numbers[0] != 1)
       
    45   failures++;
       
    46   if(numbers[1] != 3)
       
    47   failures++;
       
    48   if(numbers[2] != 10)
       
    49   failures++;
       
    50   if(numbers[3] != 16)
       
    51   failures++;
       
    52   if(numbers[4] != 32)
       
    53   failures++;
       
    54   if(numbers[5] != 42)
       
    55   failures++;
       
    56   
       
    57   return failures;
       
    58 }