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