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