Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
2e906cc9bc9006afbdc1df7129e8253367b109c9
[simgrid.git] / src / mc / explo / udpor / Unfolding_test.cpp
1 /* Copyright (c) 2017-2023. The SimGrid Team. All rights reserved.               */
2
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. */
5
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"
9
10 using namespace simgrid::mc;
11 using namespace simgrid::mc::udpor;
12
13 TEST_CASE("simgrid::mc::udpor::Unfolding: Creating an unfolding")
14 {
15   Unfolding unfolding;
16   REQUIRE(unfolding.size() == 0);
17   REQUIRE(unfolding.empty());
18 }
19
20 TEST_CASE("simgrid::mc::udpor::Unfolding: Inserting and marking events with an unfolding")
21 {
22   Unfolding unfolding;
23   auto e1 = std::make_unique<UnfoldingEvent>(
24       EventSet(), std::make_shared<ConditionallyDependentAction>(Transition::Type::UNKNOWN, 0));
25   auto e2 =
26       std::make_unique<UnfoldingEvent>(EventSet(), std::make_shared<DependentAction>(Transition::Type::UNKNOWN, 1));
27   auto* e1_handle = e1.get();
28   auto* e2_handle = e2.get();
29
30   unfolding.insert(std::move(e1));
31   REQUIRE(unfolding.size() == 1);
32   REQUIRE_FALSE(unfolding.empty());
33
34   unfolding.insert(std::move(e2));
35   REQUIRE(unfolding.size() == 2);
36   REQUIRE_FALSE(unfolding.empty());
37
38   unfolding.mark_finished(e1_handle);
39   REQUIRE(unfolding.size() == 2);
40   REQUIRE_FALSE(unfolding.empty());
41
42   unfolding.mark_finished(e2_handle);
43   REQUIRE(unfolding.size() == 2);
44   REQUIRE_FALSE(unfolding.empty());
45 }
46
47 TEST_CASE("simgrid::mc::udpor::Unfolding: Checking all immediate conflicts restricted to an unfolding") {}