Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'operation-plugin' into 'master'
[simgrid.git] / src / mc / explo / udpor / Unfolding_test.cpp
index 3f004e45009a0134a1d0666f238560eb7c50ab89..30e1529267e4ec9726d0f3a19cde28c078c38d69 100644 (file)
@@ -5,12 +5,43 @@
 
 #include "src/3rd-party/catch.hpp"
 #include "src/mc/explo/udpor/Unfolding.hpp"
+#include "src/mc/explo/udpor/udpor_tests_private.hpp"
+
+using namespace simgrid::mc;
+using namespace simgrid::mc::udpor;
 
 TEST_CASE("simgrid::mc::udpor::Unfolding: Creating an unfolding")
 {
-  using namespace simgrid::mc::udpor;
-
   Unfolding unfolding;
-  CHECK(unfolding.empty());
   REQUIRE(unfolding.size() == 0);
-}
\ No newline at end of file
+  REQUIRE(unfolding.empty());
+}
+
+TEST_CASE("simgrid::mc::udpor::Unfolding: Inserting and marking events with an unfolding")
+{
+  Unfolding unfolding;
+  auto e1 = std::make_unique<UnfoldingEvent>(
+      EventSet(), std::make_shared<ConditionallyDependentAction>(Transition::Type::UNKNOWN, 0));
+  auto e2 =
+      std::make_unique<UnfoldingEvent>(EventSet(), std::make_shared<DependentAction>(Transition::Type::UNKNOWN, 1));
+  const auto e1_handle = e1.get();
+  const auto e2_handle = e2.get();
+
+  unfolding.insert(std::move(e1));
+  REQUIRE(unfolding.size() == 1);
+  REQUIRE_FALSE(unfolding.empty());
+
+  unfolding.insert(std::move(e2));
+  REQUIRE(unfolding.size() == 2);
+  REQUIRE_FALSE(unfolding.empty());
+
+  unfolding.mark_finished(e1_handle);
+  REQUIRE(unfolding.size() == 2);
+  REQUIRE_FALSE(unfolding.empty());
+
+  unfolding.mark_finished(e2_handle);
+  REQUIRE(unfolding.size() == 2);
+  REQUIRE_FALSE(unfolding.empty());
+}
+
+TEST_CASE("simgrid::mc::udpor::Unfolding: Checking all immediate conflicts restricted to an unfolding") {}
\ No newline at end of file