ReactOS  0.4.15-dev-1039-gb9754fa
test_slist.cpp File Reference
#include "Tests.h"
#include "TestClass.h"
#include "LeakCheck.h"
#include <slist>
#include "test_construct.h"
#include "test_assign_op.h"
#include "test_push_back.h"
#include "test_insert.h"
#include "test_push_front.h"
Include dependency graph for test_slist.cpp:

Go to the source code of this file.

Classes

struct  test_slist_sort
 

Typedefs

typedef EH_STD::__slist__< TestClass, eh_allocator(TestClass) > TestSList
 

Functions

sequence_container_tag container_category (const TestSList &)
 
void test_slist ()
 

Typedef Documentation

◆ TestSList

Definition at line 34 of file test_slist.cpp.

Function Documentation

◆ container_category()

sequence_container_tag container_category ( const TestSList )
inline

Definition at line 38 of file test_slist.cpp.

38  {
39  return sequence_container_tag();
40 }

◆ test_slist()

void test_slist ( void  )

Definition at line 55 of file test_slist.cpp.

55  {
56  TestSList testSList, testSList2;
57  size_t slistSize = random_number(random_base);
58 
59  while (testSList.size() < slistSize) {
60  TestClass x;
61  testSList.push_front( x );
62  testSList2.push_front( TestClass() );
63  }
64 
65  StrongCheck( testSList, test_insert_one<TestSList>(testSList) );
66  StrongCheck( testSList, test_insert_one<TestSList>(testSList, 0) );
67  StrongCheck( testSList, test_insert_one<TestSList>(testSList, (int)testSList.size()) );
68 
69  WeakCheck( testSList, test_insert_n<TestSList>(testSList, random_number(random_base) ) );
70  WeakCheck( testSList, test_insert_n<TestSList>(testSList, random_number(random_base), 0 ) );
71  WeakCheck( testSList, test_insert_n<TestSList>(testSList, random_number(random_base), (int)testSList.size() ) );
72 
73  size_t insCnt = random_number(random_base);
74  TestClass *insFirst = new TestSList::value_type[1+insCnt];
75  WeakCheck( testSList, insert_range_tester(testSList, insFirst, insFirst+insCnt) );
76 
77  ConstCheck( 0, test_construct_pointer_range<TestSList>(insFirst, insFirst+insCnt) );
78  delete[] insFirst;
79  WeakCheck( testSList, test_insert_range<TestSList,TestSList::iterator>(testSList, testSList2.begin(), testSList2.end() ) );
80  StrongCheck( testSList, test_push_front<TestSList>(testSList) );
81  StrongCheck( testSList, test_slist_sort() ); // Simply to verify strength.
82 
88  WeakCheck( testSList, test_assign_op<TestSList>( testSList2 ) );
89 }
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
void ConstCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:103
unsigned random_base
unsigned random_number(size_t range)
void StrongCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:145
EH_STD::__slist__< TestClass, eh_allocator(TestClass) > TestSList
Definition: test_slist.cpp:34