diff options
Diffstat (limited to 'lib/tests/turnsmm')
| -rw-r--r-- | lib/tests/turnsmm/participant.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/lib/tests/turnsmm/participant.cpp b/lib/tests/turnsmm/participant.cpp index 47cf867..0cac20d 100644 --- a/lib/tests/turnsmm/participant.cpp +++ b/lib/tests/turnsmm/participant.cpp @@ -523,3 +523,50 @@ SCENARIO("Modifying a participant", "[lib][object][data]") } } } + +SCENARIO("Comparing two participants", "[lib][object][logic]") +{ + auto name_lhs = "LHS"; + auto name_rhs = "RHS"; + auto disposition = Turns::Participant::Disposition::Neutral; + + GIVEN("A participant with priority 0") + { + auto lhs = Turns::Participant{name_lhs, 0.0f, disposition}; + + THEN("the it compares equal to itself") + { + REQUIRE(lhs == lhs); + } + + AND_GIVEN("A participant with priority 10") + { + auto rhs = Turns::Participant{name_rhs, 10.0f, disposition}; + + THEN("the first compares less than the second") + { + REQUIRE(lhs < rhs); + } + + THEN("the second compares greater than the first") + { + REQUIRE(rhs > lhs); + } + } + + AND_GIVEN("A participant with priority -10") + { + auto rhs = Turns::Participant{name_rhs, -10.0f, disposition}; + + THEN("the first compares greater than the second") + { + REQUIRE(lhs > rhs); + } + + THEN("the second compares less than the first") + { + REQUIRE(rhs < lhs); + } + } + } +}
\ No newline at end of file |
