ReactOS  0.4.14-dev-1036-g3c5b10f
MergeTest Class Reference
Inheritance diagram for MergeTest:
Collaboration diagram for MergeTest:

Protected Member Functions

void merge0 ()
 
void merge1 ()
 
void merge2 ()
 

Private Member Functions

 CPPUNIT_TEST_SUITE (MergeTest)
 
 CPPUNIT_TEST (merge0)
 
 CPPUNIT_TEST (merge1)
 
 CPPUNIT_TEST (merge2)
 
 CPPUNIT_TEST_SUITE_END ()
 

Detailed Description

Definition at line 16 of file merge_test.cpp.

Member Function Documentation

◆ CPPUNIT_TEST() [1/3]

MergeTest::CPPUNIT_TEST ( merge0  )
private

◆ CPPUNIT_TEST() [2/3]

MergeTest::CPPUNIT_TEST ( merge1  )
private

◆ CPPUNIT_TEST() [3/3]

MergeTest::CPPUNIT_TEST ( merge2  )
private

◆ CPPUNIT_TEST_SUITE()

MergeTest::CPPUNIT_TEST_SUITE ( MergeTest  )
private

◆ CPPUNIT_TEST_SUITE_END()

MergeTest::CPPUNIT_TEST_SUITE_END ( )
private

◆ merge0()

void MergeTest::merge0 ( )
protected

Definition at line 35 of file merge_test.cpp.

36 {
37  int numbers1[5] = { 1, 6, 13, 25, 101 };
38  int numbers2[5] = {-5, 26, 36, 46, 99 };
39 
40  int result[10];
41  merge((int*)numbers1, (int*)numbers1 + 5, (int*)numbers2, (int*)numbers2 + 5, (int*)result);
42 
43  CPPUNIT_ASSERT(result[0]==-5);
44  CPPUNIT_ASSERT(result[1]==1);
45  CPPUNIT_ASSERT(result[2]==6);
46  CPPUNIT_ASSERT(result[3]==13);
47  CPPUNIT_ASSERT(result[4]==25);
48  CPPUNIT_ASSERT(result[5]==26);
49  CPPUNIT_ASSERT(result[6]==36);
50  CPPUNIT_ASSERT(result[7]==46);
51  CPPUNIT_ASSERT(result[8]==99);
52  CPPUNIT_ASSERT(result[9]==101);
53 }
_STLP_MOVE_TO_STD_NAMESPACE _OutputIter merge(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2, _OutputIter __result)
Definition: _algo.c:1419
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
GLuint64EXT * result
Definition: glext.h:11304

◆ merge1()

void MergeTest::merge1 ( )
protected

Definition at line 54 of file merge_test.cpp.

55 {
56  vector<int> v1(5);
57  vector<int> v2(v1.size());
58  __iota(v1.begin(), v1.end(), 0);
59  __iota(v2.begin(), v2.end(), 3);
60 
61  vector <int> result(v1.size() + v2.size());
62  merge(v1.begin(), v1.end(), v2.begin(), v2.end(), result.begin());
63 
64  CPPUNIT_ASSERT(result[0]==0);
65  CPPUNIT_ASSERT(result[1]==1);
66  CPPUNIT_ASSERT(result[2]==2);
67  CPPUNIT_ASSERT(result[3]==3);
68  CPPUNIT_ASSERT(result[4]==3);
69  CPPUNIT_ASSERT(result[5]==4);
70  CPPUNIT_ASSERT(result[6]==4);
71  CPPUNIT_ASSERT(result[7]==5);
72  CPPUNIT_ASSERT(result[8]==6);
73  CPPUNIT_ASSERT(result[9]==7);
74 
75 }
void __iota(_It __first, _It __last, _Tp __val)
Definition: iota.h:8
_STLP_MOVE_TO_STD_NAMESPACE _OutputIter merge(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2, _OutputIter __result)
Definition: _algo.c:1419
#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

◆ merge2()

void MergeTest::merge2 ( )
protected

Definition at line 76 of file merge_test.cpp.

77 {
78  vector <int> v1(5);
79  vector <int> v2(v1.size());
80  for (int i = 0; (size_t)i < v1.size(); ++i) {
81  v1[i] = 10 - i;
82  v2[i] = 7 - i;
83  }
84  vector<int> result(v1.size() + v2.size());
85  merge(v1.begin(), v1.end(), v2.begin(), v2.end(), result.begin(), greater<int>() );
86 
87  CPPUNIT_ASSERT(result[0]==10);
88  CPPUNIT_ASSERT(result[1]==9);
89  CPPUNIT_ASSERT(result[2]==8);
90  CPPUNIT_ASSERT(result[3]==7);
91  CPPUNIT_ASSERT(result[4]==7);
92  CPPUNIT_ASSERT(result[5]==6);
93  CPPUNIT_ASSERT(result[6]==6);
94  CPPUNIT_ASSERT(result[7]==5);
95  CPPUNIT_ASSERT(result[8]==4);
96  CPPUNIT_ASSERT(result[9]==3);
97 }
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
_STLP_MOVE_TO_STD_NAMESPACE _OutputIter merge(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2, _OutputIter __result)
Definition: _algo.c:1419
__kernel_size_t size_t
Definition: linux.h:237
#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

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