Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'udpor-phase6' into 'master'
[simgrid.git] / src / mc / explo / udpor / Unfolding_test.cpp
index 4e6f627..d75fb28 100644 (file)
@@ -5,7 +5,9 @@
 
 #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")
@@ -18,10 +20,10 @@ TEST_CASE("simgrid::mc::udpor::Unfolding: Creating an unfolding")
 TEST_CASE("simgrid::mc::udpor::Unfolding: Inserting and removing events with an unfolding")
 {
   Unfolding unfolding;
-  auto e1        = std::make_unique<UnfoldingEvent>();
-  auto e2        = std::make_unique<UnfoldingEvent>();
-  auto e1_handle = e1.get();
-  auto e2_handle = e2.get();
+  auto e1              = std::make_unique<UnfoldingEvent>();
+  auto e2              = std::make_unique<UnfoldingEvent>();
+  const auto e1_handle = e1.get();
+  const auto e2_handle = e2.get();
 
   unfolding.insert(std::move(e1));
   REQUIRE(unfolding.size() == 1);
@@ -38,4 +40,25 @@ TEST_CASE("simgrid::mc::udpor::Unfolding: Inserting and removing events with an
   unfolding.remove(e2_handle);
   REQUIRE(unfolding.size() == 0);
   REQUIRE(unfolding.empty());
-}
\ No newline at end of file
+}
+
+TEST_CASE("simgrid::mc::udpor::Unfolding: Checking for semantically equivalent events")
+{
+  Unfolding unfolding;
+  auto e1 = std::make_unique<UnfoldingEvent>(
+      EventSet(), std::make_shared<IndependentAction>(Transition::Type::BARRIER_ASYNC_LOCK, 6, 2));
+  auto e2 = std::make_unique<UnfoldingEvent>(
+      EventSet(), std::make_shared<IndependentAction>(Transition::Type::BARRIER_ASYNC_LOCK, 6, 2));
+
+  // e1 and e2 are equivalent
+  REQUIRE(*e1 == *e2);
+
+  const auto e1_handle = e1.get();
+  const auto e2_handle = e2.get();
+  unfolding.insert(std::move(e1));
+
+  REQUIRE(unfolding.contains_event_equivalent_to(e1_handle));
+  REQUIRE(unfolding.contains_event_equivalent_to(e2_handle));
+}
+
+TEST_CASE("simgrid::mc::udpor::Unfolding: Checking all immediate conflicts restricted to an unfolding") {}
\ No newline at end of file