From 05548fc3f3778abfb92cec35e98c09d00b4afd90 Mon Sep 17 00:00:00 2001 From: Maxwell Pirtle Date: Mon, 22 May 2023 11:03:48 +0200 Subject: [PATCH] Add detailed stress test for WakeupTree This commit introduces an edge case wherein a "different looking sequence" ultimately is already accounted for by a sequence contained in the tree that "eventually could be made to look like it" (viz. such that `~_E` holds between the two sequences). Other stress tests will be added for the other methods on the WakeupTree and the Execution to test their correctness. There is a long way to go --- src/mc/explo/odpor/WakeupTree_test.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/mc/explo/odpor/WakeupTree_test.cpp b/src/mc/explo/odpor/WakeupTree_test.cpp index 07ffb63f04..dc9e598e49 100644 --- a/src/mc/explo/odpor/WakeupTree_test.cpp +++ b/src/mc/explo/odpor/WakeupTree_test.cpp @@ -179,7 +179,7 @@ TEST_CASE("simgrid::mc::odpor::WakeupTree: Testing Insertion for Empty Execution test_tree_iterator(tree, std::vector{PartialExecution{a0}, PartialExecution{}}); } - SECTION("Stress test with multiple branch points") + SECTION("Stress test with multiple branch points: `~_E` with different looking sequences") { tree.insert(Execution(), {a0}); tree.insert(Execution(), {a2, a0}); @@ -189,6 +189,27 @@ TEST_CASE("simgrid::mc::odpor::WakeupTree: Testing Insertion for Empty Execution test_tree_iterator(tree, std::vector{PartialExecution{a0}, PartialExecution{a2, a0}, PartialExecution{a2, a3}, PartialExecution{a2, a5}, PartialExecution{a2}, PartialExecution{}}); + SECTION("Adding more stress") + { + // In this case, `a2` and `a1` can be interchanged with each other. + // Thus `a2.a1 == a1.a2`. Since there is already an interior node + // containing `a2`, we attempt to add the what remains (viz. `a1`) to the + // series. HOWEVER: we notice that `a2.a5` is "eventually equivalent to" + // (that is `~` with) `a1.a2` since `a2` is an initial of the latter and + // `a1` and `a5` are independent of each other + tree.insert(Execution(), {a1, a2}); + REQUIRE(tree.get_num_nodes() == 6); + test_tree_iterator(tree, std::vector{PartialExecution{a0}, PartialExecution{a2, a0}, + PartialExecution{a2, a3}, PartialExecution{a2, a5}, + PartialExecution{a2}, PartialExecution{}}); + + tree.insert(Execution(), {a3, a0}); + REQUIRE(tree.get_num_nodes() == 8); + test_tree_iterator(tree, std::vector{PartialExecution{a0}, PartialExecution{a2, a0}, + PartialExecution{a2, a3}, PartialExecution{a2, a5}, + PartialExecution{a2}, PartialExecution{a3, a0}, + PartialExecution{a3}, PartialExecution{}}); + } } } } -- 2.20.1