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