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