diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2024-07-15 22:36:48 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2024-07-15 22:36:48 +0200 |
| commit | 18795a59e98f2496ab7bb8705f96fa1a4d08ccba (patch) | |
| tree | bb1392f394030d5a7b9ef4eea9ac473fd8729136 | |
| parent | 3262b3a337759439f3049b9299be12baf8420750 (diff) | |
| download | turns-18795a59e98f2496ab7bb8705f96fa1a4d08ccba.tar.xz turns-18795a59e98f2496ab7bb8705f96fa1a4d08ccba.zip | |
domain: extend participant tests
| -rw-r--r-- | domain/include/turns/domain/participant.hpp | 2 | ||||
| -rw-r--r-- | domain/src/participant.cpp | 5 | ||||
| -rw-r--r-- | domain/tests/participant.cpp | 80 |
3 files changed, 69 insertions, 18 deletions
diff --git a/domain/include/turns/domain/participant.hpp b/domain/include/turns/domain/participant.hpp index a097abd..3f249d5 100644 --- a/domain/include/turns/domain/participant.hpp +++ b/domain/include/turns/domain/participant.hpp @@ -35,8 +35,6 @@ namespace turns::domain Glib::Property<float> m_priority; }; - auto operator<=>(Glib::RefPtr<participant> const & lhs, Glib::RefPtr<participant> const & rhs) -> std::partial_ordering; - } // namespace turns::domain #endif
\ No newline at end of file diff --git a/domain/src/participant.cpp b/domain/src/participant.cpp index 7ff9ce1..08c6deb 100644 --- a/domain/src/participant.cpp +++ b/domain/src/participant.cpp @@ -65,9 +65,4 @@ namespace turns::domain return m_priority.get_proxy(); } - auto operator<=>(Glib::RefPtr<participant> const & lhs, Glib::RefPtr<participant> const & rhs) -> std::partial_ordering - { - return *lhs <=> *rhs; - } - } // namespace turns::domain
\ No newline at end of file diff --git a/domain/tests/participant.cpp b/domain/tests/participant.cpp index 268b395..6db98f7 100644 --- a/domain/tests/participant.cpp +++ b/domain/tests/participant.cpp @@ -9,7 +9,7 @@ namespace turns::domain::tests { - TEST_CASE("A participant") + TEST_CASE("A freshly constructed participant") { auto constexpr constructed_name = "Vana Thistletop"; auto constexpr constructed_priority = 17; @@ -20,26 +20,84 @@ namespace turns::domain::tests REQUIRE(participant::create(constructed_name, constructed_priority)); } - SECTION("the name can be read") + SECTION("allows access to its name via the associated accessors") { - REQUIRE(instance.get_name() == constructed_name); + SECTION("allowing to get it") + { + REQUIRE(instance.get_name() == constructed_name); + } + + SECTION("allowing to get it via a constant object") + { + auto const & cref = instance; + REQUIRE(cref.get_name() == constructed_name); + } + + SECTION("allowing to set it") + { + instance.set_name("replaced"); + REQUIRE(instance.get_name() == "replaced"); + } } - SECTION("the name can be changed") + SECTION("allows access to its name via the associated property") { - instance.set_name("replaced"); - REQUIRE(instance.get_name() == "replaced"); + SECTION("allowing to get it") + { + REQUIRE(instance.property_name() == constructed_name); + } + + SECTION("allowing to get it via a constant object") + { + auto const & cref = instance; + REQUIRE(cref.property_name() == constructed_name); + } + + SECTION("allowing to set it") + { + instance.property_name() = "replaced"; + REQUIRE(instance.get_name() == "replaced"); + } } - SECTION("the priority can be read") + SECTION("allows access to its priority via the associated accessors") { - REQUIRE(instance.get_priority() == constructed_priority); + SECTION("allowing to get it") + { + REQUIRE(instance.get_priority() == constructed_priority); + } + + SECTION("allowing to get it via a constant object") + { + auto const & cref = instance; + REQUIRE(cref.get_priority() == constructed_priority); + } + + SECTION("allowing to set it") + { + instance.set_priority(3); + REQUIRE(instance.get_priority() == 3); + } } - SECTION("the priority can be changed") + SECTION("allows access to its priority via the associated property") { - instance.set_priority(8); - REQUIRE(instance.get_priority() == 8); + SECTION("allowing to get it") + { + REQUIRE(instance.property_priority() == constructed_priority); + } + + SECTION("allowing to get it via a constant object") + { + auto const & cref = instance; + REQUIRE(cref.property_priority() == constructed_priority); + } + + SECTION("allowing to set it") + { + instance.property_priority() = 4; + REQUIRE(instance.get_priority() == 4); + } } SECTION("can be compared with another participant") |
