ReactOS  0.4.14-dev-384-g5b37caa
test_list.cpp File Reference
#include "Tests.h"
#include "TestClass.h"
#include "LeakCheck.h"
#include <list>
#include "test_construct.h"
#include "test_assign_op.h"
#include "test_push_back.h"
#include "test_insert.h"
#include "test_push_front.h"
#include "nc_alloc.h"
Include dependency graph for test_list.cpp:

Go to the source code of this file.

Classes

struct  test_list_sort
 

Typedefs

typedef EH_STD::__list__< TestClass, eh_allocator(TestClass) > TestList
 

Functions

sequence_container_tag container_category (const TestList &)
 
void test_list ()
 

Typedef Documentation

◆ TestList

Definition at line 31 of file test_list.cpp.

Function Documentation

◆ container_category()

sequence_container_tag container_category ( const TestList )
inline

Definition at line 34 of file test_list.cpp.

35 {
36  return sequence_container_tag();
37 }

◆ test_list()

Definition at line 64 of file test_list.cpp.

65 {
66  TestList testList, testList2;
67  size_t listSize = random_number(random_base);
68 
69  while ( testList.size() < listSize )
70  {
71  TestClass x;
72  testList.push_back( x );
73  testList2.push_back( TestClass() );
74  }
75 
76  StrongCheck( testList, test_insert_one<TestList>(testList) );
77  StrongCheck( testList, test_insert_one<TestList>(testList, 0) );
78  StrongCheck( testList, test_insert_one<TestList>(testList, (int)testList.size()) );
79 
81  WeakCheck( testList, test_insert_n<TestList>(testList, random_number(random_base), 0 ) );
82  WeakCheck( testList, test_insert_n<TestList>(testList, random_number(random_base), (int)testList.size() ) );
83 
84  size_t insCnt = random_number(random_base);
85  TestClass *insFirst = new TestList::value_type[1+insCnt];
86 
87  WeakCheck( testList, insert_range_tester(testList, insFirst, insFirst+insCnt) );
88  WeakCheck( testList, insert_range_at_begin_tester(testList, insFirst, insFirst+insCnt) );
89  WeakCheck( testList, insert_range_at_end_tester(testList, insFirst, insFirst+insCnt) );
90 
91  ConstCheck( 0, test_construct_pointer_range<TestList>(insFirst, insFirst+insCnt) );
92  delete[] insFirst;
93 
94  WeakCheck( testList, insert_range_tester(testList, testList2.begin(), testList2.end() ) );
95 
96  StrongCheck( testList, test_push_front<TestList>(testList) );
97  StrongCheck( testList, test_push_back<TestList>(testList) );
98 
99  StrongCheck( testList, test_list_sort() ); // Simply to verify strength.
100 
106 
107  WeakCheck( testList, test_assign_op<TestList>( testList2 ) );
108 }
void WeakCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:65
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
test_insert_range< C, Iter > insert_range_tester(const C &orig, const Iter &first, const Iter &last)
Definition: test_insert.h:535
test_insert_range< C, Iter > insert_range_at_end_tester(const C &orig, const Iter &first, const Iter &last)
Definition: test_insert.h:547
EH_STD::__list__< TestClass, eh_allocator(TestClass) > TestList
Definition: test_list.cpp:31
void ConstCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:103
unsigned random_base
test_insert_range< C, Iter > insert_range_at_begin_tester(const C &orig, const Iter &first, const Iter &last)
Definition: test_insert.h:541
unsigned random_number(size_t range)
void StrongCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:145

Referenced by main().