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/Unfolding.hpp"
8 #include "src/mc/explo/udpor/udpor_tests_private.hpp"
10 using namespace simgrid::mc::udpor;
12 TEST_CASE("simgrid::mc::udpor::Unfolding: Creating an unfolding")
15 REQUIRE(unfolding.size() == 0);
16 REQUIRE(unfolding.empty());
19 TEST_CASE("simgrid::mc::udpor::Unfolding: Inserting and removing events with an unfolding")
22 auto e1 = std::make_unique<UnfoldingEvent>();
23 auto e2 = std::make_unique<UnfoldingEvent>();
24 const auto e1_handle = e1.get();
25 const auto e2_handle = e2.get();
27 unfolding.insert(std::move(e1));
28 REQUIRE(unfolding.size() == 1);
29 REQUIRE_FALSE(unfolding.empty());
31 unfolding.insert(std::move(e2));
32 REQUIRE(unfolding.size() == 2);
33 REQUIRE_FALSE(unfolding.empty());
35 unfolding.remove(e1_handle);
36 REQUIRE(unfolding.size() == 1);
37 REQUIRE_FALSE(unfolding.empty());
39 unfolding.remove(e2_handle);
40 REQUIRE(unfolding.size() == 0);
41 REQUIRE(unfolding.empty());
44 TEST_CASE("simgrid::mc::udpor::Unfolding: Checking for semantically equivalent events")
47 auto e1 = std::make_unique<UnfoldingEvent>(EventSet(), std::make_shared<IndependentAction>());
48 auto e2 = std::make_unique<UnfoldingEvent>(EventSet(), std::make_shared<IndependentAction>());
50 // e1 and e2 are semantically equivalent