ReactOS 0.4.15-dev-7961-gdcf9eb0
insert_test.cpp
Go to the documentation of this file.
1#include <deque>
2#include <vector>
3#include <algorithm>
4
6
7#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
8using namespace std;
9#endif
10
11//
12// TestCase class
13//
14class InsertTest : public CPPUNIT_NS::TestCase
15{
20
21protected:
22 void insert1();
23 void insert2();
24};
25
27
28//
29// tests implementation
30//
32{
33 char const* array1 [] = { "laurie", "jennifer", "leisa" };
34 char const* array2 [] = { "amanda", "saskia", "carrie" };
35
36 deque<char const*> names(array1, array1 + 3);
38
40 itd = copy(array2, array2 + 3, insert_iterator<deque <char const*> >(names, i));
41
42 CPPUNIT_ASSERT( !strcmp(names[0], "laurie") );
43 CPPUNIT_ASSERT( !strcmp(names[1], "jennifer") );
44 CPPUNIT_ASSERT( !strcmp(names[2], "amanda") );
45 CPPUNIT_ASSERT( !strcmp(names[3], "saskia") );
46 CPPUNIT_ASSERT( !strcmp(names[4], "carrie") );
47 CPPUNIT_ASSERT( !strcmp(names[5], "leisa") );
48
49 copy(array1, array1 + 3, itd);
50 CPPUNIT_ASSERT( !strcmp(names[5], "laurie") );
51 CPPUNIT_ASSERT( !strcmp(names[6], "jennifer") );
52 CPPUNIT_ASSERT( !strcmp(names[7], "leisa") );
53 CPPUNIT_ASSERT( !strcmp(names[8], "leisa") );
54}
56{
57 char const* array1 [] = { "laurie", "jennifer", "leisa" };
58 char const* array2 [] = { "amanda", "saskia", "carrie" };
59
60 deque<char const*> names(array1, array1 + 3);
62 copy(array2, array2 + 3, inserter(names, i));
63
64 CPPUNIT_ASSERT( !strcmp(names[0], "laurie") );
65 CPPUNIT_ASSERT( !strcmp(names[1], "jennifer") );
66 CPPUNIT_ASSERT( !strcmp(names[2], "amanda") );
67 CPPUNIT_ASSERT( !strcmp(names[3], "saskia") );
68 CPPUNIT_ASSERT( !strcmp(names[4], "carrie") );
69 CPPUNIT_ASSERT( !strcmp(names[5], "leisa") );
70}
insert_iterator< _Container > _STLP_CALL inserter(_Container &__x, _Iterator __i)
Definition: _iterator.h:250
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
INT copy(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch)
Definition: copy.c:51
void insert2()
Definition: insert_test.cpp:55
void insert1()
Definition: insert_test.cpp:31
CPPUNIT_TEST(insert2)
CPPUNIT_TEST_SUITE_END()
CPPUNIT_TEST_SUITE(InsertTest)
CPPUNIT_TEST(insert1)
Definition: _deque.h:404
_Base::iterator iterator
Definition: _deque.h:420
#define CPPUNIT_TEST_SUITE_REGISTRATION(X)
Definition: cppunit_mini.h:193
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
GLuint GLuint * names
Definition: glext.h:11545
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
Definition: features.h:417