diff options
Diffstat (limited to 'domain/tests/participant.cpp')
| -rw-r--r-- | domain/tests/participant.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/domain/tests/participant.cpp b/domain/tests/participant.cpp index b7429aa..ee8af74 100644 --- a/domain/tests/participant.cpp +++ b/domain/tests/participant.cpp @@ -1,8 +1,11 @@ #include "turns/domain/participant.hpp" #include <catch2/catch_test_macros.hpp> + #include <glibmm/init.h> +#include <compare> + namespace turns::domain::tests { @@ -38,6 +41,33 @@ namespace turns::domain::tests instance->order(8); REQUIRE(instance->order() == 8); } + + SECTION("can be compared with another participant") + { + auto equivalent_instance = participant::create("Equivalent", constructed_order); + auto lesser_instance = participant::create("Lesser", constructed_order - 1); + auto greater_instance = participant::create("Greater", constructed_order + 1); + + 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 |
