ReactOS 0.4.15-dev-7953-g1f49173
EqualTest Class Reference
Inheritance diagram for EqualTest:
Collaboration diagram for EqualTest:

Protected Member Functions

void equal_range0 ()
 
void equal_range1 ()
 
void equal_range2 ()
 
void equal0 ()
 
void equal1 ()
 
void equal2 ()
 
void equalto ()
 

Static Protected Member Functions

static bool values_squared (int a_, int b_)
 

Private Member Functions

 CPPUNIT_TEST_SUITE (EqualTest)
 
 CPPUNIT_TEST (equal_range0)
 
 CPPUNIT_TEST (equal_range1)
 
 CPPUNIT_TEST (equal_range2)
 
 CPPUNIT_TEST (equal0)
 
 CPPUNIT_TEST (equal1)
 
 CPPUNIT_TEST (equal2)
 
 CPPUNIT_TEST (equalto)
 
 CPPUNIT_TEST_SUITE_END ()
 

Detailed Description

Definition at line 13 of file equal_test.cpp.

Member Function Documentation

◆ CPPUNIT_TEST() [1/7]

EqualTest::CPPUNIT_TEST ( equal0  )
private

◆ CPPUNIT_TEST() [2/7]

EqualTest::CPPUNIT_TEST ( equal1  )
private

◆ CPPUNIT_TEST() [3/7]

EqualTest::CPPUNIT_TEST ( equal2  )
private

◆ CPPUNIT_TEST() [4/7]

EqualTest::CPPUNIT_TEST ( equal_range0  )
private

◆ CPPUNIT_TEST() [5/7]

EqualTest::CPPUNIT_TEST ( equal_range1  )
private

◆ CPPUNIT_TEST() [6/7]

EqualTest::CPPUNIT_TEST ( equal_range2  )
private

◆ CPPUNIT_TEST() [7/7]

EqualTest::CPPUNIT_TEST ( equalto  )
private

◆ CPPUNIT_TEST_SUITE()

EqualTest::CPPUNIT_TEST_SUITE ( EqualTest  )
private

◆ CPPUNIT_TEST_SUITE_END()

EqualTest::CPPUNIT_TEST_SUITE_END ( )
private

◆ equal0()

void EqualTest::equal0 ( )
protected

Definition at line 129 of file equal_test.cpp.

130{
131 int numbers1[5] = { 1, 2, 3, 4, 5 };
132 int numbers2[5] = { 1, 2, 4, 8, 16 };
133 int numbers3[2] = { 1, 2 };
134
135 CPPUNIT_ASSERT( !equal(numbers1, numbers1 + 5, numbers2) );
136 CPPUNIT_ASSERT( equal(numbers3, numbers3 + 2, numbers1) );
137}
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
#define equal(x, y)
Definition: reader.cc:56

◆ equal1()

void EqualTest::equal1 ( )
protected

Definition at line 139 of file equal_test.cpp.

140{
141 vector <int> v1(10);
142 for (int i = 0; (size_t)i < v1.size(); ++i)
143 v1[i] = i;
144 vector <int> v2(10);
145 CPPUNIT_ASSERT( !equal(v1.begin(), v1.end(), v2.begin()) );
146
147 copy(v1.begin(), v1.end(), v2.begin());
148 CPPUNIT_ASSERT( equal(v1.begin(), v1.end(), v2.begin()) )
149}
INT copy(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch)
Definition: copy.c:51
__kernel_size_t size_t
Definition: linux.h:237
GLfloat GLfloat v1
Definition: glext.h:6062
GLfloat GLfloat GLfloat v2
Definition: glext.h:6063
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

◆ equal2()

void EqualTest::equal2 ( )
protected

Definition at line 151 of file equal_test.cpp.

152{
153 vector <int> v1(10);
154 vector <int> v2(10);
155 for (int i = 0; (size_t)i < v1.size(); ++i) {
156 v1[i] = i;
157 v2[i] = i * i;
158 }
159 CPPUNIT_ASSERT( equal(v1.begin(), v1.end(), v2.begin(), values_squared) );
160}
static bool values_squared(int a_, int b_)
Definition: equal_test.cpp:175

◆ equal_range0()

void EqualTest::equal_range0 ( )
protected

Definition at line 41 of file equal_test.cpp.

42{
43 int numbers[10] = { 0, 0, 1, 1, 2, 2, 2, 2, 3, 3 };
44 pair<int*, int*> range = equal_range((int*)numbers, (int*)numbers + 10, 2);
45 CPPUNIT_ASSERT( (range.first - numbers) == 4 );
46 CPPUNIT_ASSERT( (range.second - numbers) == 8 );
47}
_STLP_MOVE_TO_STD_NAMESPACE pair< _ForwardIter, _ForwardIter > equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp &__val)
Definition: _algo.h:535
GLenum GLint * range
Definition: glext.h:7539
Definition: _pair.h:47

