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"
9 using namespace simgrid::mc::udpor;
11 TEST_CASE("simgrid::mc::udpor::Unfolding: Creating an unfolding")
14 REQUIRE(unfolding.size() == 0);
15 REQUIRE(unfolding.empty());
18 TEST_CASE("simgrid::mc::udpor::Unfolding: Inserting and removing events with an unfolding")
21 auto e1 = std::make_unique<UnfoldingEvent>();
22 auto e2 = std::make_unique<UnfoldingEvent>();
23 auto e1_handle = e1.get();
24 auto e2_handle = e2.get();
26 unfolding.insert(std::move(e1));
27 REQUIRE(unfolding.size() == 1);
28 REQUIRE_FALSE(unfolding.empty());
30 unfolding.insert(std::move(e2));
31 REQUIRE(unfolding.size() == 2);
32 REQUIRE_FALSE(unfolding.empty());
34 unfolding.remove(e1_handle);
35 REQUIRE(unfolding.size() == 1);
36 REQUIRE_FALSE(unfolding.empty());
38 unfolding.remove(e2_handle);
39 REQUIRE(unfolding.size() == 0);
40 REQUIRE(unfolding.empty());