ReactOS  0.4.14-dev-98-gb0d4763
inplace_test.cpp
Go to the documentation of this file.
1 #include <vector>
2 #include <algorithm>
3 #include <functional>
4 
6 
7 #if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
8 using namespace std;
9 #endif
10 
11 //
12 // TestCase class
13 //
14 class InplaceTest : public CPPUNIT_NS::TestCase
15 {
17  CPPUNIT_TEST(inplmrg1);
18  CPPUNIT_TEST(inplmrg2);
20 
21 protected:
22  void inplmrg1();
23  void inplmrg2();
24 };
25 
27 
28 //
29 // tests implementation
30 //
32 {
33  int numbers[6] = { 1, 10, 42, 3, 16, 32 };
34  inplace_merge(numbers, numbers + 3, numbers + 6);
35 
36  CPPUNIT_ASSERT(numbers[0]==1);
37  CPPUNIT_ASSERT(numbers[1]==3);
38  CPPUNIT_ASSERT(numbers[2]==10);
39  CPPUNIT_ASSERT(numbers[3]==16);
40  CPPUNIT_ASSERT(numbers[4]==32);
41  CPPUNIT_ASSERT(numbers[5]==42);
42 }
44 {
45  vector<size_t> v1(10);
46  for(size_t i = 0; i < v1.size(); ++i)
47  v1[i] =(v1.size() - i - 1) % 5;
48 
49  inplace_merge(v1.begin(), v1.begin() + 5, v1.end(), greater<size_t>());
50 
51  CPPUNIT_ASSERT(v1[0]==4);
52  CPPUNIT_ASSERT(v1[1]==4);
53  CPPUNIT_ASSERT(v1[2]==3);
54  CPPUNIT_ASSERT(v1[3]==3);
55  CPPUNIT_ASSERT(v1[4]==2);
56  CPPUNIT_ASSERT(v1[5]==2);
57  CPPUNIT_ASSERT(v1[6]==1);
58  CPPUNIT_ASSERT(v1[7]==1);
59  CPPUNIT_ASSERT(v1[8]==0);
60  CPPUNIT_ASSERT(v1[9]==0);
61 }
#define CPPUNIT_TEST_SUITE(X)
Definition: cppunit_mini.h:142
#define CPPUNIT_TEST(X)
Definition: cppunit_mini.h:182
Definition: features.h:417
_STLP_MOVE_TO_STD_NAMESPACE void inplace_merge(_BidirectionalIter __first, _BidirectionalIter __middle, _BidirectionalIter __last)
Definition: _algo.c:1553
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
#define CPPUNIT_TEST_SUITE_END()
Definition: cppunit_mini.h:191
void inplmrg1()
void inplmrg2()
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
CPPUNIT_TEST_SUITE_REGISTRATION(InplaceTest)
GLfloat GLfloat v1
Definition: glext.h:6062