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