equal
deleted
inserted
replaced
|
1 |
|
2 // STLport regression testsuite component. |
|
3 // To compile as a separate example, please #define MAIN. |
|
4 |
|
5 #include <functional> |
|
6 #include <algorithm> |
|
7 #include <iostream> |
|
8 |
|
9 #ifdef MAIN |
|
10 #define lexcmp2_test main |
|
11 #endif |
|
12 |
|
13 #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES) |
|
14 using namespace std; |
|
15 #endif |
|
16 int lexcmp2_test(int, char**) |
|
17 { |
|
18 cout<<"Results of lexcmp2_test:"<<endl; |
|
19 const unsigned size = 6; |
|
20 char n1[size] = "shoe"; |
|
21 char n2[size] = "shine"; |
|
22 int failures = 0; |
|
23 bool before = |
|
24 lexicographical_compare(n1, n1 + size, |
|
25 n2, n2 + size, |
|
26 greater<char>()); |
|
27 if(before) |
|
28 cout << n1 << " is after " << n2 << endl; |
|
29 else |
|
30 { |
|
31 failures++; |
|
32 cout << n2 << " is after " << n1 << endl; |
|
33 } |
|
34 return failures; |
|
35 } |