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