equal
deleted
inserted
replaced
|
1 |
|
2 // STLport regression testsuite component. |
|
3 // To compile as a separate example, please #define MAIN. |
|
4 |
|
5 #include <algorithm> |
|
6 #include <iostream> |
|
7 #include <cstring> |
|
8 #include <iterator> |
|
9 #include <functional> |
|
10 |
|
11 #ifdef MAIN |
|
12 #define trnsfrm2_test main |
|
13 #endif |
|
14 static char map_char(char a_, int b_) |
|
15 { |
|
16 return char(a_ + b_); |
|
17 } |
|
18 |
|
19 #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES) |
|
20 using namespace std; |
|
21 #endif |
|
22 int trnsfrm2_test(int, char**) |
|
23 { |
|
24 cout<<"Results of trnsfrm2_test:"<<endl; |
|
25 |
|
26 #if defined (__MVS__) |
|
27 int trans[] = {-11, 4, -6, -6, -18, 0, 18, -14, 6, 0, -1, -59}; |
|
28 #else |
|
29 int trans[] = {-4, 4, -6, -6, -10, 0, 10, -6, 6, 0, -1, -77}; |
|
30 #endif |
|
31 char n[] = "Larry Mullen"; |
|
32 char arr[13]; |
|
33 const unsigned count = ::strlen(n); |
|
34 ostream_iterator <char> iter(cout); |
|
35 transform(n, n + count, trans, arr, map_char); |
|
36 cout << endl; |
|
37 arr[12]='\0'; |
|
38 if(strcmp(arr,"Hello World!")) |
|
39 return 1; |
|
40 else |
|
41 return 0; |
|
42 } |
|
43 |