@@ -25,68 +25,61 @@ class prevector_tester {
25
25
pretype pre_vector_alt;
26
26
27
27
typedef typename pretype::size_type Size;
28
- bool passed = true ;
29
28
30
- template <typename A, typename B>
31
- void local_check_equal (A a, B b)
32
- {
33
- local_check (a == b);
34
- }
35
-
36
- void local_check (bool b)
37
- {
38
- passed &= b;
39
- }
40
29
void test () {
41
30
const pretype& const_pre_vector = pre_vector;
42
- local_check_equal (real_vector.size (), pre_vector.size ());
43
- local_check_equal (real_vector.empty (), pre_vector.empty ());
31
+ assert (real_vector.size () == pre_vector.size ());
32
+ assert (real_vector.empty () == pre_vector.empty ());
44
33
for (Size s = 0 ; s < real_vector.size (); s++) {
45
- local_check (real_vector[s] == pre_vector[s]);
46
- local_check (&(pre_vector[s]) == &(pre_vector.begin ()[s]));
47
- local_check (&(pre_vector[s]) == &*(pre_vector.begin () + s));
48
- local_check (&(pre_vector[s]) == &*((pre_vector.end () + s) - real_vector.size ()));
34
+ assert (real_vector[s] == pre_vector[s]);
35
+ assert (&(pre_vector[s]) == &(pre_vector.begin ()[s]));
36
+ assert (&(pre_vector[s]) == &*(pre_vector.begin () + s));
37
+ assert (&(pre_vector[s]) == &*((pre_vector.end () + s) - real_vector.size ()));
49
38
}
50
- // local_check (realtype(pre_vector) == real_vector);
51
- local_check (pretype (real_vector.begin (), real_vector.end ()) == pre_vector);
52
- local_check (pretype (pre_vector.begin (), pre_vector.end ()) == pre_vector);
39
+ // assert (realtype(pre_vector) == real_vector);
40
+ assert (pretype (real_vector.begin (), real_vector.end ()) == pre_vector);
41
+ assert (pretype (pre_vector.begin (), pre_vector.end ()) == pre_vector);
53
42
size_t pos = 0 ;
54
43
for (const T& v : pre_vector) {
55
- local_check (v == real_vector[pos++]);
44
+ assert (v == real_vector[pos]);
45
+ ++pos;
56
46
}
57
47
for (const T& v : reverse_iterate (pre_vector)) {
58
- local_check (v == real_vector[--pos]);
48
+ --pos;
49
+ assert (v == real_vector[pos]);
59
50
}
60
51
for (const T& v : const_pre_vector) {
61
- local_check (v == real_vector[pos++]);
52
+ assert (v == real_vector[pos]);
53
+ ++pos;
62
54
}
63
55
for (const T& v : reverse_iterate (const_pre_vector)) {
64
- local_check (v == real_vector[--pos]);
56
+ --pos;
57
+ assert (v == real_vector[pos]);
65
58
}
66
59
CDataStream ss1 (SER_DISK, 0 );
67
60
CDataStream ss2 (SER_DISK, 0 );
68
61
ss1 << real_vector;
69
62
ss2 << pre_vector;
70
- local_check_equal (ss1.size (), ss2.size ());
63
+ assert (ss1.size () == ss2.size ());
71
64
for (Size s = 0 ; s < ss1.size (); s++) {
72
- local_check_equal (ss1[s], ss2[s]);
65
+ assert (ss1[s] == ss2[s]);
73
66
}
74
67
}
75
68
76
69
public:
77
70
void resize (Size s) {
78
71
real_vector.resize (s);
79
- local_check_equal (real_vector.size (), s);
72
+ assert (real_vector.size () == s);
80
73
pre_vector.resize (s);
81
- local_check_equal (pre_vector.size (), s);
74
+ assert (pre_vector.size () == s);
82
75
test ();
83
76
}
84
77
85
78
void reserve (Size s) {
86
79
real_vector.reserve (s);
87
- local_check (real_vector.capacity () >= s);
80
+ assert (real_vector.capacity () >= s);
88
81
pre_vector.reserve (s);
89
- local_check (pre_vector.capacity () >= s);
82
+ assert (pre_vector.capacity () >= s);
90
83
test ();
91
84
}
92
85
@@ -199,10 +192,6 @@ class prevector_tester {
199
192
}
200
193
test ();
201
194
}
202
-
203
- ~prevector_tester () {
204
- assert (passed);
205
- }
206
195
};
207
196
208
197
}
0 commit comments