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