ReactOS 0.4.16-dev-340-g0540c21
mvctor_test.h
Go to the documentation of this file.
1#include <cstdio> //size_t and STLport macros
2
4
5//
6// TestCase class
7//
8class MoveConstructorTest : public CPPUNIT_NS::TestCase
9{
15#if !defined (STLPORT) || defined (_STLP_NO_MOVE_SEMANTIC) || \
16 defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) || \
17 (defined (__BORLANDC__) && (__BORLANDC__ < 0x564))
19# endif
23#if defined (__BORLANDC__)
26#endif
28
29protected:
31 void deque_test();
32 void vector_test();
33 void move_traits();
38
39 /*
40 template <class _Container>
41 void standard_test1(_Container const& ref_cont) {
42 vector<_Container> vec_cont(1, ref_cont);
43 typedef typename _Container::value_type value_type;
44 value_type *pvalue = &(*vec_cont.front().begin());
45 size_t cur_capacity= vec_cont.capacity();
46 //force reallocation
47 while (cur_capacity == vec_cont.capacity()) {
48 vec_cont.push_back(ref_cont);
49 }
50 bool b=( (pvalue==(&(*vec_cont.front().begin()))) );
51 CPPUNIT_ASSERT(b);
52 }
53 */
54
55private:
56 void move_traits_vec();
58 void move_traits_deq();
60};
61
65#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
66# if defined (_STLP_USE_NAMESPACES)
67 MovableStruct(std::__move_source<MovableStruct>)
68# else
70# endif
72#endif
74
77 return *this;
78 }
79
80 static void reset() {
84 }
85
86 static size_t nb_dft_construct_call;
87 static size_t nb_cpy_construct_call;
88 static size_t nb_mv_construct_call;
89 static size_t nb_assignment_call;
90 static size_t nb_destruct_call;
91
92 //Dummy data just to control struct sizeof
93 //As node allocator implementation align memory blocks on 2 * sizeof(void*)
94 //we give MovableStruct the same size in order to have expected allocation
95 //and not more
96 void* dummy_data[2];
97};
CPPUNIT_TEST(move_construct_test)
CPPUNIT_TEST(deque_test)
CPPUNIT_TEST(vector_test)
CPPUNIT_TEST_SUITE(MoveConstructorTest)
CPPUNIT_TEST(move_traits)
#define CPPUNIT_STOP_IGNORE
Definition: cppunit_mini.h:188
#define CPPUNIT_TEST(X)
Definition: cppunit_mini.h:182
static void reset()
Definition: mvctor_test.h:80
MovableStruct & operator=(const MovableStruct &)
Definition: mvctor_test.h:75
void * dummy_data[2]
Definition: mvctor_test.h:96
static size_t nb_dft_construct_call
Definition: mvctor_test.h:86
MovableStruct(MovableStruct const &)
Definition: mvctor_test.h:64
static size_t nb_mv_construct_call
Definition: mvctor_test.h:88
static size_t nb_cpy_construct_call
Definition: mvctor_test.h:87
static size_t nb_destruct_call
Definition: mvctor_test.h:90
static size_t nb_assignment_call
Definition: mvctor_test.h:89