ReactOS
0.4.15-dev-1627-gaf0f858
binsert_test.cpp
Go to the documentation of this file.
1
#include <vector>
2
#include <algorithm>
3
4
#include "
cppunit/cppunit_proxy.h
"
5
6
#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
7
using namespace
std
;
8
#endif
9
10
//
11
// TestCase class
12
//
13
class
BinsertTest
:
public
CPPUNIT_NS::TestCase
14
{
15
CPPUNIT_TEST_SUITE
(
BinsertTest
);
16
CPPUNIT_TEST
(binsert1);
17
CPPUNIT_TEST
(binsert2);
18
CPPUNIT_TEST_SUITE_END
();
19
20
protected
:
21
void
binsert1();
22
void
binsert2();
23
};
24
25
CPPUNIT_TEST_SUITE_REGISTRATION
(
BinsertTest
);
26
27
//
28
// tests implementation
29
//
30
void
BinsertTest::binsert1
()
31
{
32
const
char
*
array
[] = {
"laurie"
,
"jennifer"
,
"leisa"
};
33
vector<const char*>
names
;
34
back_insert_iterator<vector<const char*>
> bit(
names
);
35
bit =
copy
(
array
,
array
+ 3, bit);
36
37
CPPUNIT_ASSERT
(!
strcmp
(
names
[0],
array
[0]));
38
CPPUNIT_ASSERT
(!
strcmp
(
names
[1],
array
[1]));
39
CPPUNIT_ASSERT
(!
strcmp
(
names
[2],
array
[2]));
40
41
copy
(
array
,
array
+ 3, bit);
42
CPPUNIT_ASSERT
(!
strcmp
(
names
[3],
array
[0]));
43
CPPUNIT_ASSERT
(!
strcmp
(
names
[4],
array
[1]));
44
CPPUNIT_ASSERT
(!
strcmp
(
names
[5],
array
[2]));
45
}
46
void
BinsertTest::binsert2
()
47
{
48
const
char
*
array
[] = {
"laurie"
,
"jennifer"
,
"leisa"
};
49
vector<const char*>
names
;
50
copy
(
array
,
array
+ 3,
back_inserter
(
names
));
51
CPPUNIT_ASSERT
(!
strcmp
(
names
[0],
array
[0]));
52
CPPUNIT_ASSERT
(!
strcmp
(
names
[1],
array
[1]));
53
CPPUNIT_ASSERT
(!
strcmp
(
names
[2],
array
[2]));
54
}
BinsertTest
Definition:
binsert_test.cpp:13
CPPUNIT_TEST_SUITE_REGISTRATION
CPPUNIT_TEST_SUITE_REGISTRATION(BinsertTest)
CPPUNIT_TEST_SUITE
#define CPPUNIT_TEST_SUITE(X)
Definition:
cppunit_mini.h:142
CPPUNIT_TEST
#define CPPUNIT_TEST(X)
Definition:
cppunit_mini.h:182
BinsertTest::binsert2
void binsert2()
Definition:
binsert_test.cpp:46
std
Definition:
features.h:417
cppunit_proxy.h
names
GLuint GLuint * names
Definition:
glext.h:11545
back_inserter
back_insert_iterator< _Container > _STLP_CALL back_inserter(_Container &__x)
Definition:
_iterator.h:187
CPPUNIT_TEST_SUITE_END
#define CPPUNIT_TEST_SUITE_END()
Definition:
cppunit_mini.h:191
back_insert_iterator
Definition:
_iterator.h:161
array
Definition:
wbemprox_private.h:129
CPPUNIT_ASSERT
#define CPPUNIT_ASSERT(X)
Definition:
cppunit_mini.h:200
copy
INT copy(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch)
Definition:
copy.c:51
BinsertTest::binsert1
void binsert1()
Definition:
binsert_test.cpp:30
strcmp
int strcmp(const char *String1, const char *String2)
Definition:
utclib.c:469
sdk
lib
3rdparty
stlport
test
unit
binsert_test.cpp
Generated on Mon Jan 18 2021 06:23:18 for ReactOS by
1.8.15