31
|
1 |
|
|
2 |
// STLport regression testsuite component.
|
|
3 |
// To compile as a separate example, please #define MAIN.
|
|
4 |
|
|
5 |
#include <vector>
|
|
6 |
#include <algorithm>
|
|
7 |
#include <numeric>
|
|
8 |
#include <iostream>
|
|
9 |
#include <iterator>
|
|
10 |
|
|
11 |
#ifdef MAIN
|
|
12 |
#define iterswp1_test main
|
|
13 |
#endif
|
|
14 |
|
|
15 |
#if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
|
|
16 |
using namespace std;
|
|
17 |
#endif
|
|
18 |
int iterswp1_test(int, char**)
|
|
19 |
{
|
|
20 |
|
|
21 |
cout<<"Results of iterswp1_test:"<<endl;
|
|
22 |
int failures=0;
|
|
23 |
vector <int> v1(6);
|
|
24 |
iota(v1.begin(), v1.end(), 0);
|
|
25 |
iter_swap(v1.begin(), v1.begin() + 3);
|
|
26 |
ostream_iterator <int> iter(cout, " ");
|
|
27 |
|
|
28 |
copy(v1.begin(), v1.end(), iter);
|
|
29 |
|
|
30 |
cout << endl;
|
|
31 |
if(v1[0] != 3)
|
|
32 |
failures++;
|
|
33 |
if(v1[1] != 1)
|
|
34 |
failures++;
|
|
35 |
if(v1[2] != 2)
|
|
36 |
failures++;
|
|
37 |
if(v1[3] !=0 )
|
|
38 |
failures++;
|
|
39 |
if(v1[4] != 4)
|
|
40 |
failures++;
|
|
41 |
if(v1[5] != 5)
|
|
42 |
failures++;
|
|
43 |
return failures;
|
|
44 |
}
|