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 |
#include <functional>
|
|
8 |
|
|
9 |
#ifdef MAIN
|
|
10 |
#define less_test main
|
|
11 |
#endif
|
|
12 |
|
|
13 |
#if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
|
|
14 |
using namespace std;
|
|
15 |
#endif
|
|
16 |
int less_test(int, char**)
|
|
17 |
{
|
|
18 |
cout<<"Results of less_test:"<<endl;
|
|
19 |
int array [4] = { 3, 1, 4, 2 };
|
|
20 |
int failures=0;
|
|
21 |
sort(array, array + 4, less<int>());
|
|
22 |
for(int i = 0; i < 4; i++)
|
|
23 |
cout << array[i] << endl;
|
|
24 |
if (array[0]!= 1)
|
|
25 |
failures++;
|
|
26 |
if (array[1]!= 2)
|
|
27 |
failures++;
|
|
28 |
if (array[2]!= 3)
|
|
29 |
failures++;
|
|
30 |
if (array[3]!= 4)
|
|
31 |
failures++;
|
|
32 |
return failures;
|
|
33 |
}
|