ReactOS  0.4.15-dev-4863-gba0d16f
IterTest Class Reference
Inheritance diagram for IterTest:
Collaboration diagram for IterTest:

Protected Member Functions

void iter1 ()
 
void iter3 ()
 
void iter4 ()
 
void iterswp0 ()
 
void iterswp1 ()
 
void iterswp2 ()
 
void iterswp3 ()
 

Private Member Functions

 CPPUNIT_TEST_SUITE (IterTest)
 
 CPPUNIT_TEST (iter1)
 
 CPPUNIT_TEST (iter3)
 
 CPPUNIT_TEST (iter4)
 
 CPPUNIT_TEST (iterswp0)
 
 CPPUNIT_TEST (iterswp1)
 
 CPPUNIT_TEST (iterswp2)
 
 CPPUNIT_TEST (iterswp3)
 
 CPPUNIT_TEST_SUITE_END ()
 

Detailed Description

Definition at line 16 of file iter_test.cpp.

Member Function Documentation

◆ CPPUNIT_TEST() [1/7]

IterTest::CPPUNIT_TEST ( iter1  )
private

◆ CPPUNIT_TEST() [2/7]

IterTest::CPPUNIT_TEST ( iter3  )
private

◆ CPPUNIT_TEST() [3/7]

IterTest::CPPUNIT_TEST ( iter4  )
private

◆ CPPUNIT_TEST() [4/7]

IterTest::CPPUNIT_TEST ( iterswp0  )
private

◆ CPPUNIT_TEST() [5/7]

IterTest::CPPUNIT_TEST ( iterswp1  )
private

◆ CPPUNIT_TEST() [6/7]

IterTest::CPPUNIT_TEST ( iterswp2  )
private

◆ CPPUNIT_TEST() [7/7]

IterTest::CPPUNIT_TEST ( iterswp3  )
private

◆ CPPUNIT_TEST_SUITE()

IterTest::CPPUNIT_TEST_SUITE ( IterTest  )
private

◆ CPPUNIT_TEST_SUITE_END()

IterTest::CPPUNIT_TEST_SUITE_END ( )
private

◆ iter1()

void IterTest::iter1 ( )
protected

Definition at line 43 of file iter_test.cpp.

44 {
45  vector<const char*> v; // Vector of character strings.
46  v.push_back("zippy"); // First element.
47  v.push_back("motorboy"); // Second element.
48  typedef vector<const char*> vec;
49  unsigned counter = 0;
50  for (vec::iterator i = v.begin(); i != v.end(); ++i, ++counter) {
51  switch (counter) {
52  case 0:
53  CPPUNIT_ASSERT(!strcmp(*i, "zippy"));
54  break;
55  case 1:
56  CPPUNIT_ASSERT(!strcmp(*i, "motorboy"));
57  break;
58  default:
60  }
61  }
62 }
GLuint counter
Definition: glext.h:11116
FT_Vector * vec
Definition: ftbbox.c:448
#define CPPUNIT_FAIL
Definition: cppunit_mini.h:206
WDF_CHILD_LIST_ITERATOR iterator
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
const GLdouble * v
Definition: gl.h:2040
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

◆ iter3()

void IterTest::iter3 ( )
protected

Definition at line 63 of file iter_test.cpp.

64 {
65  typedef vector<const char*> Vec;
66  Vec v; // Vector of character strings.
67  v.push_back("zippy"); // First element.
68  v.push_back("motorboy"); // Second element.
70  unsigned counter = 0;
71  for (it = v.rbegin(); it != v.rend(); ++it, ++counter) {
72  switch (counter) {
73  case 1:
74  CPPUNIT_ASSERT(!strcmp(*it, "zippy"));
75  break;
76  case 0:
77  CPPUNIT_ASSERT(!strcmp(*it, "motorboy"));
78  break;
79  default:
81  }
82  }
83 }
#define reverse_iterator
Definition: _abbrevs.h:34
GLuint counter
Definition: glext.h:11116
#define CPPUNIT_FAIL
Definition: cppunit_mini.h:206
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
const GLdouble * v
Definition: gl.h:2040
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

◆ iter4()

void IterTest::iter4 ( )
protected

Definition at line 84 of file iter_test.cpp.

85 {
86  vector<int> v; // Empty vector of integers.
87  v.push_back(1);
88  v.push_back(2);
89  v.push_back(3);
90  // Position immediately after last item.
91  vector<int>::iterator i = v.end();
92  // Move back one and then access.
93  CPPUNIT_ASSERT((*--i)==3);
94  i -= 2; // Jump back two items.
95  CPPUNIT_ASSERT((*i)==1);
96 }
value_type * iterator
Definition: _vector.h:124
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
const GLdouble * v
Definition: gl.h:2040
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248

