stdcpp/tsrc/Stdcpp_test/stlport/auto/stlport_ucompos/src/ucompos1.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 <iostream>
       
    22 #include <algorithm>
       
    23 #include "unary.h"
       
    24 
       
    25 #ifdef MAIN 
       
    26 #define ucompos1_test main
       
    27 #endif
       
    28 
       
    29 #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
       
    30 using namespace std;
       
    31 #endif
       
    32 
       
    33 int ucompos1_test(int, char**)
       
    34 {
       
    35   int failures=0;
       
    36   cout<<"Results of ucompos1_test:"<<endl;
       
    37 
       
    38  int input [3] = { -1, -4, -16 };
       
    39 
       
    40   int output [3];
       
    41   transform((int*)input, (int*)input + 3, (int*)output, 
       
    42 	    //	    compose1(square_root(), negate<int>()));
       
    43   	    unary_compose<square_root, negate<int> >(square_root(), negate<int>()));
       
    44   for(int i = 0; i < 3; i++)
       
    45     cout << output[i] << endl;
       
    46  
       
    47   if(1!=output[0])
       
    48     failures++;
       
    49   else if(2!=output[1])
       
    50     failures++;
       
    51   else if(4!=output[2])
       
    52     failures++;
       
    53   
       
    54   if(failures)
       
    55     return 1;
       
    56   else         
       
    57     return 0;
       
    58 }
       
    59 /*1
       
    60 2
       
    61 4*/