ReactOS  0.4.14-dev-384-g5b37caa
SetDifferenceTest Class Reference
Inheritance diagram for SetDifferenceTest:
Collaboration diagram for SetDifferenceTest:

Protected Member Functions

void setdiff0 ()
 
void setdiff1 ()
 
void setdiff2 ()
 
void setsymd0 ()
 
void setsymd1 ()
 
void setsymd2 ()
 

Private Member Functions

 CPPUNIT_TEST_SUITE (SetDifferenceTest)
 
 CPPUNIT_TEST (setdiff0)
 
 CPPUNIT_TEST (setdiff1)
 
 CPPUNIT_TEST (setdiff2)
 
 CPPUNIT_TEST (setsymd0)
 
 CPPUNIT_TEST (setsymd1)
 
 CPPUNIT_TEST (setsymd2)
 
 CPPUNIT_TEST_SUITE_END ()
 

Detailed Description

Definition at line 18 of file setdiff_test.cpp.

Member Function Documentation

◆ CPPUNIT_TEST() [1/6]

SetDifferenceTest::CPPUNIT_TEST ( setdiff0  )
private

◆ CPPUNIT_TEST() [2/6]

SetDifferenceTest::CPPUNIT_TEST ( setdiff1  )
private

◆ CPPUNIT_TEST() [3/6]

SetDifferenceTest::CPPUNIT_TEST ( setdiff2  )
private

◆ CPPUNIT_TEST() [4/6]

SetDifferenceTest::CPPUNIT_TEST ( setsymd0  )
private

◆ CPPUNIT_TEST() [5/6]

SetDifferenceTest::CPPUNIT_TEST ( setsymd1  )
private

◆ CPPUNIT_TEST() [6/6]

SetDifferenceTest::CPPUNIT_TEST ( setsymd2  )
private

◆ CPPUNIT_TEST_SUITE()

SetDifferenceTest::CPPUNIT_TEST_SUITE ( SetDifferenceTest  )
private

◆ CPPUNIT_TEST_SUITE_END()

SetDifferenceTest::CPPUNIT_TEST_SUITE_END ( )
private

◆ setdiff0()

void SetDifferenceTest::setdiff0 ( )
protected

Definition at line 87 of file setdiff_test.cpp.

88 {
89  int v1[3] = { 13, 18, 23 };
90  int v2[4] = { 10, 13, 17, 23 };
91  int result[4] = { 0, 0, 0, 0 };
92  //18 0 0 0
93  //10 17 23 0
94 
95  set_difference((int*)v1, (int*)v1 + 3, (int*)v2, (int*)v2 + 4, (int*)result);
96  CPPUNIT_ASSERT( result[0] == 18 );
97  CPPUNIT_ASSERT( result[1] == 0 );
98  CPPUNIT_ASSERT( result[2] == 0 );
99  CPPUNIT_ASSERT( result[3] == 0 );
100 
101  set_difference((int*)v2, (int*)v2 + 4, (int*)v1, (int*)v1 + 2, (int*)result);
102  CPPUNIT_ASSERT( result[0] == 10 );
103  CPPUNIT_ASSERT( result[1] == 17 );
104  CPPUNIT_ASSERT( result[2] == 23 );
105  CPPUNIT_ASSERT( result[3] == 0 );
106 }
_STLP_MOVE_TO_STD_NAMESPACE _OutputIter set_difference(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2, _OutputIter __result)
Definition: _algo.c:1732
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
GLfloat GLfloat GLfloat v2
Definition: glext.h:6063
GLuint64EXT * result
Definition: glext.h:11304
GLfloat GLfloat v1
Definition: glext.h:6062

◆ setdiff1()

void SetDifferenceTest::setdiff1 ( )
protected

Definition at line 108 of file setdiff_test.cpp.

109 {
110  vector<int> v1(10);
111  __iota(v1.begin(), v1.end(), 0);
112  vector<int> v2(10);
113  __iota(v2.begin(), v2.end(), 7);
114 
115  vector<int> diff;
116  set_difference(v1.begin(), v1.end(), v2.begin(), v2.end(), back_inserter(diff));
117  CPPUNIT_ASSERT( diff.size() == 7 );
118  for (int i = 0; i < 7; ++i) {
119  CPPUNIT_ASSERT( diff[i] == i );
120  }
121 }
void __iota(_It __first, _It __last, _Tp __val)
Definition: iota.h:8
_STLP_MOVE_TO_STD_NAMESPACE _OutputIter set_difference(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2, _OutputIter __result)
Definition: _algo.c:1732
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
back_insert_iterator< _Container > _STLP_CALL back_inserter(_Container &__x)
Definition: _iterator.h:187
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
GLfloat GLfloat GLfloat v2
Definition: glext.h:6063
GLfloat GLfloat v1
Definition: glext.h:6062

