equal
deleted
inserted
replaced
|
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 ptition0_test main |
|
10 #endif |
|
11 |
|
12 #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES) |
|
13 using namespace std; |
|
14 #endif |
|
15 static int less_10(int a_) |
|
16 { |
|
17 return a_ < 10 ? 1 : 0; |
|
18 } |
|
19 |
|
20 int ptition0_test(int, char**) |
|
21 { |
|
22 int failures=0; |
|
23 cout<<"Results of ptition0_test:"<<endl; |
|
24 int numbers[6] = { 6, 12, 3, 10, 1, 20 }; |
|
25 |
|
26 partition((int*)numbers, (int*)numbers + 6, less_10); |
|
27 for(int i = 0; i < 6; i++) |
|
28 cout << numbers[i] << ' '; |
|
29 cout << endl; |
|
30 |
|
31 if(6 !=numbers[0]) |
|
32 failures++; |
|
33 else if(1 !=numbers[1]) |
|
34 failures++; |
|
35 else if(3!=numbers[2]) |
|
36 failures++; |
|
37 else if(10!=numbers[3]) |
|
38 failures++; |
|
39 else if(12!=numbers[4]) |
|
40 failures++; |
|
41 else if(20!=numbers[5]) |
|
42 failures++; |
|
43 |
|
44 |
|
45 if(failures) |
|
46 return 1; |
|
47 else |
|
48 return 0; |
|
49 } |
|
50 |