line |
true |
false |
branch |
18
|
1 |
0 |
Dispatcher d; |
19
|
1 |
0 |
d(1); |
20
|
1 |
0 |
REQUIRE(true); |
|
1 |
0 |
REQUIRE(true); |
|
1 |
0 |
REQUIRE(true); |
|
1 |
0 |
REQUIRE(true); |
|
0 |
0 |
REQUIRE(true); |
|
0 |
0 |
REQUIRE(true); |
24
|
1 |
0 |
CallbackDispatcher d; |
26
|
1 |
0 |
CallbackDispatcher::SimpleCallback f = [&](){called = true;}; |
27
|
1 |
0 |
d.add(f); |
28
|
1 |
0 |
d(); |
29
|
1 |
0 |
REQUIRE(called); |
|
1 |
0 |
REQUIRE(called); |
|
1 |
0 |
REQUIRE(called); |
|
1 |
0 |
REQUIRE(called); |
|
0 |
0 |
REQUIRE(called); |
|
0 |
0 |
REQUIRE(called); |
34
|
1 |
0 |
Dispatcher d; |
36
|
1 |
0 |
return 1 + e.next(a).value_or(0); |
37
|
1 |
0 |
}; |
38
|
1 |
0 |
d.add_event_listener(cb); |
39
|
1 |
0 |
d.add_event_listener([](Event& e, int a) -> int { |
40
|
1 |
0 |
return a + e.next(a).value_or(0); |
41
|
1 |
0 |
}); |
42
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 3); |
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 3); |
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 3); |
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 3); |
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 3); |
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 3); |
|
0 |
0 |
REQUIRE(d(2).value_or(0) == 3); |
|
0 |
0 |
REQUIRE(d(2).value_or(0) == 3); |
46
|
1 |
0 |
Dispatcher d; |
47
|
1 |
0 |
d.add_event_listener([](Event& e, int a) -> int { |
48
|
2 |
0 |
return 1 + e.next(a).value_or(0); |
49
|
1 |
0 |
}); |
51
|
1 |
0 |
return a + e.next(a).value_or(0); |
52
|
1 |
0 |
}; |
53
|
1 |
0 |
d.add_event_listener(c); |
54
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 3); |
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 3); |
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 3); |
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 3); |
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 3); |
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 3); |
|
0 |
0 |
REQUIRE(d(2).value_or(0) == 3); |
|
0 |
0 |
REQUIRE(d(2).value_or(0) == 3); |
55
|
1 |
0 |
d.remove(c); |
56
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 1); |
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 1); |
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 1); |
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 1); |
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 1); |
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 1); |
|
0 |
0 |
REQUIRE(d(2).value_or(0) == 1); |
|
0 |
0 |
REQUIRE(d(2).value_or(0) == 1); |
60
|
1 |
0 |
Dispatcher d; |
61
|
1 |
0 |
d.add_event_listener([](Event&, int) -> int { |
63
|
1 |
0 |
}); |
64
|
1 |
0 |
d.add_event_listener([&](Event& e, int a) -> int { |
66
|
1 |
0 |
return 1 + e.next(a).value_or(0); |
67
|
1 |
0 |
}); |
68
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 1); |
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 1); |
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 1); |
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 1); |
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 1); |
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 1); |
|
0 |
0 |
REQUIRE(d(2).value_or(0) == 1); |
|
0 |
0 |
REQUIRE(d(2).value_or(0) == 1); |
72
|
1 |
0 |
Dispatcher d; |
75
|
1 |
0 |
Dispatcher::Callback cb = Tracer(14); |
76
|
1 |
0 |
d.add_event_listener(cb); |
77
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 16); |
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 16); |
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 16); |
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 16); |
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 16); |
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 16); |
|
0 |
0 |
REQUIRE(d(2).value_or(0) == 16); |
|
0 |
0 |
REQUIRE(d(2).value_or(0) == 16); |
78
|
1 |
0 |
d.remove(cb); |
79
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 0); |
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 0); |
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 0); |
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 0); |
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 0); |
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 0); |
|
0 |
0 |
REQUIRE(d(2).value_or(0) == 0); |
|
0 |
0 |
REQUIRE(d(2).value_or(0) == 0); |
81
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 0); |
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 0); |
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 0); |
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 0); |
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 0); |
|
1 |
0 |
REQUIRE(d(2).value_or(0) == 0); |
|
0 |
0 |
REQUIRE(d(2).value_or(0) == 0); |
|
0 |
0 |
REQUIRE(d(2).value_or(0) == 0); |
83
|
1 |
0 |
REQUIRE(Tracer::ctor_calls == 1); // 1 for temporary object Tracer(10); |
|
1 |
0 |
REQUIRE(Tracer::ctor_calls == 1); // 1 for temporary object Tracer(10); |
|
1 |
0 |
REQUIRE(Tracer::ctor_calls == 1); // 1 for temporary object Tracer(10); |
|
1 |
0 |
REQUIRE(Tracer::ctor_calls == 1); // 1 for temporary object Tracer(10); |
|
1 |
0 |
REQUIRE(Tracer::ctor_calls == 1); // 1 for temporary object Tracer(10); |
|
0 |
0 |
REQUIRE(Tracer::ctor_calls == 1); // 1 for temporary object Tracer(10); |
|
0 |
0 |
REQUIRE(Tracer::ctor_calls == 1); // 1 for temporary object Tracer(10); |
84
|
1 |
0 |
REQUIRE(Tracer::copy_calls == 0); |
|
1 |
0 |
REQUIRE(Tracer::copy_calls == 0); |
|
1 |
0 |
REQUIRE(Tracer::copy_calls == 0); |
|
1 |
0 |
REQUIRE(Tracer::copy_calls == 0); |
|
1 |
0 |
REQUIRE(Tracer::copy_calls == 0); |
|
0 |
0 |
REQUIRE(Tracer::copy_calls == 0); |
|
0 |
0 |
REQUIRE(Tracer::copy_calls == 0); |
85
|
1 |
0 |
REQUIRE(Tracer::move_calls == 1); // 1 construction from tmp object function f = Tracer(10); |
|
1 |
0 |
REQUIRE(Tracer::move_calls == 1); // 1 construction from tmp object function f = Tracer(10); |
|
1 |
0 |
REQUIRE(Tracer::move_calls == 1); // 1 construction from tmp object function f = Tracer(10); |
|
1 |
0 |
REQUIRE(Tracer::move_calls == 1); // 1 construction from tmp object function f = Tracer(10); |
|
1 |
0 |
REQUIRE(Tracer::move_calls == 1); // 1 construction from tmp object function f = Tracer(10); |
|
0 |
0 |
REQUIRE(Tracer::move_calls == 1); // 1 construction from tmp object function f = Tracer(10); |
|
0 |
0 |
REQUIRE(Tracer::move_calls == 1); // 1 construction from tmp object function f = Tracer(10); |
86
|
1 |
0 |
REQUIRE(Tracer::dtor_calls == 2); |
|
1 |
0 |
REQUIRE(Tracer::dtor_calls == 2); |
|
1 |
0 |
REQUIRE(Tracer::dtor_calls == 2); |
|
1 |
0 |
REQUIRE(Tracer::dtor_calls == 2); |
|
1 |
0 |
REQUIRE(Tracer::dtor_calls == 2); |
|
0 |
0 |
REQUIRE(Tracer::dtor_calls == 2); |
|
0 |
0 |
REQUIRE(Tracer::dtor_calls == 2); |
90
|
1 |
0 |
Dispatcher d; |
94
|
1 |
0 |
}; |
95
|
1 |
0 |
d.add(s); |
96
|
1 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
|
1 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
|
1 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
|
1 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
|
1 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
|
1 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
|
0 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
|
0 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
97
|
1 |
0 |
REQUIRE(called); |
|
1 |
0 |
REQUIRE(called); |
|
1 |
0 |
REQUIRE(called); |
|
1 |
0 |
REQUIRE(called); |
|
0 |
0 |
REQUIRE(called); |
|
0 |
0 |
REQUIRE(called); |
101
|
1 |
0 |
Dispatcher d; |
105
|
1 |
0 |
}; |
106
|
1 |
0 |
d.add(s); |
107
|
1 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
|
1 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
|
1 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
|
1 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
|
1 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
|
1 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
|
0 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
|
0 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
108
|
1 |
0 |
REQUIRE(called); |
|
1 |
0 |
REQUIRE(called); |
|
1 |
0 |
REQUIRE(called); |
|
1 |
0 |
REQUIRE(called); |
|
0 |
0 |
REQUIRE(called); |
|
0 |
0 |
REQUIRE(called); |
109
|
1 |
0 |
d.remove(s); |
111
|
1 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
|
1 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
|
1 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
|
1 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
|
1 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
|
1 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
|
0 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
|
0 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
112
|
1 |
0 |
REQUIRE(!called); |
|
1 |
0 |
REQUIRE(!called); |
|
1 |
0 |
REQUIRE(!called); |
|
1 |
0 |
REQUIRE(!called); |
|
0 |
0 |
REQUIRE(!called); |
|
0 |
0 |
REQUIRE(!called); |
116
|
1 |
0 |
Dispatcher d; |
120
|
1 |
0 |
}; |
121
|
1 |
0 |
d.add(s); |
|
1 |
0 |
d.add(s); |
122
|
1 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
|
1 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
|
1 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
|
1 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
|
1 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
|
1 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
|
0 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
|
0 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
123
|
1 |
0 |
REQUIRE(called); |
|
1 |
0 |
REQUIRE(called); |
|
1 |
0 |
REQUIRE(called); |
|
1 |
0 |
REQUIRE(called); |
|
0 |
0 |
REQUIRE(called); |
|
0 |
0 |
REQUIRE(called); |
124
|
1 |
0 |
d.remove(s); |
126
|
1 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
|
1 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
|
1 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
|
1 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
|
1 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
|
1 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
|
0 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
|
0 |
0 |
REQUIRE(d(2).value_or(42) == 42); |
127
|
1 |
0 |
REQUIRE(!called); |
|
1 |
0 |
REQUIRE(!called); |
|
1 |
0 |
REQUIRE(!called); |
|
1 |
0 |
REQUIRE(!called); |
|
0 |
0 |
REQUIRE(!called); |
|
0 |
0 |
REQUIRE(!called); |
131
|
1 |
0 |
Dispatcher d; |
147
|
1 |
0 |
Dispatcher::SimpleCallback s = src; |
148
|
1 |
0 |
d.add(s); |
149
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
0 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
0 |
0 |
CHECK(d(2).value_or(42) == 42); |
150
|
1 |
0 |
CHECK(called); |
|
1 |
0 |
CHECK(called); |
|
1 |
0 |
CHECK(called); |
|
1 |
0 |
CHECK(called); |
|
0 |
0 |
CHECK(called); |
|
0 |
0 |
CHECK(called); |
151
|
1 |
0 |
d.remove(s); |
153
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
0 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
0 |
0 |
CHECK(d(2).value_or(42) == 42); |
154
|
1 |
0 |
CHECK(!called); |
|
1 |
0 |
CHECK(!called); |
|
1 |
0 |
CHECK(!called); |
|
1 |
0 |
CHECK(!called); |
|
0 |
0 |
CHECK(!called); |
|
0 |
0 |
CHECK(!called); |
157
|
1 |
0 |
d.add(s); |
158
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
0 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
0 |
0 |
CHECK(d(2).value_or(42) == 42); |
159
|
1 |
0 |
CHECK(called); |
|
1 |
0 |
CHECK(called); |
|
1 |
0 |
CHECK(called); |
|
1 |
0 |
CHECK(called); |
|
0 |
0 |
CHECK(called); |
|
0 |
0 |
CHECK(called); |
161
|
1 |
0 |
d.remove_object(S(src)); |
163
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
0 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
0 |
0 |
CHECK(d(2).value_or(42) == 42); |
164
|
1 |
0 |
CHECK(!called); |
|
1 |
0 |
CHECK(!called); |
|
1 |
0 |
CHECK(!called); |
|
1 |
0 |
CHECK(!called); |
|
0 |
0 |
CHECK(!called); |
|
0 |
0 |
CHECK(!called); |
168
|
2 |
0 |
Dispatcher d; |
186
|
2 |
0 |
Dispatcher::Callback s = src; |
187
|
2 |
0 |
d.add_event_listener(s); |
189
|
2 |
0 |
CHECK(d(2).value_or(42) == 12); |
|
2 |
0 |
CHECK(d(2).value_or(42) == 12); |
|
2 |
0 |
CHECK(d(2).value_or(42) == 12); |
|
2 |
0 |
CHECK(d(2).value_or(42) == 12); |
|
2 |
0 |
CHECK(d(2).value_or(42) == 12); |
|
2 |
0 |
CHECK(d(2).value_or(42) == 12); |
|
0 |
0 |
CHECK(d(2).value_or(42) == 12); |
|
0 |
0 |
CHECK(d(2).value_or(42) == 12); |
190
|
2 |
0 |
CHECK(called); |
|
2 |
0 |
CHECK(called); |
|
2 |
0 |
CHECK(called); |
|
2 |
0 |
CHECK(called); |
|
0 |
0 |
CHECK(called); |
|
0 |
0 |
CHECK(called); |
193
|
2 |
0 |
SECTION("standatd remove") { |
|
2 |
0 |
SECTION("standatd remove") { |
|
2 |
0 |
SECTION("standatd remove") { |
|
2 |
0 |
SECTION("standatd remove") { |
|
1 |
1 |
SECTION("standatd remove") { |
194
|
1 |
0 |
d.remove(s); |
197
|
2 |
0 |
SECTION("fast remove") { |
|
2 |
0 |
SECTION("fast remove") { |
|
2 |
0 |
SECTION("fast remove") { |
|
2 |
0 |
SECTION("fast remove") { |
|
1 |
1 |
SECTION("fast remove") { |
198
|
1 |
0 |
d.remove_object(S(src)); |
201
|
2 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
2 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
2 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
2 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
2 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
2 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
0 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
0 |
0 |
CHECK(d(2).value_or(42) == 42); |
202
|
2 |
0 |
CHECK(!called); |
|
2 |
0 |
CHECK(!called); |
|
2 |
0 |
CHECK(!called); |
|
2 |
0 |
CHECK(!called); |
|
0 |
0 |
CHECK(!called); |
|
0 |
0 |
CHECK(!called); |
206
|
1 |
0 |
Dispatcher d; |
213
|
1 |
0 |
Dispatcher::SimpleCallback s = l; |
214
|
1 |
0 |
d.add(s); |
215
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
0 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
0 |
0 |
CHECK(d(2).value_or(42) == 42); |
216
|
1 |
0 |
CHECK(called); |
|
1 |
0 |
CHECK(called); |
|
1 |
0 |
CHECK(called); |
|
1 |
0 |
CHECK(called); |
|
0 |
0 |
CHECK(called); |
|
0 |
0 |
CHECK(called); |
218
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
0 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
0 |
0 |
CHECK(d(2).value_or(42) == 42); |
219
|
1 |
0 |
CHECK(!called); |
|
1 |
0 |
CHECK(!called); |
|
1 |
0 |
CHECK(!called); |
|
1 |
0 |
CHECK(!called); |
|
0 |
0 |
CHECK(!called); |
|
0 |
0 |
CHECK(!called); |
225
|
1 |
0 |
Dispatcher d; |
233
|
1 |
0 |
Dispatcher::Callback s = l; |
234
|
1 |
0 |
d.add_event_listener(s); |
235
|
1 |
0 |
CHECK(d(2).value_or(42) == 12); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 12); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 12); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 12); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 12); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 12); |
|
0 |
0 |
CHECK(d(2).value_or(42) == 12); |
|
0 |
0 |
CHECK(d(2).value_or(42) == 12); |
236
|
1 |
0 |
CHECK(called); |
|
1 |
0 |
CHECK(called); |
|
1 |
0 |
CHECK(called); |
|
1 |
0 |
CHECK(called); |
|
0 |
0 |
CHECK(called); |
|
0 |
0 |
CHECK(called); |
238
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
1 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
0 |
0 |
CHECK(d(2).value_or(42) == 42); |
|
0 |
0 |
CHECK(d(2).value_or(42) == 42); |
239
|
1 |
0 |
CHECK(!called); |
|
1 |
0 |
CHECK(!called); |
|
1 |
0 |
CHECK(!called); |
|
1 |
0 |
CHECK(!called); |
|
0 |
0 |
CHECK(!called); |
|
0 |
0 |
CHECK(!called); |
243
|
1 |
0 |
Dispatcher d; |
244
|
1 |
0 |
d.add_event_listener([](Dispatcher::Event&, int a){return a*2;}); |
|
1 |
0 |
d.add_event_listener([](Dispatcher::Event&, int a){return a*2;}); |
245
|
1 |
0 |
function(int)> f = d; |
246
|
1 |
0 |
REQUIRE(f(10).value_or(0) == 20); |
|
1 |
0 |
REQUIRE(f(10).value_or(0) == 20); |
|
1 |
0 |
REQUIRE(f(10).value_or(0) == 20); |
|
1 |
0 |
REQUIRE(f(10).value_or(0) == 20); |
|
1 |
0 |
REQUIRE(f(10).value_or(0) == 20); |
|
1 |
0 |
REQUIRE(f(10).value_or(0) == 20); |
|
0 |
0 |
REQUIRE(f(10).value_or(0) == 20); |
|
0 |
0 |
REQUIRE(f(10).value_or(0) == 20); |
252
|
1 |
0 |
Dispatcher d; |
253
|
1 |
0 |
d.add([](string s) {CHECK(s == "value");}); |
|
1 |
0 |
d.add([](string s) {CHECK(s == "value");}); |
|
2 |
0 |
d.add([](string s) {CHECK(s == "value");}); |
|
2 |
0 |
d.add([](string s) {CHECK(s == "value");}); |
|
2 |
0 |
d.add([](string s) {CHECK(s == "value");}); |
|
2 |
0 |
d.add([](string s) {CHECK(s == "value");}); |
|
2 |
0 |
d.add([](string s) {CHECK(s == "value");}); |
|
0 |
0 |
d.add([](string s) {CHECK(s == "value");}); |
|
0 |
0 |
d.add([](string s) {CHECK(s == "value");}); |
254
|
1 |
0 |
d.add([](string s) {CHECK(s == "value");}); |
|
1 |
0 |
d.add([](string s) {CHECK(s == "value");}); |
|
2 |
0 |
d.add([](string s) {CHECK(s == "value");}); |
|
2 |
0 |
d.add([](string s) {CHECK(s == "value");}); |
|
2 |
0 |
d.add([](string s) {CHECK(s == "value");}); |
|
2 |
0 |
d.add([](string s) {CHECK(s == "value");}); |
|
2 |
0 |
d.add([](string s) {CHECK(s == "value");}); |
|
0 |
0 |
d.add([](string s) {CHECK(s == "value");}); |
|
0 |
0 |
d.add([](string s) {CHECK(s == "value");}); |
255
|
1 |
0 |
d(string("value")); |
257
|
1 |
0 |
d(s); |
262
|
1 |
0 |
Dispatcher d; |
264
|
1 |
0 |
d.add([&]{ res.push_back(1); }); |
|
1 |
0 |
d.add([&]{ res.push_back(1); }); |
|
1 |
0 |
d.add([&]{ res.push_back(1); }); |
265
|
1 |
0 |
d.add([&]{ res.push_back(2); }); |
|
1 |
0 |
d.add([&]{ res.push_back(2); }); |
|
1 |
0 |
d.add([&]{ res.push_back(2); }); |
266
|
1 |
0 |
d.add_event_listener([&](Dispatcher::Event& e){ res.push_back(3); e.next(); }); |
|
1 |
0 |
d.add_event_listener([&](Dispatcher::Event& e){ res.push_back(3); e.next(); }); |
|
1 |
0 |
d.add_event_listener([&](Dispatcher::Event& e){ res.push_back(3); e.next(); }); |
267
|
1 |
0 |
d(); |
268
|
1 |
0 |
REQUIRE(res == std::vector({3,2,1})); |
|
1 |
0 |
REQUIRE(res == std::vector({3,2,1})); |
|
1 |
0 |
REQUIRE(res == std::vector({3,2,1})); |
|
1 |
0 |
REQUIRE(res == std::vector({3,2,1})); |
|
1 |
0 |
REQUIRE(res == std::vector({3,2,1})); |
|
1 |
0 |
REQUIRE(res == std::vector({3,2,1})); |
|
0 |
0 |
REQUIRE(res == std::vector({3,2,1})); |
|
0 |
0 |
REQUIRE(res == std::vector({3,2,1})); |
273
|
1 |
0 |
Dispatcher d; |
275
|
1 |
0 |
d.add_event_listener([&](Dispatcher::Event& e){ res.push_back(1); e.next(); }, true); |
|
1 |
0 |
d.add_event_listener([&](Dispatcher::Event& e){ res.push_back(1); e.next(); }, true); |
|
1 |
0 |
d.add_event_listener([&](Dispatcher::Event& e){ res.push_back(1); e.next(); }, true); |
276
|
1 |
0 |
d.add([&]{ res.push_back(2); }, true); |
|
1 |
0 |
d.add([&]{ res.push_back(2); }, true); |
|
1 |
0 |
d.add([&]{ res.push_back(2); }, true); |
277
|
1 |
0 |
d.add_back([&]{ res.push_back(3); }); |
|
1 |
0 |
d.add_back([&]{ res.push_back(3); }); |
278
|
1 |
0 |
d(); |
279
|
1 |
0 |
REQUIRE(res == std::vector({1,2,3})); |
|
1 |
0 |
REQUIRE(res == std::vector({1,2,3})); |
|
1 |
0 |
REQUIRE(res == std::vector({1,2,3})); |
|
1 |
0 |
REQUIRE(res == std::vector({1,2,3})); |
|
1 |
0 |
REQUIRE(res == std::vector({1,2,3})); |
|
1 |
0 |
REQUIRE(res == std::vector({1,2,3})); |
|
0 |
0 |
REQUIRE(res == std::vector({1,2,3})); |
|
0 |
0 |
REQUIRE(res == std::vector({1,2,3})); |
284
|
2 |
0 |
CallbackDispatcher d; |
286
|
2 |
0 |
SECTION("many listenees") { |
|
2 |
0 |
SECTION("many listenees") { |
|
2 |
0 |
SECTION("many listenees") { |
|
2 |
0 |
SECTION("many listenees") { |
|
1 |
1 |
SECTION("many listenees") { |
288
|
1 |
0 |
d.add([](auto&&...){}); |
|
1 |
0 |
d.add([](auto&&...){}); |
289
|
1 |
0 |
d.add([](auto&&...){}); |
|
1 |
0 |
d.add([](auto&&...){}); |
290
|
1 |
0 |
d.add([](auto&&...){}); |
|
1 |
0 |
d.add([](auto&&...){}); |
292
|
2 |
0 |
SECTION("no listeners"){} |
|
2 |
0 |
SECTION("no listeners"){} |
|
2 |
0 |
SECTION("no listeners"){} |
|
2 |
0 |
SECTION("no listeners"){} |
294
|
2 |
0 |
d(Tracer()); |
295
|
2 |
0 |
CHECK(Tracer::ctor_total() == 1); |
|
2 |
0 |
CHECK(Tracer::ctor_total() == 1); |
|
2 |
0 |
CHECK(Tracer::ctor_total() == 1); |
|
2 |
0 |
CHECK(Tracer::ctor_total() == 1); |
|
2 |
0 |
CHECK(Tracer::ctor_total() == 1); |
|
0 |
0 |
CHECK(Tracer::ctor_total() == 1); |
|
0 |
0 |
CHECK(Tracer::ctor_total() == 1); |
299
|
1 |
0 |
CallbackDispatcher d1; |
300
|
1 |
0 |
CallbackDispatcher d2; |
304
|
0 |
0 |
auto l3 = [](auto&&...args) { REQUIRE(sizeof...(args) == 1); }; |
|
0 |
0 |
auto l3 = [](auto&&...args) { REQUIRE(sizeof...(args) == 1); }; |
|
0 |
0 |
auto l3 = [](auto&&...args) { REQUIRE(sizeof...(args) == 1); }; |
|
0 |
0 |
auto l3 = [](auto&&...args) { REQUIRE(sizeof...(args) == 1); }; |
|
0 |
0 |
auto l3 = [](auto&&...args) { REQUIRE(sizeof...(args) == 1); }; |
|
0 |
0 |
auto l3 = [](auto&&...args) { REQUIRE(sizeof...(args) == 1); }; |
|
0 |
0 |
auto l3 = [](auto&&...args) { REQUIRE(sizeof...(args) == 1); }; |
306
|
1 |
0 |
d1.add(l1); |
|
1 |
0 |
d1.add(l1); |
307
|
1 |
0 |
d1.add(l2); |
|
1 |
0 |
d1.add(l2); |
308
|
1 |
0 |
d1.add(l3); |
|
1 |
0 |
d1.add(l3); |
309
|
1 |
0 |
d2.add(l1); |
|
1 |
0 |
d2.add(l1); |
310
|
1 |
0 |
d2.add(l2); |
|
1 |
0 |
d2.add(l2); |
311
|
1 |
0 |
d2.add(l3); |
|
1 |
0 |
d2.add(l3); |
315
|
0 |
0 |
auto l3a = [](auto&&...args) { REQUIRE(sizeof...(args) == 2); return 3; }; |
|
0 |
0 |
auto l3a = [](auto&&...args) { REQUIRE(sizeof...(args) == 2); return 3; }; |
|
0 |
0 |
auto l3a = [](auto&&...args) { REQUIRE(sizeof...(args) == 2); return 3; }; |
|
0 |
0 |
auto l3a = [](auto&&...args) { REQUIRE(sizeof...(args) == 2); return 3; }; |
|
0 |
0 |
auto l3a = [](auto&&...args) { REQUIRE(sizeof...(args) == 2); return 3; }; |
|
0 |
0 |
auto l3a = [](auto&&...args) { REQUIRE(sizeof...(args) == 2); return 3; }; |
|
0 |
0 |
auto l3a = [](auto&&...args) { REQUIRE(sizeof...(args) == 2); return 3; }; |
317
|
1 |
0 |
d2.add_event_listener(l1a); |
|
1 |
0 |
d2.add_event_listener(l1a); |
318
|
1 |
0 |
d2.add_event_listener(l2a); |
|
1 |
0 |
d2.add_event_listener(l2a); |
319
|
1 |
0 |
d2.add_event_listener(l3a); |
|
1 |
0 |
d2.add_event_listener(l3a); |
323
|
1 |
0 |
Dispatcher* d = new Dispatcher; |
|
1 |
0 |
Dispatcher* d = new Dispatcher; |
325
|
1 |
0 |
delete d; |
326
|
1 |
0 |
}; |
327
|
1 |
0 |
d->add(cb); |
332
|
1 |
0 |
}; |
333
|
1 |
0 |
d->add(check, true); |
335
|
1 |
0 |
(*d)(10); |
336
|
1 |
0 |
REQUIRE_FALSE(called); |
|
1 |
0 |
REQUIRE_FALSE(called); |
|
1 |
0 |
REQUIRE_FALSE(called); |
|
1 |
0 |
REQUIRE_FALSE(called); |
|
1 |
0 |
REQUIRE_FALSE(called); |
|
0 |
0 |
REQUIRE_FALSE(called); |
|
0 |
0 |
REQUIRE_FALSE(called); |
337
|
18 |
0 |
} |
|
18 |
0 |
} |