equal
deleted
inserted
replaced
|
1 |
|
2 // STLport regression testsuite component. |
|
3 // To compile as a separate example, please #define MAIN. |
|
4 |
|
5 #include <iostream> |
|
6 #include <algorithm> |
|
7 #include "unary.h" |
|
8 |
|
9 #ifdef MAIN |
|
10 #define ucompos1_test main |
|
11 #endif |
|
12 |
|
13 #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES) |
|
14 using namespace std; |
|
15 #endif |
|
16 |
|
17 int ucompos1_test(int, char**) |
|
18 { |
|
19 int failures=0; |
|
20 cout<<"Results of ucompos1_test:"<<endl; |
|
21 |
|
22 int input [3] = { -1, -4, -16 }; |
|
23 |
|
24 int output [3]; |
|
25 transform((int*)input, (int*)input + 3, (int*)output, |
|
26 // compose1(square_root(), negate<int>())); |
|
27 unary_compose<square_root, negate<int> >(square_root(), negate<int>())); |
|
28 for(int i = 0; i < 3; i++) |
|
29 cout << output[i] << endl; |
|
30 |
|
31 if(1!=output[0]) |
|
32 failures++; |
|
33 else if(2!=output[1]) |
|
34 failures++; |
|
35 else if(4!=output[2]) |
|
36 failures++; |
|
37 |
|
38 if(failures) |
|
39 return 1; |
|
40 else |
|
41 return 0; |
|
42 } |
|
43 /*1 |
|
44 2 |
|
45 4*/ |