line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#include "test.h" |
2
|
|
|
|
|
|
|
#include |
3
|
|
|
|
|
|
|
#include |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
using panda::owning_list; |
6
|
|
|
|
|
|
|
using test::Tracer; |
7
|
|
|
|
|
|
|
|
8
|
19
|
|
|
|
|
|
TEST_CASE("empty owning_list" , "[owning_list]") { |
9
|
2
|
50
|
|
|
|
|
owning_list list; |
10
|
1
|
50
|
|
|
|
|
REQUIRE(list.size() == 0); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
11
|
1
|
50
|
|
|
|
|
for (auto iter = list.begin(); iter != list.end(); ++iter) { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
12
|
0
|
0
|
|
|
|
|
FAIL("list must be empty"); |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
13
|
|
|
|
|
|
|
} |
14
|
1
|
50
|
|
|
|
|
REQUIRE(true); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
15
|
1
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
19
|
|
|
|
|
|
TEST_CASE("simple owning_list" , "[owning_list]") { |
18
|
2
|
50
|
|
|
|
|
owning_list list; |
19
|
1
|
50
|
|
|
|
|
list.push_back(10); |
20
|
1
|
50
|
|
|
|
|
REQUIRE(list.size() == 1); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
21
|
2
|
50
|
|
|
|
|
auto iter = list.begin(); |
22
|
1
|
50
|
|
|
|
|
for (; iter != list.end(); ++iter) { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
23
|
1
|
50
|
|
|
|
|
REQUIRE(*iter == 10); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
24
|
1
|
|
|
|
|
|
break; |
25
|
|
|
|
|
|
|
} |
26
|
1
|
50
|
|
|
|
|
REQUIRE(++iter == list.end()); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
27
|
1
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
19
|
|
|
|
|
|
TEST_CASE("2 elements owning_list" , "[owning_list]") { |
30
|
2
|
50
|
|
|
|
|
owning_list list; |
31
|
1
|
50
|
|
|
|
|
list.push_back(0); |
32
|
1
|
50
|
|
|
|
|
list.push_back(1); |
33
|
1
|
50
|
|
|
|
|
REQUIRE(list.size() == 2); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
34
|
2
|
50
|
|
|
|
|
auto iter = list.begin(); |
35
|
1
|
|
|
|
|
|
size_t i = 0; |
36
|
3
|
50
|
|
|
|
|
for (; iter != list.end(); ++iter) { |
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
37
|
2
|
50
|
|
|
|
|
REQUIRE(*iter == i); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
38
|
2
|
|
|
|
|
|
++i; |
39
|
|
|
|
|
|
|
} |
40
|
1
|
50
|
|
|
|
|
REQUIRE(iter == list.end()); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
41
|
1
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
19
|
|
|
|
|
|
TEST_CASE("owning_list::remove 0" , "[owning_list]") { |
44
|
2
|
50
|
|
|
|
|
owning_list list; |
45
|
1
|
50
|
|
|
|
|
list.push_back(10); |
46
|
1
|
50
|
|
|
|
|
list.remove(10); |
47
|
1
|
50
|
|
|
|
|
for (auto iter = list.begin(); iter != list.end(); ++iter) { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
48
|
0
|
0
|
|
|
|
|
FAIL("list must be empty"); |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
49
|
|
|
|
|
|
|
} |
50
|
1
|
50
|
|
|
|
|
REQUIRE(list.size() == 0); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
51
|
1
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
19
|
|
|
|
|
|
TEST_CASE("owning_list::remove 1" , "[owning_list]") { |
55
|
2
|
50
|
|
|
|
|
owning_list list; |
56
|
1
|
50
|
|
|
|
|
list.push_back(0); |
57
|
1
|
50
|
|
|
|
|
list.push_back(2); |
58
|
1
|
50
|
|
|
|
|
list.remove(2); |
59
|
1
|
50
|
|
|
|
|
list.push_back(1); |
60
|
1
|
|
|
|
|
|
size_t i = 0; |
61
|
3
|
50
|
|
|
|
|
for (auto iter = list.begin(); iter != list.end(); ++iter) { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
62
|
2
|
50
|
|
|
|
|
REQUIRE(*iter == i++); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
63
|
|
|
|
|
|
|
} |
64
|
1
|
50
|
|
|
|
|
REQUIRE(list.size() == 2); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
65
|
1
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
19
|
|
|
|
|
|
TEST_CASE("owning_list::remove in iteration" , "[owning_list]") { |
68
|
2
|
50
|
|
|
|
|
owning_list list; |
69
|
1
|
50
|
|
|
|
|
list.push_back(0); |
70
|
1
|
50
|
|
|
|
|
list.push_back(2); |
71
|
1
|
50
|
|
|
|
|
list.push_back(1); |
72
|
3
|
50
|
|
|
|
|
for (auto iter = list.begin(); iter != list.end(); ++iter) { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
73
|
2
|
50
|
|
|
|
|
list.remove(2); |
74
|
|
|
|
|
|
|
} |
75
|
1
|
|
|
|
|
|
size_t i = 0; |
76
|
3
|
50
|
|
|
|
|
for (auto iter = list.begin(); iter != list.end(); ++iter) { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
77
|
2
|
50
|
|
|
|
|
REQUIRE(*iter == i++); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
1
|
50
|
|
|
|
|
REQUIRE(list.size() == 2); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
81
|
1
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
19
|
|
|
|
|
|
TEST_CASE("owning_list::remove in iteration 2" , "[owning_list]") { |
84
|
2
|
50
|
|
|
|
|
owning_list list; |
85
|
1
|
50
|
|
|
|
|
list.push_back(0); |
86
|
1
|
50
|
|
|
|
|
list.push_back(1); |
87
|
1
|
50
|
|
|
|
|
list.push_back(2); |
88
|
2
|
50
|
|
|
|
|
auto iter = list.begin(); |
89
|
1
|
50
|
|
|
|
|
list.remove(1); |
90
|
1
|
50
|
|
|
|
|
list.remove(2); |
91
|
1
|
50
|
|
|
|
|
++iter; |
92
|
1
|
50
|
|
|
|
|
REQUIRE(iter == list.end()); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
93
|
1
|
50
|
|
|
|
|
REQUIRE(list.size() == 1); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
94
|
1
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
19
|
|
|
|
|
|
TEST_CASE("owning_list::remove in iteration reverse" , "[owning_list]") { |
97
|
2
|
50
|
|
|
|
|
owning_list list; |
98
|
1
|
50
|
|
|
|
|
list.push_back(0); |
99
|
1
|
50
|
|
|
|
|
list.push_back(1); |
100
|
1
|
50
|
|
|
|
|
list.push_back(2); |
101
|
2
|
50
|
|
|
|
|
auto iter = list.rbegin(); |
102
|
1
|
50
|
|
|
|
|
list.remove(1); |
103
|
1
|
50
|
|
|
|
|
list.remove(2); |
104
|
1
|
50
|
|
|
|
|
REQUIRE(*iter == 2); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
105
|
|
|
|
|
|
|
//++iter is invalid |
106
|
1
|
50
|
|
|
|
|
REQUIRE(list.size() == 1); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
107
|
1
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
19
|
|
|
|
|
|
TEST_CASE("owning_list::remove in iteration reverse ++" , "[owning_list]") { |
110
|
2
|
50
|
|
|
|
|
owning_list list; |
111
|
1
|
50
|
|
|
|
|
list.push_back(0); |
112
|
1
|
50
|
|
|
|
|
list.push_back(1); |
113
|
1
|
50
|
|
|
|
|
list.push_back(2); |
114
|
2
|
50
|
|
|
|
|
auto iter = list.rbegin(); |
115
|
1
|
50
|
|
|
|
|
list.remove(2); |
116
|
1
|
50
|
|
|
|
|
REQUIRE(*iter++ == 2); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
117
|
1
|
50
|
|
|
|
|
REQUIRE(*iter++ == 1); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
118
|
1
|
50
|
|
|
|
|
REQUIRE(*iter++ == 0); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
119
|
|
|
|
|
|
|
//++iter is invalid |
120
|
1
|
50
|
|
|
|
|
REQUIRE(list.size() == 2); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
121
|
1
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
19
|
|
|
|
|
|
TEST_CASE("owning_list::erase in iteration reverse ++" , "[owning_list]") { |
124
|
2
|
50
|
|
|
|
|
owning_list list; |
125
|
1
|
50
|
|
|
|
|
list.push_back(0); |
126
|
1
|
50
|
|
|
|
|
list.push_back(1); |
127
|
1
|
50
|
|
|
|
|
list.push_back(2); |
128
|
2
|
50
|
|
|
|
|
auto iter = list.rbegin(); |
129
|
1
|
50
|
|
|
|
|
list.erase(iter); |
|
|
50
|
|
|
|
|
|
130
|
1
|
50
|
|
|
|
|
REQUIRE(*iter++ == 2); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
131
|
1
|
50
|
|
|
|
|
REQUIRE(*iter++ == 1); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
132
|
1
|
50
|
|
|
|
|
REQUIRE(*iter++ == 0); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
133
|
|
|
|
|
|
|
//++iter is invalid |
134
|
1
|
50
|
|
|
|
|
REQUIRE(list.size() == 2); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
135
|
1
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
19
|
|
|
|
|
|
TEST_CASE("owning_list::clear Tracer" , "[owning_list]") { |
138
|
1
|
|
|
|
|
|
Tracer::refresh(); |
139
|
2
|
50
|
|
|
|
|
owning_list list; |
140
|
1
|
50
|
|
|
|
|
list.push_back(Tracer(0)); |
141
|
1
|
50
|
|
|
|
|
list.push_back(Tracer(1)); |
142
|
1
|
50
|
|
|
|
|
list.push_back(Tracer(2)); |
143
|
1
|
50
|
|
|
|
|
list.clear(); |
144
|
1
|
50
|
|
|
|
|
REQUIRE(Tracer::ctor_total() == Tracer::dtor_calls); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
//++iter is invalid |
147
|
1
|
50
|
|
|
|
|
REQUIRE(list.size() == 0); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
148
|
1
|
|
|
|
|
|
} |
149
|
|
|
|
|
|
|
|
150
|
19
|
|
|
|
|
|
TEST_CASE("owning_list::remove Tracer" , "[owning_list]") { |
151
|
1
|
|
|
|
|
|
Tracer::refresh(); |
152
|
2
|
50
|
|
|
|
|
owning_list list; |
153
|
1
|
50
|
|
|
|
|
list.push_back(Tracer(0)); |
154
|
1
|
50
|
|
|
|
|
list.push_back(Tracer(1)); |
155
|
1
|
50
|
|
|
|
|
list.push_back(Tracer(2)); |
156
|
1
|
50
|
|
|
|
|
list.remove(Tracer(0)); |
157
|
1
|
50
|
|
|
|
|
list.remove(Tracer(2)); |
158
|
1
|
50
|
|
|
|
|
REQUIRE(Tracer::ctor_total() == Tracer::dtor_calls + 1); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
//++iter is invalid |
161
|
1
|
50
|
|
|
|
|
REQUIRE(list.size() == 1); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
162
|
73
|
50
|
|
|
|
|
} |
|
|
50
|
|
|
|
|
|