ReactOS 0.4.15-dev-7842-g558ab78
MismatchTest Class Reference
Inheritance diagram for MismatchTest:
Collaboration diagram for MismatchTest:

Protected Member Functions

void mismatch0 ()
 
void mismatch1 ()
 
void mismatch2 ()
 

Private Member Functions

 CPPUNIT_TEST_SUITE (MismatchTest)
 
 CPPUNIT_TEST (mismatch0)
 
 CPPUNIT_TEST (mismatch1)
 
 CPPUNIT_TEST (mismatch2)
 
 CPPUNIT_TEST_SUITE_END ()
 

Detailed Description

Definition at line 15 of file mismatch_test.cpp.

Member Function Documentation

◆ CPPUNIT_TEST() [1/3]

MismatchTest::CPPUNIT_TEST ( mismatch0  )
private

◆ CPPUNIT_TEST() [2/3]

MismatchTest::CPPUNIT_TEST ( mismatch1  )
private

◆ CPPUNIT_TEST() [3/3]

MismatchTest::CPPUNIT_TEST ( mismatch2  )
private

◆ CPPUNIT_TEST_SUITE()

MismatchTest::CPPUNIT_TEST_SUITE ( MismatchTest  )
private

◆ CPPUNIT_TEST_SUITE_END()

MismatchTest::CPPUNIT_TEST_SUITE_END ( )
private

◆ mismatch0()

void MismatchTest::mismatch0 ( )
protected

Definition at line 38 of file mismatch_test.cpp.

39{
40 int n1[5] = { 1, 2, 3, 4, 5 };
41 int n2[5] = { 1, 2, 3, 4, 5 };
42 int n3[5] = { 1, 2, 3, 2, 1 };
43
44 pair <int*, int*> result = mismatch((int*)n1, (int*)n1 + 5, (int*)n2);
45 CPPUNIT_ASSERT(result.first ==(n1 + 5) && result.second ==(n2 + 5));
46
47 result = mismatch((int*)n1, (int*)n1 + 5, (int*)n3);
48 CPPUNIT_ASSERT(!(result.first ==(n1 + 5) && result.second ==(n3 + 5)));
49 CPPUNIT_ASSERT((result.first - n1)==3);
50}
_STLP_INLINE_LOOP _STLP_STD::pair< _InputIter1, _InputIter2 > mismatch(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2)
Definition: _algobase.h:522
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
GLuint64EXT * result
Definition: glext.h:11304
int n2
Definition: dwarfget.c:147
int n1
Definition: dwarfget.c:147
int n3
Definition: dwarfget.c:147

◆ mismatch1()

void MismatchTest::mismatch1 ( )
protected

Definition at line 51 of file mismatch_test.cpp.

52{
53 typedef vector<int> IntVec;
54 IntVec v1(10);
55 __iota(v1.begin(), v1.end(), 0);
56 IntVec v2(v1);
57
58 pair <IntVec::iterator, IntVec::iterator> result = mismatch(v1.begin(), v1.end(), v2.begin());
59
60 CPPUNIT_ASSERT(result.first == v1.end() && result.second == v2.end());
61
62 v2[v2.size()/2] = 42;
63 result = mismatch(v1.begin(), v1.end(), v2.begin());
64 CPPUNIT_ASSERT(!(result.first == v1.end() && result.second == v2.end()));
65 CPPUNIT_ASSERT((result.first - v1.begin())==5);
66}
GLfloat GLfloat v1
Definition: glext.h:6062
GLfloat GLfloat GLfloat v2
Definition: glext.h:6063
void __iota(_It __first, _It __last, _Tp __val)
Definition: iota.h:8

◆ mismatch2()

void MismatchTest::mismatch2 ( )
protected

Definition at line 67 of file mismatch_test.cpp.

68{
69 const unsigned size = 5;
70 char const* n1[size] = { "Brett", "Graham", "Jack", "Mike", "Todd" };
71
72 char const* n2[size];
73 copy(n1, n1 + 5, (char const**)n2);
74 pair <char const**, char const**> result = mismatch((char const**)n1, (char const**)n1 + size, (char const**)n2, str_equal);
75
76 CPPUNIT_ASSERT(result.first == n1 + size && result.second == n2 + size);
77
78 n2[2] = "QED";
79 result = mismatch((char const**)n1, (char const**)n1 + size, (char const**)n2, str_equal);
80 CPPUNIT_ASSERT(!(result.first == n2 + size && result.second == n2 + size));
81 CPPUNIT_ASSERT((result.first - n1)==2);
82}
INT copy(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch)
Definition: copy.c:51
GLsizeiptr size
Definition: glext.h:5919
bool str_equal(const char *a_, const char *b_)

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