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>(0));
123 UnfoldingEvent e2(EventSet({&e1}), std::make_shared<DependentAction>(0));
124 UnfoldingEvent e3(EventSet({&e2}), std::make_shared<IndependentAction>(0));
125 UnfoldingEvent e4(EventSet({&e3}), std::make_shared<ConditionallyDependentAction>(1));
126 UnfoldingEvent e5(EventSet({&e3}), std::make_shared<DependentAction>(1));
127 UnfoldingEvent e6(EventSet({&e1}), std::make_shared<ConditionallyDependentAction>(2));
128 UnfoldingEvent e7(EventSet({&e6, &e2}), std::make_shared<ConditionallyDependentAction>(3));
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("Testing with no dependencies whatsoever")
185 // The following tests concern the given event structure:
193 UnfoldingEvent e1(EventSet(), std::make_shared<IndependentAction>(0));
194 UnfoldingEvent e2(EventSet({&e1}), std::make_shared<IndependentAction>(1));
195 UnfoldingEvent e3(EventSet({&e2}), std::make_shared<IndependentAction>(2));
196 UnfoldingEvent e4(EventSet({&e3}), std::make_shared<IndependentAction>(3));
197 UnfoldingEvent e5(EventSet({&e3}), std::make_shared<IndependentAction>(4));
198 UnfoldingEvent e6(EventSet({&e1}), std::make_shared<IndependentAction>(5));
199 UnfoldingEvent e7(EventSet({&e6, &e2}), std::make_shared<IndependentAction>(6));
201 // Since everyone's actions are independent of one another, we expect
202 // that there are no conflicts between each pair of events (except with
203 // the same event itself)
204 SECTION("Mutual dependencies")
206 CHECK(e1.is_dependent_with(&e1));
207 CHECK_FALSE(e1.is_dependent_with(&e2));
208 CHECK_FALSE(e1.is_dependent_with(&e3));
209 CHECK_FALSE(e1.is_dependent_with(&e4));
210 CHECK_FALSE(e1.is_dependent_with(&e5));
211 CHECK_FALSE(e1.is_dependent_with(&e6));
212 CHECK_FALSE(e1.is_dependent_with(&e7));
214 CHECK(e2.is_dependent_with(&e2));
215 CHECK_FALSE(e2.is_dependent_with(&e3));
216 CHECK_FALSE(e2.is_dependent_with(&e4));
217 CHECK_FALSE(e2.is_dependent_with(&e5));
218 CHECK_FALSE(e2.is_dependent_with(&e6));
219 CHECK_FALSE(e2.is_dependent_with(&e7));
221 CHECK(e3.is_dependent_with(&e3));
222 CHECK_FALSE(e3.is_dependent_with(&e4));
223 CHECK_FALSE(e3.is_dependent_with(&e5));
224 CHECK_FALSE(e3.is_dependent_with(&e6));
225 CHECK_FALSE(e3.is_dependent_with(&e7));
227 CHECK(e4.is_dependent_with(&e4));
228 CHECK_FALSE(e4.is_dependent_with(&e5));
229 CHECK_FALSE(e4.is_dependent_with(&e6));
230 CHECK_FALSE(e4.is_dependent_with(&e7));
232 CHECK(e5.is_dependent_with(&e5));
233 CHECK_FALSE(e5.is_dependent_with(&e6));
234 CHECK_FALSE(e5.is_dependent_with(&e7));
236 CHECK(e6.is_dependent_with(&e6));
237 CHECK_FALSE(e6.is_dependent_with(&e7));
239 CHECK(e7.is_dependent_with(&e7));
242 SECTION("Mutual conflicts")
244 CHECK_FALSE(e1.conflicts_with(&e1));
245 CHECK_FALSE(e1.conflicts_with(&e2));
246 CHECK_FALSE(e1.conflicts_with(&e3));
247 CHECK_FALSE(e1.conflicts_with(&e4));
248 CHECK_FALSE(e1.conflicts_with(&e5));
249 CHECK_FALSE(e1.conflicts_with(&e6));
250 CHECK_FALSE(e1.conflicts_with(&e7));
252 CHECK_FALSE(e2.conflicts_with(&e1));
253 CHECK_FALSE(e2.conflicts_with(&e2));
254 CHECK_FALSE(e2.conflicts_with(&e3));
255 CHECK_FALSE(e2.conflicts_with(&e4));
256 CHECK_FALSE(e2.conflicts_with(&e5));
257 CHECK_FALSE(e2.conflicts_with(&e6));
258 CHECK_FALSE(e2.conflicts_with(&e7));
260 CHECK_FALSE(e3.conflicts_with(&e1));
261 CHECK_FALSE(e3.conflicts_with(&e2));
262 CHECK_FALSE(e3.conflicts_with(&e3));
263 CHECK_FALSE(e3.conflicts_with(&e4));
264 CHECK_FALSE(e3.conflicts_with(&e5));
265 CHECK_FALSE(e3.conflicts_with(&e6));
266 CHECK_FALSE(e3.conflicts_with(&e7));
268 CHECK_FALSE(e4.conflicts_with(&e1));
269 CHECK_FALSE(e4.conflicts_with(&e2));
270 CHECK_FALSE(e4.conflicts_with(&e3));
271 CHECK_FALSE(e4.conflicts_with(&e4));
272 CHECK_FALSE(e4.conflicts_with(&e5));
273 CHECK_FALSE(e4.conflicts_with(&e6));
274 CHECK_FALSE(e4.conflicts_with(&e7));
276 CHECK_FALSE(e5.conflicts_with(&e1));
277 CHECK_FALSE(e5.conflicts_with(&e2));
278 CHECK_FALSE(e5.conflicts_with(&e3));
279 CHECK_FALSE(e5.conflicts_with(&e4));
280 CHECK_FALSE(e5.conflicts_with(&e5));
281 CHECK_FALSE(e5.conflicts_with(&e6));
282 CHECK_FALSE(e5.conflicts_with(&e7));
284 CHECK_FALSE(e6.conflicts_with(&e1));
285 CHECK_FALSE(e6.conflicts_with(&e2));
286 CHECK_FALSE(e6.conflicts_with(&e3));
287 CHECK_FALSE(e6.conflicts_with(&e4));
288 CHECK_FALSE(e6.conflicts_with(&e5));
289 CHECK_FALSE(e6.conflicts_with(&e6));
290 CHECK_FALSE(e6.conflicts_with(&e7));
292 CHECK_FALSE(e7.conflicts_with(&e1));
293 CHECK_FALSE(e7.conflicts_with(&e2));
294 CHECK_FALSE(e7.conflicts_with(&e3));
295 CHECK_FALSE(e7.conflicts_with(&e4));
296 CHECK_FALSE(e7.conflicts_with(&e5));
297 CHECK_FALSE(e7.conflicts_with(&e6));
298 CHECK_FALSE(e7.conflicts_with(&e7));
302 SECTION("Testing with some conflicts")
304 // The following tests concern the given event structure:
312 UnfoldingEvent e1(EventSet(), std::make_shared<DependentAction>(0));
313 UnfoldingEvent e2(EventSet({&e1}), std::make_shared<DependentAction>(1));
314 UnfoldingEvent e3(EventSet({&e2}), std::make_shared<IndependentAction>(2));
315 UnfoldingEvent e4(EventSet({&e3}), std::make_shared<IndependentAction>(3));
316 UnfoldingEvent e5(EventSet({&e3}), std::make_shared<IndependentAction>(4));
317 UnfoldingEvent e6(EventSet({&e1}), std::make_shared<IndependentAction>(5));
318 UnfoldingEvent e7(EventSet({&e6, &e2}), std::make_shared<ConditionallyDependentAction>(6));
320 // Since everyone's actions are independent of one another, we expect
321 // that there are no conflicts between each pair of events (except the pair
322 // with the event and itself)
323 SECTION("Mutual dependencies")
325 CHECK(e1.is_dependent_with(&e1));
326 CHECK(e1.is_dependent_with(&e2));
327 CHECK_FALSE(e1.is_dependent_with(&e3));
328 CHECK_FALSE(e1.is_dependent_with(&e4));
329 CHECK_FALSE(e1.is_dependent_with(&e5));
330 CHECK_FALSE(e1.is_dependent_with(&e6));
331 CHECK(e1.is_dependent_with(&e7));
333 CHECK(e2.is_dependent_with(&e2));
334 CHECK_FALSE(e2.is_dependent_with(&e3));
335 CHECK_FALSE(e2.is_dependent_with(&e4));
336 CHECK_FALSE(e2.is_dependent_with(&e5));
337 CHECK_FALSE(e2.is_dependent_with(&e6));
338 CHECK(e2.is_dependent_with(&e7));
340 CHECK(e3.is_dependent_with(&e3));
341 CHECK_FALSE(e3.is_dependent_with(&e4));
342 CHECK_FALSE(e3.is_dependent_with(&e5));
343 CHECK_FALSE(e3.is_dependent_with(&e6));
344 CHECK_FALSE(e3.is_dependent_with(&e7));
346 CHECK(e4.is_dependent_with(&e4));
347 CHECK_FALSE(e4.is_dependent_with(&e5));
348 CHECK_FALSE(e4.is_dependent_with(&e6));
349 CHECK_FALSE(e4.is_dependent_with(&e7));
351 CHECK(e5.is_dependent_with(&e5));
352 CHECK_FALSE(e5.is_dependent_with(&e6));
353 CHECK_FALSE(e5.is_dependent_with(&e7));
355 CHECK(e6.is_dependent_with(&e6));
356 CHECK_FALSE(e6.is_dependent_with(&e7));
358 CHECK(e7.is_dependent_with(&e7));
361 SECTION("Mutual conflicts")
363 // Although e1 is dependent with e1, e2, and e7,
364 // since they are related to one another, they are not
365 // considered to be in conflict
366 CHECK_FALSE(e1.conflicts_with(&e1));
367 CHECK_FALSE(e1.conflicts_with(&e2));
368 CHECK_FALSE(e1.conflicts_with(&e3));
369 CHECK_FALSE(e1.conflicts_with(&e4));
370 CHECK_FALSE(e1.conflicts_with(&e5));
371 CHECK_FALSE(e1.conflicts_with(&e6));
372 CHECK_FALSE(e1.conflicts_with(&e7));
374 // Same goes for e2 with e2 and e7
375 CHECK_FALSE(e2.conflicts_with(&e1));
376 CHECK_FALSE(e2.conflicts_with(&e2));
377 CHECK_FALSE(e2.conflicts_with(&e3));
378 CHECK_FALSE(e2.conflicts_with(&e4));
379 CHECK_FALSE(e2.conflicts_with(&e5));
380 CHECK_FALSE(e2.conflicts_with(&e6));
381 CHECK_FALSE(e2.conflicts_with(&e7));
383 CHECK_FALSE(e3.conflicts_with(&e1));
384 CHECK_FALSE(e3.conflicts_with(&e2));
385 CHECK_FALSE(e3.conflicts_with(&e3));
386 CHECK_FALSE(e3.conflicts_with(&e4));
387 CHECK_FALSE(e3.conflicts_with(&e5));
388 CHECK_FALSE(e3.conflicts_with(&e6));
389 CHECK_FALSE(e3.conflicts_with(&e7));
391 CHECK_FALSE(e4.conflicts_with(&e1));
392 CHECK_FALSE(e4.conflicts_with(&e2));
393 CHECK_FALSE(e4.conflicts_with(&e3));
394 CHECK_FALSE(e4.conflicts_with(&e4));
395 CHECK_FALSE(e4.conflicts_with(&e5));
396 CHECK_FALSE(e4.conflicts_with(&e6));
397 CHECK_FALSE(e4.conflicts_with(&e7));
399 CHECK_FALSE(e5.conflicts_with(&e1));
400 CHECK_FALSE(e5.conflicts_with(&e2));
401 CHECK_FALSE(e5.conflicts_with(&e3));
402 CHECK_FALSE(e5.conflicts_with(&e4));
403 CHECK_FALSE(e5.conflicts_with(&e5));
404 CHECK_FALSE(e5.conflicts_with(&e6));
405 CHECK_FALSE(e5.conflicts_with(&e7));
407 CHECK_FALSE(e6.conflicts_with(&e1));
408 CHECK_FALSE(e6.conflicts_with(&e2));
409 CHECK_FALSE(e6.conflicts_with(&e3));
410 CHECK_FALSE(e6.conflicts_with(&e4));
411 CHECK_FALSE(e6.conflicts_with(&e5));
412 CHECK_FALSE(e6.conflicts_with(&e6));
413 CHECK_FALSE(e6.conflicts_with(&e7));
415 CHECK_FALSE(e7.conflicts_with(&e1));
416 CHECK_FALSE(e7.conflicts_with(&e2));
417 CHECK_FALSE(e7.conflicts_with(&e3));
418 CHECK_FALSE(e7.conflicts_with(&e4));
419 CHECK_FALSE(e7.conflicts_with(&e5));
420 CHECK_FALSE(e7.conflicts_with(&e6));
421 CHECK_FALSE(e7.conflicts_with(&e7));
425 SECTION("More complicated conflicts")
427 // The following tests concern the given event structure:
435 UnfoldingEvent e1(EventSet(), std::make_shared<IndependentAction>(0));
436 UnfoldingEvent e2(EventSet({&e1}), std::make_shared<ConditionallyDependentAction>(1));
437 UnfoldingEvent e3(EventSet({&e2}), std::make_shared<IndependentAction>(2));
438 UnfoldingEvent e4(EventSet({&e3}), std::make_shared<IndependentAction>(3));
439 UnfoldingEvent e5(EventSet({&e3}), std::make_shared<IndependentAction>(4));
440 UnfoldingEvent e6(EventSet({&e1}), std::make_shared<DependentAction>(5));
441 UnfoldingEvent e7(EventSet({&e6}), std::make_shared<IndependentAction>(6));
443 CHECK_FALSE(e1.conflicts_with(&e1));
444 CHECK_FALSE(e1.conflicts_with(&e2));
445 CHECK_FALSE(e1.conflicts_with(&e3));
446 CHECK_FALSE(e1.conflicts_with(&e4));
447 CHECK_FALSE(e1.conflicts_with(&e5));
448 CHECK_FALSE(e1.conflicts_with(&e6));
449 CHECK_FALSE(e1.conflicts_with(&e7));
451 // e2 conflicts with e6. Since e6 < e7,
452 // e2 also conflicts with e7
453 CHECK_FALSE(e2.conflicts_with(&e1));
454 CHECK_FALSE(e2.conflicts_with(&e2));
455 CHECK_FALSE(e2.conflicts_with(&e3));
456 CHECK_FALSE(e2.conflicts_with(&e4));
457 CHECK_FALSE(e2.conflicts_with(&e5));
458 CHECK(e2.conflicts_with(&e6));
459 REQUIRE(e2.conflicts_with(&e7));
461 // e3 and e6 are dependent and unrelated, so they conflict
462 CHECK_FALSE(e3.conflicts_with(&e1));
463 CHECK_FALSE(e3.conflicts_with(&e2));
464 CHECK_FALSE(e3.conflicts_with(&e3));
465 CHECK_FALSE(e3.conflicts_with(&e4));
466 CHECK_FALSE(e3.conflicts_with(&e5));
467 CHECK(e3.conflicts_with(&e6));
468 CHECK_FALSE(e3.conflicts_with(&e7));
470 // Since e3 and e6 conflict and e3 < e4, e4 and e6 conflict
471 CHECK_FALSE(e4.conflicts_with(&e1));
472 CHECK_FALSE(e4.conflicts_with(&e2));
473 CHECK_FALSE(e4.conflicts_with(&e3));
474 CHECK_FALSE(e4.conflicts_with(&e4));
475 CHECK_FALSE(e4.conflicts_with(&e5));
476 CHECK(e4.conflicts_with(&e6));
477 CHECK_FALSE(e4.conflicts_with(&e7));
480 CHECK_FALSE(e5.conflicts_with(&e1));
481 CHECK_FALSE(e5.conflicts_with(&e2));
482 CHECK_FALSE(e5.conflicts_with(&e3));
483 CHECK_FALSE(e5.conflicts_with(&e4));
484 CHECK_FALSE(e5.conflicts_with(&e5));
485 CHECK(e5.conflicts_with(&e6));
486 CHECK_FALSE(e5.conflicts_with(&e7));
488 // Conflicts are symmetric
489 CHECK_FALSE(e6.conflicts_with(&e1));
490 CHECK(e6.conflicts_with(&e2));
491 CHECK(e6.conflicts_with(&e3));
492 CHECK(e6.conflicts_with(&e4));
493 CHECK(e6.conflicts_with(&e5));
494 CHECK_FALSE(e6.conflicts_with(&e6));
495 CHECK_FALSE(e6.conflicts_with(&e7));
497 CHECK_FALSE(e7.conflicts_with(&e1));
498 CHECK(e7.conflicts_with(&e2));
499 CHECK_FALSE(e7.conflicts_with(&e3));
500 CHECK_FALSE(e7.conflicts_with(&e4));
501 CHECK_FALSE(e7.conflicts_with(&e5));
502 CHECK_FALSE(e7.conflicts_with(&e6));
503 CHECK_FALSE(e7.conflicts_with(&e7));
507 TEST_CASE("simgrid::mc::udpor::UnfoldingEvent: Immediate Conflicts + Conflicts Stress Test")
509 // The following tests concern the given event structure:
522 // Immediate conflicts:
527 // NOTE: e7 + e8 ARE NOT in immediate conflict! The reason is that
528 // the set of events {e8, e6, e5, e3, e4, e1} is not a valid configuration,
529 // (nor is {e7, e6, e5, e3, e4, e1})
531 // NOTE: e2/e3 + e10 are NOT in immediate conflict! EVEN THOUGH {e1, e4, e10}
532 // is a valid configuration, {e1, e2/e3, e4} is not (since e2/e3 and e4 conflict)
533 UnfoldingEvent e1(EventSet(), std::make_shared<IndependentAction>());
534 UnfoldingEvent e2(EventSet({&e1}), std::make_shared<DependentAction>());
535 UnfoldingEvent e3(EventSet({&e1}), std::make_shared<DependentAction>());
536 UnfoldingEvent e4(EventSet({&e1}), std::make_shared<DependentAction>());
537 UnfoldingEvent e5(EventSet({&e3, &e4}), std::make_shared<IndependentAction>());
538 UnfoldingEvent e6(EventSet({&e5}), std::make_shared<IndependentAction>());
539 UnfoldingEvent e7(EventSet({&e6}), std::make_shared<DependentAction>());
540 UnfoldingEvent e8(EventSet({&e6}), std::make_shared<DependentAction>());
541 UnfoldingEvent e9(EventSet({&e8}), std::make_shared<IndependentAction>());
542 UnfoldingEvent e10(EventSet({&e4}), std::make_shared<DependentAction>());
544 REQUIRE(e2.immediately_conflicts_with(&e3));
545 REQUIRE(e3.immediately_conflicts_with(&e4));
546 REQUIRE(e2.immediately_conflicts_with(&e4));
548 REQUIRE(e2.conflicts_with(&e10));
549 REQUIRE(e3.conflicts_with(&e10));
550 REQUIRE(e7.conflicts_with(&e8));
551 REQUIRE_FALSE(e2.immediately_conflicts_with(&e10));
552 REQUIRE_FALSE(e3.immediately_conflicts_with(&e10));
553 REQUIRE_FALSE(e7.immediately_conflicts_with(&e8));