diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2024-07-24 10:44:13 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2024-07-24 10:44:13 +0200 |
| commit | 3f5499cebc06356ed99159be3fb9676292cf7b8b (patch) | |
| tree | 63d36c3cd33de5746b8e3a29922e6ab7a6578def /domain/tests/participant.cpp | |
| parent | 0d61f98434b95c754f46c918af5152eda82077cb (diff) | |
| download | turns-3f5499cebc06356ed99159be3fb9676292cf7b8b.tar.xz turns-3f5499cebc06356ed99159be3fb9676292cf7b8b.zip | |
turns: rename domain to core
Diffstat (limited to 'domain/tests/participant.cpp')
| -rw-r--r-- | domain/tests/participant.cpp | 113 |
1 files changed, 0 insertions, 113 deletions
diff --git a/domain/tests/participant.cpp b/domain/tests/participant.cpp deleted file mode 100644 index e4e185c..0000000 --- a/domain/tests/participant.cpp +++ /dev/null @@ -1,113 +0,0 @@ -#include "turns/domain/participant.hpp" -#include "turns/domain/disposition.hpp" - -#include <catch2/catch_test_macros.hpp> - -#include <compare> - -#include <glibmm/init.h> - -namespace turns::domain::tests -{ - - TEST_CASE("A freshly constructed participant") - { - auto constexpr constructed_name = "Vana Thistletop"; - auto constexpr constructed_priority = 17; - auto constexpr constructed_disposition = disposition::friendly; - auto instance = participant{constructed_name, constructed_priority, constructed_disposition}; - - SECTION("can be created") - { - REQUIRE(participant::create(constructed_name, constructed_priority, constructed_disposition)); - } - - SECTION("allows access to its disposition") - { - SECTION("allowing to get it") - { - REQUIRE(instance.disposition() == constructed_disposition); - } - - SECTION("allowing to get it via a constant object") - { - auto const & cref = instance; - REQUIRE(cref.disposition() == constructed_disposition); - } - - SECTION("allowing to set it") - { - instance.disposition() = disposition::hostile; - REQUIRE(instance.disposition() == disposition::hostile); - } - } - - SECTION("allows access to its name") - { - SECTION("allowing to get it") - { - REQUIRE(instance.name() == constructed_name); - } - - SECTION("allowing to get it via a constant object") - { - auto const & cref = instance; - REQUIRE(cref.name() == constructed_name); - } - - SECTION("allowing to set it") - { - instance.name() = "replaced"; - REQUIRE(instance.name() == "replaced"); - } - } - - SECTION("allows access to its priority") - { - SECTION("allowing to get it") - { - REQUIRE(instance.priority() == constructed_priority); - } - - SECTION("allowing to get it via a constant object") - { - auto const & cref = instance; - REQUIRE(cref.priority() == constructed_priority); - } - - SECTION("allowing to set it") - { - instance.priority() = 4; - REQUIRE(instance.priority() == 4); - } - } - - SECTION("can be compared with another participant") - { - auto equivalent_instance = participant{"Equivalent", constructed_priority, constructed_disposition}; - auto lesser_instance = participant{"Lesser", constructed_priority - 1, constructed_disposition}; - auto greater_instance = participant{"Greater", constructed_priority + 1, constructed_disposition}; - - SECTION("yielding std::partial_ordering::equivalent for itself") - { - REQUIRE((instance <=> equivalent_instance) == std::partial_ordering::equivalent); - } - - SECTION("yielding std::partial_ordering::equivalent for an equivalent participant") - { - REQUIRE((instance <=> equivalent_instance) == std::partial_ordering::equivalent); - } - - SECTION("yielding std::partial_ordering::greater for a lesser participant") - { - REQUIRE((instance <=> lesser_instance) == std::partial_ordering::greater); - } - - SECTION("yielding std::partial_ordering::less for a greater participant") - { - REQUIRE((instance <=> greater_instance) == std::partial_ordering::less); - } - } - } - -} // namespace turns::domain::tests
\ No newline at end of file |
