ReactOS
0.4.16-dev-340-g0540c21
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
}
back_inserter
back_insert_iterator< _Container > _STLP_CALL back_inserter(_Container &__x)
Definition:
_iterator.h:187
strcmp
int strcmp(const char *String1, const char *String2)
Definition:
utclib.c:469
copy
INT copy(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch)
Definition:
copy.c:51
BinsertTest
Definition:
binsert_test.cpp:14
BinsertTest::CPPUNIT_TEST_SUITE
CPPUNIT_TEST_SUITE(BinsertTest)
BinsertTest::binsert1
void binsert1()
Definition:
binsert_test.cpp:30
BinsertTest::CPPUNIT_TEST_SUITE_END
CPPUNIT_TEST_SUITE_END()
BinsertTest::CPPUNIT_TEST
CPPUNIT_TEST(binsert1)
BinsertTest::binsert2
void binsert2()
Definition:
binsert_test.cpp:46
BinsertTest::CPPUNIT_TEST
CPPUNIT_TEST(binsert2)
back_insert_iterator
Definition:
_iterator.h:162
CPPUNIT_TEST_SUITE_REGISTRATION
#define CPPUNIT_TEST_SUITE_REGISTRATION(X)
Definition:
cppunit_mini.h:193
CPPUNIT_ASSERT
#define CPPUNIT_ASSERT(X)
Definition:
cppunit_mini.h:200
cppunit_proxy.h
names
GLuint GLuint * names
Definition:
glext.h:11545
std
Definition:
features.h:417
array
Definition:
wbemprox_private.h:130
sdk
lib
3rdparty
stlport
test
unit
binsert_test.cpp
Generated on Sat Dec 14 2024 06:13:03 for ReactOS by
1.9.6