Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Rename `remove()` method on `Unfolding`
authorMaxwell Pirtle <maxwellpirtle@gmail.com>
Thu, 6 Apr 2023 11:52:50 +0000 (13:52 +0200)
committerMaxwell Pirtle <maxwellpirtle@gmail.com>
Thu, 6 Apr 2023 11:52:50 +0000 (13:52 +0200)
Since the events aren't ever removed from the
Unfolding and are instead simply displaced,
we change the name of the method to better
reflect what is going on

src/mc/explo/UdporChecker.cpp
src/mc/explo/udpor/Unfolding.cpp
src/mc/explo/udpor/Unfolding.hpp
src/mc/explo/udpor/Unfolding_test.cpp

index f62abea..b297183 100644 (file)
@@ -314,7 +314,7 @@ void UdporChecker::clean_up_explore(const UnfoldingEvent* e, const Configuration
   // that UDPOR has marked as no longer being important)
   // For now, there appear to be no "obvious" issues (although
   // UDPOR's behavior is often far from obvious...)
-  this->unfolding.remove(clean_up_set);
+  this->unfolding.mark_finished(clean_up_set);
 }
 
 RecordTrace UdporChecker::get_record_trace()
index ebccf35..421217e 100644 (file)
@@ -9,14 +9,14 @@
 
 namespace simgrid::mc::udpor {
 
-void Unfolding::remove(const EventSet& events)
+void Unfolding::mark_finished(const EventSet& events)
 {
   for (const auto e : events) {
-    remove(e);
+    mark_finished(e);
   }
 }
 
-void Unfolding::remove(const UnfoldingEvent* e)
+void Unfolding::mark_finished(const UnfoldingEvent* e)
 {
   if (e == nullptr) {
     throw std::invalid_argument("Expected a non-null pointer to an event, but received NULL");
index e3c05c0..140c893 100644 (file)
@@ -28,8 +28,17 @@ public:
   size_t size() const { return this->event_handles.size(); }
   bool empty() const { return this->event_handles.empty(); }
 
-  void remove(const UnfoldingEvent* e);
-  void remove(const EventSet& events);
+  /**
+   * @brief Moves an event from UDPOR's global set `U` to
+   * the global set `G`
+   */
+  void mark_finished(const UnfoldingEvent* e);
+
+  /**
+   * @brief Moves all events in a set from UDPOR's global
+   * set `U` to the global set `G`
+   */
+  void mark_finished(const EventSet& events);
 
   /// @brief Adds a new event `e` to the Unfolding if that
   /// event is not equivalent to any of those already contained
index 1b60375..30e1529 100644 (file)
@@ -17,7 +17,7 @@ TEST_CASE("simgrid::mc::udpor::Unfolding: Creating an unfolding")
   REQUIRE(unfolding.empty());
 }
 
-TEST_CASE("simgrid::mc::udpor::Unfolding: Inserting and removing events with an unfolding")
+TEST_CASE("simgrid::mc::udpor::Unfolding: Inserting and marking events with an unfolding")
 {
   Unfolding unfolding;
   auto e1 = std::make_unique<UnfoldingEvent>(
@@ -35,13 +35,13 @@ TEST_CASE("simgrid::mc::udpor::Unfolding: Inserting and removing events with an
   REQUIRE(unfolding.size() == 2);
   REQUIRE_FALSE(unfolding.empty());
 
-  unfolding.remove(e1_handle);
-  REQUIRE(unfolding.size() == 1);
+  unfolding.mark_finished(e1_handle);
+  REQUIRE(unfolding.size() == 2);
   REQUIRE_FALSE(unfolding.empty());
 
-  unfolding.remove(e2_handle);
-  REQUIRE(unfolding.size() == 0);
-  REQUIRE(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