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