31
|
1 |
|
|
2 |
// STLport regression testsuite component.
|
|
3 |
// To compile as a separate example, please #define MAIN.
|
|
4 |
|
|
5 |
#include <iostream>
|
|
6 |
#include <vector>
|
|
7 |
#include <algorithm>
|
|
8 |
#include <functional>
|
|
9 |
|
|
10 |
#ifdef MAIN
|
|
11 |
#define func3_test main
|
|
12 |
#endif
|
|
13 |
|
|
14 |
#if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
|
|
15 |
using namespace std;
|
|
16 |
#endif
|
|
17 |
int func3_test(int, char**)
|
|
18 |
{
|
|
19 |
cout<<"Results of func3_test:"<<endl;
|
|
20 |
int sort_arr[3] = { 5, 4, 1};
|
|
21 |
|
|
22 |
vector<int>v;
|
|
23 |
v.push_back(4);
|
|
24 |
v.push_back(1);
|
|
25 |
v.push_back(5);
|
|
26 |
sort(v.begin(), v.end(), greater<int>());
|
|
27 |
std::vector<int>::iterator i;
|
|
28 |
int j;
|
|
29 |
int failures = 0;
|
|
30 |
for(i = v.begin(), j=0; i != v.end(); i++, j++)
|
|
31 |
{
|
|
32 |
cout << *i << endl;
|
|
33 |
if(*i != sort_arr[j])
|
|
34 |
failures++;
|
|
35 |
}
|
|
36 |
|
|
37 |
if(!failures)
|
|
38 |
return 0;
|
|
39 |
else
|
|
40 |
return 1;
|
|
41 |
}
|