◆ equal_range1()

void EqualTest::equal_range1 ( )
protected

Definition at line 49 of file equal_test.cpp.

50{
51 typedef vector <int> IntVec;
52 IntVec v(10);
53 for (int i = 0; (size_t)i < v.size(); ++i)
54 v[i] = i / 3;
55
57 CPPUNIT_ASSERT( (range.first - v.begin()) == 6 );
58 CPPUNIT_ASSERT( (range.second - v.begin()) == 9 );
59 for (; range.first != range.second; ++range.first)
60 CPPUNIT_ASSERT( *range.first == 2 );
61
62 range = equal_range(v.begin(), v.end(), 4);
63 CPPUNIT_ASSERT( range.first == range.second );
64 CPPUNIT_ASSERT( range.first == v.end() );
65}
const GLdouble * v
Definition: gl.h:2040

◆ equal_range2()

void EqualTest::equal_range2 ( )
protected

Definition at line 90 of file equal_test.cpp.

91{
92 char chars[] = "aabbccddggghhklllmqqqqssyyzz";
93
94 const unsigned count = sizeof(chars) - 1;
95 pair<char*, char*> range = equal_range((char*)chars, (char*)chars + count, 'q', less<char>());
96 CPPUNIT_ASSERT( (range.first - chars) == 18 );
97 CPPUNIT_ASSERT( (range.second - chars) == 22 );
98 for (; range.first != range.second; ++range.first)
99 CPPUNIT_ASSERT( *range.first == 'q' );
100
101 range = equal_range((char*)chars, (char*)chars + count, 'm', less<char>());
102 CPPUNIT_ASSERT( (range.second - range.first) == 1 );
103 CPPUNIT_ASSERT( *range.first == 'm' );
104
105 vector<Test> tv;
108
109 for (int i = 0; i < 10; ++i) {
110 tv.push_back(i);
111 }
112
113 it = upper_bound(tv.begin(), tv.end(), 5);
114 CPPUNIT_ASSERT( it != tv.end() );
115 CPPUNIT_ASSERT( *it == 6 );
116
117 it = lower_bound(tv.begin(), tv.end(), 5);
118 CPPUNIT_ASSERT( it != tv.end() );
119 CPPUNIT_ASSERT( *it == 5 );
120
121 p = equal_range(tv.begin(), tv.end(), 5);
122 CPPUNIT_ASSERT( p.first != p.second );
123 CPPUNIT_ASSERT( p.first != tv.end() );
124 CPPUNIT_ASSERT( p.second != tv.end() );
125 CPPUNIT_ASSERT( *p.first == 5 );
126 CPPUNIT_ASSERT( *p.second == 6 );
127}
_STLP_MOVE_TO_STD_NAMESPACE _ForwardIter upper_bound(_ForwardIter __first, _ForwardIter __last, const _Tp &__val)
Definition: _algo.h:507
_STLP_MOVE_TO_STD_NAMESPACE _ForwardIter lower_bound(_ForwardIter __first, _ForwardIter __last, const _Tp &__val)
Definition: _algo.h:481
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLfloat GLfloat p
Definition: glext.h:8902
iterator end()
Definition: _vector.h:184
void push_back(const _Tp &__x=_STLP_DEFAULT_CONSTRUCTED(_Tp))
Definition: _vector.h:379
iterator begin()
Definition: _vector.h:182
value_type * iterator
Definition: _vector.h:124

◆ equalto()

void EqualTest::equalto ( )
protected

Definition at line 162 of file equal_test.cpp.

163{
164 int input1 [4] = { 1, 7, 2, 2 };
165 int input2 [4] = { 1, 6, 2, 3 };
166
167 int output [4];
168 transform((int*)input1, (int*)input1 + 4, (int*)input2, (int*)output, equal_to<int>());
169 CPPUNIT_ASSERT( output[0] == 1 );
170 CPPUNIT_ASSERT( output[1] == 0 );
171 CPPUNIT_ASSERT( output[2] == 1 );
172 CPPUNIT_ASSERT( output[3] == 0 );
173}
GLuint GLenum GLenum transform
Definition: glext.h:9407

◆ values_squared()

bool EqualTest::values_squared ( int  a_,
int  b_ 
)
staticprotected

Definition at line 175 of file equal_test.cpp.

176{
177 return (a_ * a_ == b_);
178}

Referenced by equal2().


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