13#include <doctest/doctest.h>
18using namespace manifolds;
19using namespace move_tracker;
21SCENARIO(
"MoveTracker special members" * doctest::test_suite(
"move_tracker"))
23 spdlog::debug(
"MoveTracker special members.\n");
24 GIVEN(
"A MoveTracker.")
26 WHEN(
"It's properties are examined.")
28 THEN(
"It is no-throw destructible.")
31 spdlog::debug(
"It is no-throw destructible.\n");
33 THEN(
"It is no-throw default constructible.")
36 spdlog::debug(
"It is no-throw default constructible.\n");
38 THEN(
"It is copy constructible.")
41 spdlog::debug(
"It is copy constructible.\n");
43 THEN(
"It is copy assignable.")
46 spdlog::debug(
"It is copy assignable.\n");
48 THEN(
"It is no-throw move constructible.")
51 spdlog::debug(
"Small function optimization supported.");
52 spdlog::debug(
"It is no-throw move constructible.\n");
54 THEN(
"It is no-throw move assignable.")
57 spdlog::debug(
"It is no-throw move assignable.\n");
59 THEN(
"It is no-throw swappable")
62 spdlog::debug(
"It is no-throw swappable.\n");
68SCENARIO(
"Move type to integer conversion" *
69 doctest::test_suite(
"move_tracker"))
71 spdlog::debug(
"Move type to integer conversion.\n");
74 auto move23 = move_type::TWO_THREE;
76 auto move32 = move_type::THREE_TWO;
78 auto move26 = move_type::TWO_SIX;
80 auto move62 = move_type::SIX_TWO;
82 auto move44 = move_type::FOUR_FOUR;
87SCENARIO(
"Integer to move type conversion" *
88 doctest::test_suite(
"move_tracker"))
90 spdlog::debug(
"Integer to move type conversion.\n");
94 REQUIRE_EQ(
as_move(move_choice), move_type::TWO_THREE);
96 REQUIRE_EQ(
as_move(move_choice), move_type::THREE_TWO);
98 REQUIRE_EQ(
as_move(move_choice), move_type::TWO_SIX);
100 REQUIRE_EQ(
as_move(move_choice), move_type::SIX_TWO);
102 REQUIRE_EQ(
as_move(move_choice), move_type::FOUR_FOUR);
106SCENARIO(
"MoveTracker functionality" * doctest::test_suite(
"move_tracker"))
108 spdlog::debug(
"MoveTracker functionality.\n");
109 GIVEN(
"A 3D Move_tracker.")
112 THEN(
"There are the correct number of elements.")
114 REQUIRE_EQ(tracked_moves.
size(), NUMBER_OF_3D_MOVES);
116 THEN(
"Each element is zero-initialized.")
118 REQUIRE_EQ(tracked_moves.
total(), 0);
120 THEN(
"Moves can be added.")
129 for (
auto move : tracked_moves.
moves_view()) { REQUIRE_EQ(move, 1); }
131 THEN(
"Two move trackers can be added.")
146 tracked_moves += added_moves;
149 for (
auto move : tracked_moves.
moves_view()) { REQUIRE_EQ(move, 3); }
152 GIVEN(
"A 4D Move_tracker.")
155 THEN(
"There are the correct number of elements.")
157 REQUIRE_EQ(tracked_moves.
size(), NUMBER_OF_4D_MOVES);
159 THEN(
"Each element is zero-initialized.")
161 REQUIRE_EQ(tracked_moves.
total(), 0);
163 THEN(
"Moves can be added.")
173 for (
auto move : tracked_moves.
moves_view()) { REQUIRE_EQ(move, 1); }
175 THEN(
"Two move trackers can be added.")
194 tracked_moves += added_moves;
197 for (
auto move : tracked_moves.
moves_view()) { REQUIRE_EQ(move, 3); }
Data structures for manifolds.
auto as_integer(Enumeration value) -> std::underlying_type_t< Enumeration >
Convert enum to integer.
auto as_move(int const move_choice) -> move_type
Convert integer to move_type.
SCENARIO("Perform bistellar flip on Delaunay triangulation" *doctest::test_suite("bistellar"))
The data and methods to track ergodic moves.
auto two_six_moves() -> auto &
Write access to (2,6) moves.
auto three_three_moves() -> auto &
Write access to (3,3) moves.
auto two_eight_moves() -> auto &
Write access to (2,8) moves.
auto two_four_moves() -> auto &
Write access to (2,4) moves.
auto size() const noexcept
Container size.
auto four_six_moves() -> auto &
Write access to (4,6) moves.
auto four_two_moves() -> auto &
Write access to (4,2) moves.
auto total() const noexcept
Total moves.
auto moves_view() const
Get a view of the moves.
auto four_four_moves() -> auto &
Write access to (4,4) moves.
auto six_four_moves() -> auto &
Write access to (6,4) moves.
auto eight_two_moves() -> auto &
Write access to (8,2) moves.
auto six_two_moves() -> auto &
Write access to (6,2) moves.
auto three_two_moves() -> auto &
Write access to (3,2) moves.
auto two_three_moves() -> auto &
Write access to (2,3) moves.