|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 // STLport regression testsuite component. |
|
19 // To compile as a separate example, please #define MAIN. |
|
20 |
|
21 #include <iostream> |
|
22 #include <deque> |
|
23 #include <algorithm> |
|
24 #include <string> |
|
25 |
|
26 #ifdef MAIN |
|
27 #define insert2_test main |
|
28 #endif |
|
29 |
|
30 #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES) |
|
31 using namespace std; |
|
32 #endif |
|
33 |
|
34 int insert2_test(int, char**) |
|
35 { |
|
36 cout<<"Results of insert2_test:"<<endl; |
|
37 char* array1 [] = { "laurie", "jennifer", "leisa" }; |
|
38 char* array2 [] = { "amanda", "saskia", "carrie" }; |
|
39 char* array3[6]; |
|
40 int failures = 0, a = 0; |
|
41 deque<char*> names(array1, array1 + 3); |
|
42 deque<char*>::iterator i = names.begin() + 2; |
|
43 copy(array2, array2 + 3, inserter(names, i)); |
|
44 std::deque<char*>::iterator j; |
|
45 for(j = names.begin(); j != names.end(); j++) |
|
46 { |
|
47 std::cout << *j << std::endl; |
|
48 array3[a]=*j; |
|
49 a++; |
|
50 } |
|
51 |
|
52 if(strcmp(array3[0],"laurie") != 0) |
|
53 failures++; |
|
54 if(strcmp(array3[1],"jennifer") != 0) |
|
55 failures++; |
|
56 if(strcmp(array3[2],"amanda") != 0) |
|
57 failures++; |
|
58 if(strcmp(array3[3],"saskia") != 0) |
|
59 failures++; |
|
60 if(strcmp(array3[4],"carrie") != 0) |
|
61 failures++; |
|
62 if(strcmp(array3[5],"leisa") != 0) |
|
63 failures++; |
|
64 |
|
65 |
|
66 return failures; |
|
67 |
|
68 } |