◆ setdiff2()

void SetDifferenceTest::setdiff2 ( )
protected

Definition at line 123 of file setdiff_test.cpp.

124 {
125  const char* word1 = "ABCDEFGHIJKLMNO";
126  const char* word2 = "LMNOPQRSTUVWXYZ";
127 
128  string diff;
129  set_difference(word1, word1 + ::strlen(word1), word2, word2 + ::strlen(word2), back_inserter(diff), less<char>());
130  CPPUNIT_ASSERT( diff.size() == 11 );
131  for (int i = 0; i < 11; ++i) {
132  CPPUNIT_ASSERT( diff[i] == ('A' + i) );
133  }
134 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
_STLP_MOVE_TO_STD_NAMESPACE _OutputIter set_difference(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2, _OutputIter __result)
Definition: _algo.c:1732
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
back_insert_iterator< _Container > _STLP_CALL back_inserter(_Container &__x)
Definition: _iterator.h:187
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200

◆ setsymd0()

void SetDifferenceTest::setsymd0 ( )
protected

Definition at line 43 of file setdiff_test.cpp.

44 {
45  int v1[3] = { 13, 18, 23 };
46  int v2[4] = { 10, 13, 17, 23 };
47  int result[4] = { 0, 0, 0, 0 };
48 
49  set_symmetric_difference((int*)v1, (int*)v1 + 3, (int*)v2, (int*)v2 + 4, (int*)result);
50  CPPUNIT_ASSERT(result[0]==10);
51  CPPUNIT_ASSERT(result[1]==17);
52  CPPUNIT_ASSERT(result[2]==18);
53  CPPUNIT_ASSERT(result[3]==0);
54 }
_STLP_MOVE_TO_STD_NAMESPACE _OutputIter set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2, _OutputIter __result)
Definition: _algo.c:1780
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
GLfloat GLfloat GLfloat v2
Definition: glext.h:6063
GLuint64EXT * result
Definition: glext.h:11304
GLfloat GLfloat v1
Definition: glext.h:6062

◆ setsymd1()

void SetDifferenceTest::setsymd1 ( )
protected

Definition at line 56 of file setdiff_test.cpp.

57 {
58  vector<int> v1(10);
59  __iota(v1.begin(), v1.end(), 0);
60  vector<int> v2(10);
61  __iota(v2.begin(), v2.end(), 7);
62 
63  vector<int> diff;
64  set_symmetric_difference(v1.begin(), v1.end(), v2.begin(), v2.end(), back_inserter(diff));
65  CPPUNIT_ASSERT( diff.size() == 14 );
66  int int_res[] = {0, 1, 2, 3, 4, 5, 6, 10, 11, 12, 13, 14, 15, 16};
67  for (int i = 0; i < 14; ++i) {
68  CPPUNIT_ASSERT( diff[i] == int_res[i] );
69  }
70 }
void __iota(_It __first, _It __last, _Tp __val)
Definition: iota.h:8
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
back_insert_iterator< _Container > _STLP_CALL back_inserter(_Container &__x)
Definition: _iterator.h:187
_STLP_MOVE_TO_STD_NAMESPACE _OutputIter set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2, _OutputIter __result)
Definition: _algo.c:1780
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
GLfloat GLfloat GLfloat v2
Definition: glext.h:6063
GLfloat GLfloat v1
Definition: glext.h:6062

◆ setsymd2()

void SetDifferenceTest::setsymd2 ( )
protected

Definition at line 72 of file setdiff_test.cpp.

73 {
74  const char* word1 = "ABCDEFGHIJKLMNO";
75  const char* word2 = "LMNOPQRSTUVWXYZ";
76 
77  string diff;
78  set_symmetric_difference(word1, word1 + ::strlen(word1), word2, word2 + ::strlen(word2),
79  back_inserter(diff), less<char>());
80  CPPUNIT_ASSERT( diff.size() == 22 );
81  char char_res[] = "ABCDEFGHIJKPQRSTUVWXYZ";
82  for (int i = 0; i < 22; ++i) {
83  CPPUNIT_ASSERT( diff[i] == char_res[i] );
84  }
85 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
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
back_insert_iterator< _Container > _STLP_CALL back_inserter(_Container &__x)
Definition: _iterator.h:187
_STLP_MOVE_TO_STD_NAMESPACE _OutputIter set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2, _OutputIter __result)
Definition: _algo.c:1780
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200

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