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