◆ iterswp0()

void IterTest::iterswp0 ( )
protected

Definition at line 97 of file iter_test.cpp.

98 {
99  int numbers[6] = { 0, 1, 2, 3, 4, 5 };
100 
101  iter_swap(numbers, numbers + 3);
102 
103  CPPUNIT_ASSERT(numbers[0]==3);
104  CPPUNIT_ASSERT(numbers[1]==1);
105  CPPUNIT_ASSERT(numbers[2]==2);
106  CPPUNIT_ASSERT(numbers[3]==0);
107  CPPUNIT_ASSERT(numbers[4]==4);
108  CPPUNIT_ASSERT(numbers[5]==5);
109 
110 }
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
_STLP_MOVE_TO_STD_NAMESPACE void iter_swap(_ForwardIter1 __i1, _ForwardIter2 __i2)
Definition: _algobase.h:120

◆ iterswp1()

void IterTest::iterswp1 ( )
protected

Definition at line 111 of file iter_test.cpp.

112 {
113  vector<int> v1(6);
114  __iota(v1.begin(), v1.end(), 0);
115  iter_swap( v1.begin(), v1.begin() + 3 );
116 
117  CPPUNIT_ASSERT(v1[0]==3);
118  CPPUNIT_ASSERT(v1[1]==1);
119  CPPUNIT_ASSERT(v1[2]==2);
120  CPPUNIT_ASSERT(v1[3]==0);
121  CPPUNIT_ASSERT(v1[4]==4);
122  CPPUNIT_ASSERT(v1[5]==5);
123 }
void __iota(_It __first, _It __last, _Tp __val)
Definition: iota.h:8
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
_STLP_MOVE_TO_STD_NAMESPACE void iter_swap(_ForwardIter1 __i1, _ForwardIter2 __i2)
Definition: _algobase.h:120
GLfloat GLfloat v1
Definition: glext.h:6062

◆ iterswp2()

void IterTest::iterswp2 ( )
protected

Definition at line 124 of file iter_test.cpp.

125 {
126  vector<bool> boolVector;
127 
128  boolVector.push_back( true );
129  boolVector.push_back( false );
130 
131  vector<bool>::iterator i1 = boolVector.begin();
132  vector<bool>::iterator i2 = boolVector.begin();
133  ++i2;
134 
135  bool v0 = *i1;
136  bool v1 = *i2;
137 
138  iter_swap( i1, i2 );
139 
140  CPPUNIT_ASSERT(( *i1 == v1 && *i2 == v0 ));
141 }
GLfloat v0
Definition: glext.h:6061
value_type * iterator
Definition: _vector.h:124
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
_STLP_MOVE_TO_STD_NAMESPACE void iter_swap(_ForwardIter1 __i1, _ForwardIter2 __i2)
Definition: _algobase.h:120
GLfloat GLfloat v1
Definition: glext.h:6062

◆ iterswp3()

void IterTest::iterswp3 ( )
protected

Definition at line 144 of file iter_test.cpp.

145 {
146  vector<int> vvref(10, 10);
147  vector<int> lvref(10, 20);
148 
149  vector<vector<int> > vvints(4, vvref);
150  list<vector<int> > lvints(4, lvref);
151 
152  iter_swap(vvints.begin(), lvints.begin());
153  CPPUNIT_CHECK( vvints.front() == lvref );
154  CPPUNIT_CHECK( lvints.front() == vvref );
155 
156  //const vector<vector<int> > &cvvints = vvints;
157  //iter_swap(cvvints.begin(), lvints.begin());
158  //iter_swap(lvints.begin(), cvvints.begin());
159 
160 #if defined (STLPORT) && defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
161  int *pvvint = &vvints.front().front();
162  int *plvint = &lvints.front().front();
163 
164  iter_swap(vvints.begin(), lvints.begin());
165  //Check that elements have been swaped:
166  CPPUNIT_CHECK( pvvint == &lvints.front().front() );
167  CPPUNIT_CHECK( plvint == &vvints.front().front() );
168 #endif
169 }
#define CPPUNIT_CHECK(X)
Definition: cppunit_mini.h:195
_STLP_MOVE_TO_STD_NAMESPACE void iter_swap(_ForwardIter1 __i1, _ForwardIter2 __i2)
Definition: _algobase.h:120

The documentation for this class was generated from the following file: