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 |
|
|
19 |
// STLport regression testsuite component.
|
|
20 |
// To compile as a separate example, please #define MAIN.
|
|
21 |
|
|
22 |
#include <vector>
|
|
23 |
#include <algorithm>
|
|
24 |
#include <iostream>
|
|
25 |
#include <iterator>
|
|
26 |
|
|
27 |
#ifdef MAIN
|
|
28 |
#define copy2_test main
|
|
29 |
#endif
|
|
30 |
|
|
31 |
#if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
|
|
32 |
using namespace std;
|
|
33 |
#endif
|
|
34 |
int copy2_test(int, char**)
|
|
35 |
{
|
|
36 |
cout<<"Results of copy2_test:"<<endl;
|
|
37 |
vector <int> v(10);
|
|
38 |
int failure = 0;
|
|
39 |
for(int i = 0; i < v.size(); i++)
|
|
40 |
v[i] = i;
|
|
41 |
ostream_iterator<int> iter(cout, " ");
|
|
42 |
copy(v.begin(), v.end(), iter);
|
|
43 |
cout << endl;
|
|
44 |
if(v[0] != 0)
|
|
45 |
failure++;
|
|
46 |
if(v[1] != 1)
|
|
47 |
failure++;
|
|
48 |
if(v[2] != 2)
|
|
49 |
failure++;
|
|
50 |
if(v[3] != 3)
|
|
51 |
failure++;
|
|
52 |
if(v[4] != 4)
|
|
53 |
failure++;
|
|
54 |
if(v[5] != 5)
|
|
55 |
failure++;
|
|
56 |
if(v[6] != 6)
|
|
57 |
failure++;
|
|
58 |
if(v[7] != 7)
|
|
59 |
failure++;
|
|
60 |
if(v[8] != 8)
|
|
61 |
failure++;
|
|
62 |
if(v[9] != 9)
|
|
63 |
failure++;
|
|
64 |
return failure;
|
|
65 |
}
|