ReactOS  0.4.15-dev-3733-g974a0f0
UniqueTest Class Reference
Inheritance diagram for UniqueTest:
Collaboration diagram for UniqueTest:

Protected Member Functions

void uniqcpy1 ()
 
void uniqcpy2 ()
 
void unique1 ()
 
void unique2 ()
 

Private Member Functions

 CPPUNIT_TEST_SUITE (UniqueTest)
 
 CPPUNIT_TEST (uniqcpy1)
 
 CPPUNIT_TEST (uniqcpy2)
 
 CPPUNIT_TEST (unique1)
 
 CPPUNIT_TEST (unique2)
 
 CPPUNIT_TEST_SUITE_END ()
 

Detailed Description

Definition at line 12 of file unique_test.cpp.

Member Function Documentation

◆ CPPUNIT_TEST() [1/4]

UniqueTest::CPPUNIT_TEST ( uniqcpy1  )
private

◆ CPPUNIT_TEST() [2/4]

UniqueTest::CPPUNIT_TEST ( uniqcpy2  )
private

◆ CPPUNIT_TEST() [3/4]

UniqueTest::CPPUNIT_TEST ( unique1  )
private

◆ CPPUNIT_TEST() [4/4]

UniqueTest::CPPUNIT_TEST ( unique2  )
private

◆ CPPUNIT_TEST_SUITE()

UniqueTest::CPPUNIT_TEST_SUITE ( UniqueTest  )
private

◆ CPPUNIT_TEST_SUITE_END()

UniqueTest::CPPUNIT_TEST_SUITE_END ( )
private

◆ uniqcpy1()

void UniqueTest::uniqcpy1 ( )
protected

Definition at line 68 of file unique_test.cpp.

69 {
70  int numbers[8] = { 0, 1, 1, 2, 2, 2, 3, 4 };
71  int result[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
72 
73  unique_copy((int*)numbers, (int*)numbers + 8, (int*)result);
74 
75  // 0 1 2 3 4 0 0 0
76  CPPUNIT_ASSERT(result[0]==0);
77  CPPUNIT_ASSERT(result[1]==1);
78  CPPUNIT_ASSERT(result[2]==2);
79  CPPUNIT_ASSERT(result[3]==3);
80  CPPUNIT_ASSERT(result[4]==4);
81  CPPUNIT_ASSERT(result[5]==0);
82  CPPUNIT_ASSERT(result[6]==0);
83  CPPUNIT_ASSERT(result[7]==0);
84 }
_STLP_MOVE_TO_STD_NAMESPACE _OutputIter unique_copy(_InputIter __first, _InputIter __last, _OutputIter __result)
Definition: _algo.c:348
GLuint64EXT * result
Definition: glext.h:11304
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200

◆ uniqcpy2()

void UniqueTest::uniqcpy2 ( )
protected

Definition at line 86 of file unique_test.cpp.

87 {
88  const char* labels[] = {"Q", "Q", "W", "W", "E", "E", "R", "T", "T", "Y", "Y"};
89  const char **plabels = (const char**)labels;
90 
91  const size_t count = sizeof(labels) / sizeof(labels[0]);
92  const char* uCopy[count];
93  const char **puCopy = &uCopy[0];
94  fill(puCopy, puCopy + count, "");
95 
96  unique_copy(plabels, plabels + count, puCopy, str_equal);
97 
98  //QWERTY
99  CPPUNIT_ASSERT(*uCopy[0] == 'Q');
100  CPPUNIT_ASSERT(*uCopy[1] == 'W');
101  CPPUNIT_ASSERT(*uCopy[2] == 'E');
102  CPPUNIT_ASSERT(*uCopy[3] == 'R');
103  CPPUNIT_ASSERT(*uCopy[4] == 'T');
104  CPPUNIT_ASSERT(*uCopy[5] == 'Y');
105 }
_STLP_MOVE_TO_STD_NAMESPACE _OutputIter unique_copy(_InputIter __first, _InputIter __last, _OutputIter __result)
Definition: _algo.c:348
GLuint GLuint GLsizei count
Definition: gl.h:1545
_STLP_MOVE_TO_STD_NAMESPACE void fill(_ForwardIter __first, _ForwardIter __last, const _Tp &__val)
Definition: _algobase.h:449
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
static bool str_equal(const char *a_, const char *b_)
Definition: unique_test.cpp:30

◆ unique1()

void UniqueTest::unique1 ( )
protected

Definition at line 35 of file unique_test.cpp.

36 {
37  int numbers[8] = { 0, 1, 1, 2, 2, 2, 3, 4 };
38  unique((int*)numbers, (int*)numbers + 8);
39  // 0 1 2 3 4 2 3 4
40  CPPUNIT_ASSERT(numbers[0]==0);
41  CPPUNIT_ASSERT(numbers[1]==1);
42  CPPUNIT_ASSERT(numbers[2]==2);
43  CPPUNIT_ASSERT(numbers[3]==3);
44  CPPUNIT_ASSERT(numbers[4]==4);
45  CPPUNIT_ASSERT(numbers[5]==2);
46  CPPUNIT_ASSERT(numbers[6]==3);
47  CPPUNIT_ASSERT(numbers[7]==4);
48 }
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
_ForwardIter unique(_ForwardIter __first, _ForwardIter __last)
Definition: _algo.h:298

◆ unique2()

void UniqueTest::unique2 ( )
protected

Definition at line 50 of file unique_test.cpp.

51 {
52  const char* labels[] = {"Q", "Q", "W", "W", "E", "E", "R", "T", "T", "Y", "Y"};
53 
54  const unsigned count = sizeof(labels) / sizeof(labels[0]);
55 
56  unique((const char**)labels, (const char**)labels + count, str_equal);
57 
58  // QWERTY
59  CPPUNIT_ASSERT(*labels[0] == 'Q');
60  CPPUNIT_ASSERT(*labels[1] == 'W');
61  CPPUNIT_ASSERT(*labels[2] == 'E');
62  CPPUNIT_ASSERT(*labels[3] == 'R');
63  CPPUNIT_ASSERT(*labels[4] == 'T');
64  CPPUNIT_ASSERT(*labels[5] == 'Y');
65 
66 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
_ForwardIter unique(_ForwardIter __first, _ForwardIter __last)
Definition: _algo.h:298
static bool str_equal(const char *a_, const char *b_)
Definition: unique_test.cpp:30

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