1#include <vector>
2#include <algorithm>
3
4#include "cppunit/cppunit_proxy.h"
5
6#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
7using namespace std;
8#endif
9
10//
11// TestCase class
12//
13class AdvanceTest : public CPPUNIT_NS::TestCase
14{
15  CPPUNIT_TEST_SUITE(AdvanceTest);
16  CPPUNIT_TEST(adv);
17  CPPUNIT_TEST_SUITE_END();
18
19protected:
20  void adv();
21};
22
23CPPUNIT_TEST_SUITE_REGISTRATION(AdvanceTest);
24
25//
26// tests implementation
27//
28void AdvanceTest::adv()
29{
30  typedef vector <int> IntVector;
31  IntVector v(10);
32  for (int i = 0; (size_t)i < v.size(); ++i)
33    v[i] = i;
34  IntVector::iterator location = v.begin();
35  CPPUNIT_ASSERT(*location==0);
36  advance(location, 5);
37  CPPUNIT_ASSERT(*location==5);
38}
39