summaryrefslogtreecommitdiff
path: root/domain/tests
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@gmail.com>2024-07-15 22:36:48 +0200
committerFelix Morgner <felix.morgner@gmail.com>2024-07-15 22:36:48 +0200
commit18795a59e98f2496ab7bb8705f96fa1a4d08ccba (patch)
treebb1392f394030d5a7b9ef4eea9ac473fd8729136 /domain/tests
parent3262b3a337759439f3049b9299be12baf8420750 (diff)
downloadturns-18795a59e98f2496ab7bb8705f96fa1a4d08ccba.tar.xz
turns-18795a59e98f2496ab7bb8705f96fa1a4d08ccba.zip
domain: extend participant tests
Diffstat (limited to 'domain/tests')
-rw-r--r--domain/tests/participant.cpp80
1 files changed, 69 insertions, 11 deletions
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")