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