1 /* Copyright (c) 2017-2023. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #include "src/3rd-party/catch.hpp"
7 #include "src/mc/explo/udpor/UnfoldingEvent.hpp"
8 #include "src/mc/explo/udpor/udpor_tests_private.hpp"
10 using namespace simgrid::mc;
11 using namespace simgrid::mc::udpor;
13 TEST_CASE("simgrid::mc::udpor::UnfoldingEvent: Semantic Equivalence Tests")
15 UnfoldingEvent e1(EventSet(), std::make_shared<IndependentAction>(Transition::Type::UNKNOWN, 0, 0));
16 UnfoldingEvent e2(EventSet({&e1}), std::make_shared<IndependentAction>(Transition::Type::UNKNOWN, 0, 0));
17 UnfoldingEvent e3(EventSet({&e1}), std::make_shared<IndependentAction>(Transition::Type::UNKNOWN, 0, 0));
18 UnfoldingEvent e4(EventSet({&e1}), std::make_shared<IndependentAction>(Transition::Type::UNKNOWN, 0, 0));
20 UnfoldingEvent e5(EventSet({&e1, &e3, &e2}), std::make_shared<IndependentAction>(Transition::Type::UNKNOWN, 0, 0));
21 UnfoldingEvent e6(EventSet({&e1, &e3, &e2}), std::make_shared<IndependentAction>(Transition::Type::UNKNOWN, 0, 0));
22 UnfoldingEvent e7(EventSet({&e1, &e3, &e2}), std::make_shared<IndependentAction>(Transition::Type::UNKNOWN, 0, 0));
24 SECTION("Equivalence is an equivalence relation")
26 SECTION("Equivalence is reflexive")
34 SECTION("Equivalence is symmetric")
44 SECTION("Equivalence is transitive")
55 SECTION("Equivalence fails with different actors")
57 UnfoldingEvent e1_diff_actor(EventSet(), std::make_shared<IndependentAction>(Transition::Type::UNKNOWN, 1, 0));
58 UnfoldingEvent e2_diff_actor(EventSet({&e1}), std::make_shared<IndependentAction>(Transition::Type::UNKNOWN, 1, 0));
59 UnfoldingEvent e5_diff_actor(EventSet({&e1, &e3, &e2}),
60 std::make_shared<DependentAction>(Transition::Type::UNKNOWN, 1, 0));
61 REQUIRE(e1 != e1_diff_actor);
62 REQUIRE(e1 != e2_diff_actor);
63 REQUIRE(e1 != e5_diff_actor);
66 SECTION("Equivalence fails with different transition types")
68 // NOTE: We're comparing the transition `type_` field directly. To avoid
69 // modifying the `Type` enum that exists in `Transition` just for the tests,
70 // we instead provide different values of `Transition::Type` to simulate
71 // the different types
72 UnfoldingEvent e1_diff_transition(EventSet(),
73 std::make_shared<IndependentAction>(Transition::Type::ACTOR_JOIN, 0, 0));
74 UnfoldingEvent e2_diff_transition(EventSet({&e1}),
75 std::make_shared<IndependentAction>(Transition::Type::ACTOR_JOIN, 0, 0));
76 UnfoldingEvent e5_diff_transition(EventSet({&e1, &e3, &e2}),
77 std::make_shared<IndependentAction>(Transition::Type::ACTOR_JOIN, 0, 0));
78 REQUIRE(e1 != e1_diff_transition);
79 REQUIRE(e1 != e2_diff_transition);
80 REQUIRE(e1 != e5_diff_transition);
83 SECTION("Equivalence fails with different `times_considered`")
85 // With a different number for `times_considered`, we know
86 UnfoldingEvent e1_diff_considered(EventSet(), std::make_shared<IndependentAction>(Transition::Type::UNKNOWN, 0, 1));
87 UnfoldingEvent e2_diff_considered(EventSet({&e1}),
88 std::make_shared<IndependentAction>(Transition::Type::UNKNOWN, 0, 1));
89 UnfoldingEvent e5_diff_considered(EventSet({&e1, &e3, &e2}),
90 std::make_shared<IndependentAction>(Transition::Type::UNKNOWN, 0, 1));
91 REQUIRE(e1 != e1_diff_considered);
92 REQUIRE(e1 != e2_diff_considered);
93 REQUIRE(e1 != e5_diff_considered);
96 SECTION("Equivalence fails with different immediate histories of events")
98 UnfoldingEvent e1_diff_hist(EventSet({&e2}), std::make_shared<IndependentAction>(Transition::Type::UNKNOWN, 0, 0));
99 UnfoldingEvent e2_diff_hist(EventSet({&e3}), std::make_shared<IndependentAction>(Transition::Type::UNKNOWN, 0, 0));
100 UnfoldingEvent e5_diff_hist(EventSet({&e1, &e2}),
101 std::make_shared<IndependentAction>(Transition::Type::UNKNOWN, 0, 0));
102 REQUIRE(e1 != e1_diff_hist);
103 REQUIRE(e1 != e2_diff_hist);
104 REQUIRE(e1 != e5_diff_hist);
108 TEST_CASE("simgrid::mc::udpor::UnfoldingEvent: Dependency/Conflict Tests")
110 SECTION("Properties of the relations")
112 // The following tests concern the given event structure:
121 // e5 and e6 are in conflict, e5 and e7 are in conflict, e2 and e6, and e2 ands e7 are in conflict
122 UnfoldingEvent e1(EventSet(), std::make_shared<ConditionallyDependentAction>());
123 UnfoldingEvent e2(EventSet({&e1}), std::make_shared<DependentAction>());
124 UnfoldingEvent e3(EventSet({&e2}), std::make_shared<IndependentAction>());
125 UnfoldingEvent e4(EventSet({&e3}), std::make_shared<ConditionallyDependentAction>());
126 UnfoldingEvent e5(EventSet({&e3}), std::make_shared<DependentAction>());
127 UnfoldingEvent e6(EventSet({&e1}), std::make_shared<ConditionallyDependentAction>());
128 UnfoldingEvent e7(EventSet({&e6, &e2}), std::make_shared<ConditionallyDependentAction>());
130 SECTION("Dependency relation properties")
132 SECTION("Dependency is reflexive")
134 REQUIRE(e2.is_dependent_with(&e2));
135 REQUIRE(e5.is_dependent_with(&e5));
138 SECTION("Dependency is symmetric")
140 REQUIRE(e2.is_dependent_with(&e6));
141 REQUIRE(e6.is_dependent_with(&e2));
144 SECTION("Dependency is NOT necessarily transitive")
146 REQUIRE(e1.is_dependent_with(&e5));
147 REQUIRE(e5.is_dependent_with(&e7));
148 REQUIRE_FALSE(e1.is_dependent_with(&e7));
152 SECTION("Conflict relation properties")
154 SECTION("Conflict relation is irreflexive")
156 REQUIRE_FALSE(e1.conflicts_with(&e1));
157 REQUIRE_FALSE(e2.conflicts_with(&e2));
158 REQUIRE_FALSE(e3.conflicts_with(&e3));
159 REQUIRE_FALSE(e4.conflicts_with(&e4));
160 REQUIRE_FALSE(e5.conflicts_with(&e5));
161 REQUIRE_FALSE(e6.conflicts_with(&e6));
162 REQUIRE_FALSE(e7.conflicts_with(&e7));
164 REQUIRE_FALSE(e1.immediately_conflicts_with(&e1));
165 REQUIRE_FALSE(e2.immediately_conflicts_with(&e2));
166 REQUIRE_FALSE(e3.immediately_conflicts_with(&e3));
167 REQUIRE_FALSE(e4.immediately_conflicts_with(&e4));
168 REQUIRE_FALSE(e5.immediately_conflicts_with(&e5));
169 REQUIRE_FALSE(e6.immediately_conflicts_with(&e6));
170 REQUIRE_FALSE(e7.immediately_conflicts_with(&e7));
173 SECTION("Conflict relation is symmetric")
175 REQUIRE(e5.conflicts_with(&e6));
176 REQUIRE(e6.conflicts_with(&e5));
177 REQUIRE(e5.immediately_conflicts_with(&e4));
178 REQUIRE(e4.immediately_conflicts_with(&e5));
183 SECTION("No conflicts whatsoever")
185 // The following tests concern the given event structure:
193 UnfoldingEvent e1(EventSet(), std::make_shared<IndependentAction>());
194 UnfoldingEvent e2(EventSet({&e1}), std::make_shared<IndependentAction>());
195 UnfoldingEvent e3(EventSet({&e2}), std::make_shared<IndependentAction>());
196 UnfoldingEvent e4(EventSet({&e3}), std::make_shared<IndependentAction>());
197 UnfoldingEvent e5(EventSet({&e3}), std::make_shared<IndependentAction>());
198 UnfoldingEvent e6(EventSet({&e1}), std::make_shared<IndependentAction>());
199 UnfoldingEvent e7(EventSet({&e6, &e2}), std::make_shared<IndependentAction>());
201 // Since everyone's actions are independent of one another, we expect
202 // that there are no conflicts between each pair of events
203 SECTION("Mutual dependencies")
205 CHECK_FALSE(e1.is_dependent_with(&e1));
206 CHECK_FALSE(e1.is_dependent_with(&e2));
207 CHECK_FALSE(e1.is_dependent_with(&e3));
208 CHECK_FALSE(e1.is_dependent_with(&e4));
209 CHECK_FALSE(e1.is_dependent_with(&e5));
210 CHECK_FALSE(e1.is_dependent_with(&e6));
211 CHECK_FALSE(e1.is_dependent_with(&e7));
213 CHECK_FALSE(e2.is_dependent_with(&e2));
214 CHECK_FALSE(e2.is_dependent_with(&e3));
215 CHECK_FALSE(e2.is_dependent_with(&e4));
216 CHECK_FALSE(e2.is_dependent_with(&e5));
217 CHECK_FALSE(e2.is_dependent_with(&e6));
218 CHECK_FALSE(e2.is_dependent_with(&e7));
220 CHECK_FALSE(e3.is_dependent_with(&e3));
221 CHECK_FALSE(e3.is_dependent_with(&e4));
222 CHECK_FALSE(e3.is_dependent_with(&e5));
223 CHECK_FALSE(e3.is_dependent_with(&e6));
224 CHECK_FALSE(e3.is_dependent_with(&e7));
226 CHECK_FALSE(e4.is_dependent_with(&e4));
227 CHECK_FALSE(e4.is_dependent_with(&e5));
228 CHECK_FALSE(e4.is_dependent_with(&e6));
229 CHECK_FALSE(e4.is_dependent_with(&e7));
231 CHECK_FALSE(e5.is_dependent_with(&e5));
232 CHECK_FALSE(e5.is_dependent_with(&e6));
233 CHECK_FALSE(e5.is_dependent_with(&e7));
235 CHECK_FALSE(e6.is_dependent_with(&e6));
236 CHECK_FALSE(e6.is_dependent_with(&e7));
238 CHECK_FALSE(e7.is_dependent_with(&e7));
241 SECTION("Mutual conflicts")
243 CHECK_FALSE(e1.conflicts_with(&e1));
244 CHECK_FALSE(e1.conflicts_with(&e2));
245 CHECK_FALSE(e1.conflicts_with(&e3));
246 CHECK_FALSE(e1.conflicts_with(&e4));
247 CHECK_FALSE(e1.conflicts_with(&e5));
248 CHECK_FALSE(e1.conflicts_with(&e6));
249 CHECK_FALSE(e1.conflicts_with(&e7));
251 CHECK_FALSE(e2.conflicts_with(&e1));
252 CHECK_FALSE(e2.conflicts_with(&e2));
253 CHECK_FALSE(e2.conflicts_with(&e3));
254 CHECK_FALSE(e2.conflicts_with(&e4));
255 CHECK_FALSE(e2.conflicts_with(&e5));
256 CHECK_FALSE(e2.conflicts_with(&e6));
257 CHECK_FALSE(e2.conflicts_with(&e7));
259 CHECK_FALSE(e3.conflicts_with(&e1));
260 CHECK_FALSE(e3.conflicts_with(&e2));
261 CHECK_FALSE(e3.conflicts_with(&e3));
262 CHECK_FALSE(e3.conflicts_with(&e4));
263 CHECK_FALSE(e3.conflicts_with(&e5));
264 CHECK_FALSE(e3.conflicts_with(&e6));
265 CHECK_FALSE(e3.conflicts_with(&e7));
267 CHECK_FALSE(e4.conflicts_with(&e1));
268 CHECK_FALSE(e4.conflicts_with(&e2));
269 CHECK_FALSE(e4.conflicts_with(&e3));
270 CHECK_FALSE(e4.conflicts_with(&e4));
271 CHECK_FALSE(e4.conflicts_with(&e5));
272 CHECK_FALSE(e4.conflicts_with(&e6));
273 CHECK_FALSE(e4.conflicts_with(&e7));
275 CHECK_FALSE(e5.conflicts_with(&e1));
276 CHECK_FALSE(e5.conflicts_with(&e2));
277 CHECK_FALSE(e5.conflicts_with(&e3));
278 CHECK_FALSE(e5.conflicts_with(&e4));
279 CHECK_FALSE(e5.conflicts_with(&e5));
280 CHECK_FALSE(e5.conflicts_with(&e6));
281 CHECK_FALSE(e5.conflicts_with(&e7));
283 CHECK_FALSE(e6.conflicts_with(&e1));
284 CHECK_FALSE(e6.conflicts_with(&e2));
285 CHECK_FALSE(e6.conflicts_with(&e3));
286 CHECK_FALSE(e6.conflicts_with(&e4));
287 CHECK_FALSE(e6.conflicts_with(&e5));
288 CHECK_FALSE(e6.conflicts_with(&e6));
289 CHECK_FALSE(e6.conflicts_with(&e7));
291 CHECK_FALSE(e7.conflicts_with(&e1));
292 CHECK_FALSE(e7.conflicts_with(&e2));
293 CHECK_FALSE(e7.conflicts_with(&e3));
294 CHECK_FALSE(e7.conflicts_with(&e4));
295 CHECK_FALSE(e7.conflicts_with(&e5));
296 CHECK_FALSE(e7.conflicts_with(&e6));
297 CHECK_FALSE(e7.conflicts_with(&e7));
301 SECTION("General conflicts")
303 // The following tests concern the given event structure:
311 UnfoldingEvent e1(EventSet(), std::make_shared<DependentAction>());
312 UnfoldingEvent e2(EventSet({&e1}), std::make_shared<DependentAction>());
313 UnfoldingEvent e3(EventSet({&e2}), std::make_shared<IndependentAction>());
314 UnfoldingEvent e4(EventSet({&e3}), std::make_shared<IndependentAction>());
315 UnfoldingEvent e5(EventSet({&e3}), std::make_shared<IndependentAction>());
316 UnfoldingEvent e6(EventSet({&e1}), std::make_shared<IndependentAction>());
317 UnfoldingEvent e7(EventSet({&e6, &e2}), std::make_shared<ConditionallyDependentAction>());
319 // Since everyone's actions are independent of one another, we expect
320 // that there are no conflicts between each pair of events
321 SECTION("Mutual dependencies")
323 CHECK(e1.is_dependent_with(&e1));
324 CHECK(e1.is_dependent_with(&e2));
325 CHECK_FALSE(e1.is_dependent_with(&e3));
326 CHECK_FALSE(e1.is_dependent_with(&e4));
327 CHECK_FALSE(e1.is_dependent_with(&e5));
328 CHECK_FALSE(e1.is_dependent_with(&e6));
329 CHECK(e1.is_dependent_with(&e7));
331 CHECK(e2.is_dependent_with(&e2));
332 CHECK_FALSE(e2.is_dependent_with(&e3));
333 CHECK_FALSE(e2.is_dependent_with(&e4));
334 CHECK_FALSE(e2.is_dependent_with(&e5));
335 CHECK_FALSE(e2.is_dependent_with(&e6));
336 CHECK(e2.is_dependent_with(&e7));
338 CHECK_FALSE(e3.is_dependent_with(&e3));
339 CHECK_FALSE(e3.is_dependent_with(&e4));
340 CHECK_FALSE(e3.is_dependent_with(&e5));
341 CHECK_FALSE(e3.is_dependent_with(&e6));
342 CHECK_FALSE(e3.is_dependent_with(&e7));
344 CHECK_FALSE(e4.is_dependent_with(&e4));
345 CHECK_FALSE(e4.is_dependent_with(&e5));
346 CHECK_FALSE(e4.is_dependent_with(&e6));
347 CHECK_FALSE(e4.is_dependent_with(&e7));
349 CHECK_FALSE(e5.is_dependent_with(&e5));
350 CHECK_FALSE(e5.is_dependent_with(&e6));
351 CHECK_FALSE(e5.is_dependent_with(&e7));
353 CHECK_FALSE(e6.is_dependent_with(&e6));
354 CHECK_FALSE(e6.is_dependent_with(&e7));
356 CHECK_FALSE(e7.is_dependent_with(&e7));
359 SECTION("Mutual conflicts")
361 // Although e1 is dependent with e1, e2, and e7,
362 // since they are related to one another, they are not
363 // considered to be in conflict
364 CHECK_FALSE(e1.conflicts_with(&e1));
365 CHECK_FALSE(e1.conflicts_with(&e2));
366 CHECK_FALSE(e1.conflicts_with(&e3));
367 CHECK_FALSE(e1.conflicts_with(&e4));
368 CHECK_FALSE(e1.conflicts_with(&e5));
369 CHECK_FALSE(e1.conflicts_with(&e6));
370 CHECK_FALSE(e1.conflicts_with(&e7));
372 // Same goes for e2 with e2 and e7
373 CHECK_FALSE(e2.conflicts_with(&e1));
374 CHECK_FALSE(e2.conflicts_with(&e2));
375 CHECK_FALSE(e2.conflicts_with(&e3));
376 CHECK_FALSE(e2.conflicts_with(&e4));
377 CHECK_FALSE(e2.conflicts_with(&e5));
378 CHECK_FALSE(e2.conflicts_with(&e6));
379 CHECK_FALSE(e2.conflicts_with(&e7));
381 CHECK_FALSE(e3.conflicts_with(&e1));
382 CHECK_FALSE(e3.conflicts_with(&e2));
383 CHECK_FALSE(e3.conflicts_with(&e3));
384 CHECK_FALSE(e3.conflicts_with(&e4));
385 CHECK_FALSE(e3.conflicts_with(&e5));
386 CHECK_FALSE(e3.conflicts_with(&e6));
387 CHECK_FALSE(e3.conflicts_with(&e7));
389 CHECK_FALSE(e4.conflicts_with(&e1));
390 CHECK_FALSE(e4.conflicts_with(&e2));
391 CHECK_FALSE(e4.conflicts_with(&e3));
392 CHECK_FALSE(e4.conflicts_with(&e4));
393 CHECK_FALSE(e4.conflicts_with(&e5));
394 CHECK_FALSE(e4.conflicts_with(&e6));
395 CHECK_FALSE(e4.conflicts_with(&e7));
397 CHECK_FALSE(e5.conflicts_with(&e1));
398 CHECK_FALSE(e5.conflicts_with(&e2));
399 CHECK_FALSE(e5.conflicts_with(&e3));
400 CHECK_FALSE(e5.conflicts_with(&e4));
401 CHECK_FALSE(e5.conflicts_with(&e5));
402 CHECK_FALSE(e5.conflicts_with(&e6));
403 CHECK_FALSE(e5.conflicts_with(&e7));
405 CHECK_FALSE(e6.conflicts_with(&e1));
406 CHECK_FALSE(e6.conflicts_with(&e2));
407 CHECK_FALSE(e6.conflicts_with(&e3));
408 CHECK_FALSE(e6.conflicts_with(&e4));
409 CHECK_FALSE(e6.conflicts_with(&e5));
410 CHECK_FALSE(e6.conflicts_with(&e6));
411 CHECK_FALSE(e6.conflicts_with(&e7));
413 CHECK_FALSE(e7.conflicts_with(&e1));
414 CHECK_FALSE(e7.conflicts_with(&e2));
415 CHECK_FALSE(e7.conflicts_with(&e3));
416 CHECK_FALSE(e7.conflicts_with(&e4));
417 CHECK_FALSE(e7.conflicts_with(&e5));
418 CHECK_FALSE(e7.conflicts_with(&e6));
419 CHECK_FALSE(e7.conflicts_with(&e7));
423 SECTION("More complicated conflicts")
425 // The following tests concern the given event structure:
433 UnfoldingEvent e1(EventSet(), std::make_shared<IndependentAction>());
434 UnfoldingEvent e2(EventSet({&e1}), std::make_shared<ConditionallyDependentAction>());
435 UnfoldingEvent e3(EventSet({&e2}), std::make_shared<IndependentAction>());
436 UnfoldingEvent e4(EventSet({&e3}), std::make_shared<IndependentAction>());
437 UnfoldingEvent e5(EventSet({&e3}), std::make_shared<IndependentAction>());
438 UnfoldingEvent e6(EventSet({&e1}), std::make_shared<DependentAction>());
439 UnfoldingEvent e7(EventSet({&e6}), std::make_shared<IndependentAction>());
441 CHECK_FALSE(e1.conflicts_with(&e1));
442 CHECK_FALSE(e1.conflicts_with(&e2));
443 CHECK_FALSE(e1.conflicts_with(&e3));
444 CHECK_FALSE(e1.conflicts_with(&e4));
445 CHECK_FALSE(e1.conflicts_with(&e5));
446 CHECK_FALSE(e1.conflicts_with(&e6));
447 CHECK_FALSE(e1.conflicts_with(&e7));
449 // e2 conflicts with e6. Since e6 < e7,
450 // e2 also conflicts with e7
451 CHECK_FALSE(e2.conflicts_with(&e1));
452 CHECK_FALSE(e2.conflicts_with(&e2));
453 CHECK_FALSE(e2.conflicts_with(&e3));
454 CHECK_FALSE(e2.conflicts_with(&e4));
455 CHECK_FALSE(e2.conflicts_with(&e5));
456 CHECK(e2.conflicts_with(&e6));
457 REQUIRE(e2.conflicts_with(&e7));
459 // e3 and e6 are dependent and unrelated, so they conflict
460 CHECK_FALSE(e3.conflicts_with(&e1));
461 CHECK_FALSE(e3.conflicts_with(&e2));
462 CHECK_FALSE(e3.conflicts_with(&e3));
463 CHECK_FALSE(e3.conflicts_with(&e4));
464 CHECK_FALSE(e3.conflicts_with(&e5));
465 CHECK(e3.conflicts_with(&e6));
466 CHECK_FALSE(e3.conflicts_with(&e7));
468 // Since e3 and e6 conflict and e3 < e4, e4 and e6 conflict
469 CHECK_FALSE(e4.conflicts_with(&e1));
470 CHECK_FALSE(e4.conflicts_with(&e2));
471 CHECK_FALSE(e4.conflicts_with(&e3));
472 CHECK_FALSE(e4.conflicts_with(&e4));
473 CHECK_FALSE(e4.conflicts_with(&e5));
474 CHECK(e4.conflicts_with(&e6));
475 CHECK_FALSE(e4.conflicts_with(&e7));
478 CHECK_FALSE(e5.conflicts_with(&e1));
479 CHECK_FALSE(e5.conflicts_with(&e2));
480 CHECK_FALSE(e5.conflicts_with(&e3));
481 CHECK_FALSE(e5.conflicts_with(&e4));
482 CHECK_FALSE(e5.conflicts_with(&e5));
483 CHECK(e5.conflicts_with(&e6));
484 CHECK_FALSE(e5.conflicts_with(&e7));
486 // Conflicts are symmetric
487 CHECK_FALSE(e6.conflicts_with(&e1));
488 CHECK(e6.conflicts_with(&e2));
489 CHECK(e6.conflicts_with(&e3));
490 CHECK(e6.conflicts_with(&e4));
491 CHECK(e6.conflicts_with(&e5));
492 CHECK_FALSE(e6.conflicts_with(&e6));
493 CHECK_FALSE(e6.conflicts_with(&e7));
495 CHECK_FALSE(e7.conflicts_with(&e1));
496 CHECK(e7.conflicts_with(&e2));
497 CHECK_FALSE(e7.conflicts_with(&e3));
498 CHECK_FALSE(e7.conflicts_with(&e4));
499 CHECK_FALSE(e7.conflicts_with(&e5));
500 CHECK_FALSE(e7.conflicts_with(&e6));
501 CHECK_FALSE(e7.conflicts_with(&e7));
505 TEST_CASE("simgrid::mc::udpor::UnfoldingEvent: Immediate Conflicts + Conflicts Stress Test")
507 // The following tests concern the given event structure:
520 // Immediate conflicts:
525 // NOTE: e7 + e8 ARE NOT in immediate conflict! The reason is that
526 // the set of events {e8, e6, e5, e3, e4, e1} is not a valid configuration,
527 // (nor is {e7, e6, e5, e3, e4, e1})
529 // NOTE: e2/e3 + e10 are NOT in immediate conflict! EVEN THOUGH {e1, e4, e10}
530 // is a valid configuration, {e1, e2/e3, e4} is not (since e2/e3 and e4 conflict)
531 UnfoldingEvent e1(EventSet(), std::make_shared<IndependentAction>());
532 UnfoldingEvent e2(EventSet({&e1}), std::make_shared<DependentAction>());
533 UnfoldingEvent e3(EventSet({&e1}), std::make_shared<DependentAction>());
534 UnfoldingEvent e4(EventSet({&e1}), std::make_shared<DependentAction>());
535 UnfoldingEvent e5(EventSet({&e3, &e4}), std::make_shared<IndependentAction>());
536 UnfoldingEvent e6(EventSet({&e5}), std::make_shared<IndependentAction>());
537 UnfoldingEvent e7(EventSet({&e6}), std::make_shared<DependentAction>());
538 UnfoldingEvent e8(EventSet({&e6}), std::make_shared<DependentAction>());
539 UnfoldingEvent e9(EventSet({&e8}), std::make_shared<IndependentAction>());
540 UnfoldingEvent e10(EventSet({&e4}), std::make_shared<DependentAction>());
542 REQUIRE(e2.immediately_conflicts_with(&e3));
543 REQUIRE(e3.immediately_conflicts_with(&e4));
544 REQUIRE(e2.immediately_conflicts_with(&e4));
546 REQUIRE(e2.conflicts_with(&e10));
547 REQUIRE(e3.conflicts_with(&e10));
548 REQUIRE(e7.conflicts_with(&e8));
549 REQUIRE_FALSE(e2.immediately_conflicts_with(&e10));
550 REQUIRE_FALSE(e3.immediately_conflicts_with(&e10));
551 REQUIRE_FALSE(e7.immediately_conflicts_with(&e8));