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 |
|
|
9 |
#ifdef MAIN
|
|
10 |
#define func2_test main
|
|
11 |
#endif
|
|
12 |
|
|
13 |
#if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
|
|
14 |
using namespace std;
|
|
15 |
#endif
|
|
16 |
|
|
17 |
static bool bigger_than(int x_, int y_)
|
|
18 |
{
|
|
19 |
return x_ > y_;
|
|
20 |
}
|
|
21 |
int func2_test(int, char**)
|
|
22 |
{
|
|
23 |
cout<<"Results of func2_test:"<<endl;
|
|
24 |
int sort_arr[3] = { 5, 4, 1};
|
|
25 |
|
|
26 |
std::vector<int>v;
|
|
27 |
v.push_back(4);
|
|
28 |
v.push_back(1);
|
|
29 |
v.push_back(5);
|
|
30 |
sort(v.begin(), v.end(), bigger_than);
|
|
31 |
std::vector<int>::iterator i;
|
|
32 |
int j;
|
|
33 |
int failures = 0;
|
|
34 |
for(i = v.begin(), j = 0; i != v.end(); i++, j++)
|
|
35 |
{
|
|
36 |
cout << *i << endl;
|
|
37 |
if(sort_arr[j] != (*i))
|
|
38 |
failures++;
|
|
39 |
}
|
|
40 |
if(!failures)
|
|
41 |
return 0;
|
|
42 |
else
|
|
43 |
return 1;
|
|
44 |
}
|