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