diff options
Diffstat (limited to 'lib/tests/turnsmm/participant.cpp')
| -rw-r--r-- | lib/tests/turnsmm/participant.cpp | 69 |
1 files changed, 66 insertions, 3 deletions
diff --git a/lib/tests/turnsmm/participant.cpp b/lib/tests/turnsmm/participant.cpp index d1e1762..6f02644 100644 --- a/lib/tests/turnsmm/participant.cpp +++ b/lib/tests/turnsmm/participant.cpp @@ -13,7 +13,7 @@ SCENARIO("Creating a participant", "[lib][object][lifetime]") { - GIVEN("A participant constructed using turns_participant_new()") + GIVEN("A participant constructed using the default constructor") { auto instance = Turns::Participant{}; @@ -43,12 +43,12 @@ SCENARIO("Creating a participant", "[lib][object][lifetime]") } } - GIVEN("A participant constructed using turns_participant_new_with(...)") + GIVEN("A participant constructed using the 3-parameter constructor") { auto name = "Test Participant"; auto priority = 12.4f; auto disposition = Turns::Disposition::Friendly; - auto instance = Turns::Participant(name, priority, disposition); + auto instance = Turns::Participant{name, priority, disposition}; THEN("it's name is set") { @@ -75,6 +75,69 @@ SCENARIO("Creating a participant", "[lib][object][lifetime]") REQUIRE_FALSE(instance.get_defeated()); } } + + GIVEN("A participant constructed using the 0-parameter factory") + { + auto instance = Turns::Participant::create(); + + THEN("it's name is empty") + { + REQUIRE(instance->get_name().empty()); + } + + THEN("it's priority is 0.0f") + { + REQUIRE(instance->get_priority() == Catch::Approx{0.0}); + } + + THEN("it's disposition is neutral") + { + REQUIRE(instance->get_disposition() == Turns::Disposition::Neutral); + } + + THEN("it's active state is false") + { + REQUIRE_FALSE(instance->get_active()); + } + + THEN("it's defeated state is false") + { + REQUIRE_FALSE(instance->get_defeated()); + } + } + + GIVEN("A participant constructed using the 3-parameter factory") + { + auto name = "Test Participant"; + auto priority = 12.4f; + auto disposition = Turns::Disposition::Friendly; + auto instance = Turns::Participant::create(name, priority, disposition); + + THEN("it's name is set") + { + REQUIRE(instance->get_name() == name); + } + + THEN("it's priority is set") + { + REQUIRE(instance->get_priority() == Catch::Approx{priority}); + } + + THEN("it's disposition is") + { + REQUIRE(instance->get_disposition() == disposition); + } + + THEN("it's active state is false") + { + REQUIRE_FALSE(instance->get_active()); + } + + THEN("it's defeated state is false") + { + REQUIRE_FALSE(instance->get_defeated()); + } + } } SCENARIO("Modifying a participant", "[lib][object][data]") |
