stdcpp/tsrc/Stdcpp_test/stlport/auto/stlport_rotcopy/src/rotcopy0.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 rotcopy0_test main
       
    26 #endif
       
    27 
       
    28 #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
       
    29 using namespace std;
       
    30 #endif
       
    31 int rotcopy0_test(int, char**)
       
    32 {
       
    33    int failures=0;
       
    34   cout<<"Results of rotcopy0_test:"<<endl;
       
    35    int numbers[6] = { 0, 1, 2, 3, 4, 5 };
       
    36 
       
    37   int result[6];
       
    38   rotate_copy((int*)numbers, (int*)numbers + 3, (int*)numbers + 6, (int*)result);
       
    39   for(int i = 0; i < 6; i++)
       
    40     cout << result[i] << ' ';
       
    41   cout << endl;
       
    42   
       
    43   if(3!=result[0])
       
    44      failures++;
       
    45   else if(4!=result[1])
       
    46      failures++;
       
    47   else if(5!=result[2])
       
    48     failures++;
       
    49   else if(0!=result[3])
       
    50     failures++;
       
    51   else if(1!=result[4])
       
    52     failures++;
       
    53   else if(2!=result[5])
       
    54     failures++;
       
    55    
       
    56     
       
    57    if(failures)
       
    58       return 1;
       
    59    else      
       
    60       return 0;
       
    61 }
       
    62