31
|
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 |
#include <iostream>
|
|
21 |
#include <deque>
|
|
22 |
#include <algorithm>
|
|
23 |
#include <string>
|
|
24 |
|
|
25 |
#ifdef MAIN
|
|
26 |
#define insert1_test main
|
|
27 |
#endif
|
|
28 |
|
|
29 |
#if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
|
|
30 |
using namespace std;
|
|
31 |
#endif
|
|
32 |
|
|
33 |
int insert1_test(int, char**)
|
|
34 |
{
|
|
35 |
cout<<"Results of insert1_test:"<<endl;
|
|
36 |
char* array1 [] = { "laurie", "jennifer", "leisa" };
|
|
37 |
char* array2 [] = { "amanda", "saskia", "carrie" };
|
|
38 |
char* array3 [6];
|
|
39 |
int failures = 0;
|
|
40 |
deque<char*> names(array1, array1 + 3);
|
|
41 |
std::deque<char*>::iterator i = names.begin() + 2;
|
|
42 |
copy(array2, array2 + 3, insert_iterator<deque <char*> >(names, i));
|
|
43 |
std::deque<char*>::iterator j;
|
|
44 |
int a=0;
|
|
45 |
for(j = names.begin(); j != names.end(); j++)
|
|
46 |
{
|
|
47 |
cout << *j << 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 |
}
|