ReactOS  0.4.15-dev-1039-gb9754fa
test_deque.cpp File Reference
#include "Tests.h"
#include <cstdio>
#include <deque>
#include "TestClass.h"
#include "LeakCheck.h"
#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_deque.cpp:

Go to the source code of this file.

Typedefs

typedef TestClass DQTestClass
 
typedef EH_STD::deque< DQTestClass, eh_allocator(DQTestClass) > TestDeque
 

Functions

sequence_container_tag container_category (const TestDeque &)
 
void test_deque ()
 

Typedef Documentation

◆ DQTestClass

Definition at line 37 of file test_deque.cpp.

◆ TestDeque

typedef EH_STD::deque<DQTestClass, eh_allocator(DQTestClass) > TestDeque

Definition at line 39 of file test_deque.cpp.

Function Documentation

◆ container_category()

sequence_container_tag container_category ( const TestDeque )
inline

Definition at line 42 of file test_deque.cpp.

43 {
44  return sequence_container_tag();
45 }

◆ test_deque()

void test_deque ( )

Definition at line 47 of file test_deque.cpp.

48 {
49  size_t dequeSize = random_number(random_base);
50  TestDeque emptyDeque;
51  TestDeque testDeque, testDeque2;
52  while ( testDeque.size() < dequeSize )
53  {
54  DQTestClass x;
55  testDeque.push_back( x );
56  testDeque2.push_back( DQTestClass() );
57  }
58 
60  WeakCheck( testDeque, test_insert_one<TestDeque>(testDeque) );
61  StrongCheck( testDeque, test_insert_one<TestDeque>(testDeque, 0) );
62  StrongCheck( testDeque, test_insert_one<TestDeque>(testDeque, (int)testDeque.size()) );
63 
64  WeakCheck( testDeque, test_insert_n<TestDeque>(testDeque, random_number(random_base) ) );
65  StrongCheck( testDeque, test_insert_n<TestDeque>(testDeque, random_number(random_base), 0 ) );
66  StrongCheck( testDeque, test_insert_n<TestDeque>(testDeque, random_number(random_base), (int)testDeque.size() ) );
67 
68  size_t insCnt = random_number(random_base);
69  DQTestClass *insFirst = new TestDeque::value_type[insCnt + 1];
70 
71  WeakCheck( testDeque, insert_range_tester(testDeque, insFirst, insFirst + insCnt) );
72  StrongCheck( testDeque, insert_range_at_begin_tester(testDeque, insFirst, insFirst + insCnt) );
73  StrongCheck( testDeque, insert_range_at_end_tester(testDeque, insFirst, insFirst + insCnt) );
74 
75  ConstCheck( 0, test_construct_pointer_range<TestDeque>(insFirst, insFirst + insCnt) );
76  delete[] insFirst;
77 
78  WeakCheck( testDeque, insert_range_tester(testDeque, testDeque2.begin(), testDeque2.end() ) );
79 
80  StrongCheck( testDeque, test_push_back<TestDeque>(testDeque) );
81  StrongCheck( emptyDeque, test_push_back<TestDeque>(emptyDeque) );
82  StrongCheck( testDeque, test_push_front<TestDeque>(testDeque) );
83  StrongCheck( emptyDeque, test_push_front<TestDeque>(emptyDeque) );
84 
85 
90 
91  testDeque2.resize( testDeque.size() * 3 / 2 );
92  WeakCheck( testDeque, test_assign_op<TestDeque>( testDeque2 ) );
93  testDeque2.resize( testDeque.size() * 2 / 3 );
94  WeakCheck( testDeque, test_assign_op<TestDeque>( testDeque2 ) );
95 }
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
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)
EH_STD::deque< DQTestClass, eh_allocator(DQTestClass) > TestDeque
Definition: test_deque.cpp:39
void StrongCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:145
TestClass DQTestClass
Definition: test_deque.cpp:37

Referenced by main().