From 06fbef022fc519e2d8d80615968fc081dcfcb097 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Fri, 6 Jun 2025 10:16:05 +0200 Subject: lib: add more round progress tests --- lib/src/turns-turn-order.c | 2 +- lib/tests/turns-turn-order.cpp | 20 ++++++++++++++++++++ lib/tests/turnsmm/turn-order.cpp | 25 +++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/lib/src/turns-turn-order.c b/lib/src/turns-turn-order.c index c90e958..ba46da8 100644 --- a/lib/src/turns-turn-order.c +++ b/lib/src/turns-turn-order.c @@ -324,7 +324,7 @@ gfloat turns_turn_order_get_round_progress(TurnsTurnOrder const * self) return 0.0f; } - return ((gfloat)(self->active + 1)) / ((gfloat)participant_count); + return ((gfloat)(self->active)) / ((gfloat)participant_count); } TurnsTurnOrderSortMode turns_turn_order_get_sort_mode(TurnsTurnOrder const * self) diff --git a/lib/tests/turns-turn-order.cpp b/lib/tests/turns-turn-order.cpp index 4ff1a83..bdf52a0 100644 --- a/lib/tests/turns-turn-order.cpp +++ b/lib/tests/turns-turn-order.cpp @@ -137,6 +137,11 @@ SCENARIO("Modifying a turn order", "[lib][object][data]") REQUIRE(TURNS_PARTICIPANT(object) == participant); } + THEN("its round progress is 0") + { + REQUIRE(turns_turn_order_get_round_progress(instance) == 0); + } + THEN("it's not empty") { REQUIRE_FALSE(turns_turn_order_get_empty(instance)); @@ -198,6 +203,11 @@ SCENARIO("Modifying a turn order", "[lib][object][data]") REQUIRE(added == 0); } + THEN("its round progress is 0") + { + REQUIRE(turns_turn_order_get_round_progress(instance) == 0); + } + THEN("it's empty") { REQUIRE(turns_turn_order_get_empty(instance)); @@ -244,6 +254,11 @@ SCENARIO("Modifying a turn order", "[lib][object][data]") REQUIRE(added == 0); } + THEN("its round progress is 0") + { + REQUIRE(turns_turn_order_get_round_progress(instance) == 0); + } + THEN("it's empty") { REQUIRE(turns_turn_order_get_empty(instance)); @@ -280,6 +295,11 @@ SCENARIO("Modifying a turn order", "[lib][object][data]") REQUIRE(!list_model_notification.has_value()); } + THEN("its round progress is 0") + { + REQUIRE(turns_turn_order_get_round_progress(instance) == 0); + } + THEN("it's empty") { REQUIRE(turns_turn_order_get_empty(instance)); diff --git a/lib/tests/turnsmm/turn-order.cpp b/lib/tests/turnsmm/turn-order.cpp index fffe507..572d8ce 100644 --- a/lib/tests/turnsmm/turn-order.cpp +++ b/lib/tests/turnsmm/turn-order.cpp @@ -79,6 +79,11 @@ SCENARIO("Creating a turn order", "[lib][object][lifetime]") REQUIRE_FALSE(list_model_notification.has_value()); } + THEN("its round progress is 0") + { + REQUIRE(instance.get_round_progress() == 0); + } + THEN("it's empty") { REQUIRE(instance.get_empty()); @@ -146,6 +151,11 @@ SCENARIO("Modifying a turn order", "[lib][object][data]") REQUIRE(added == 1); } + THEN("its round progress is 0") + { + REQUIRE(instance.get_round_progress() == 0); + } + THEN("it's not empty") { REQUIRE_FALSE(instance.get_empty()); @@ -200,6 +210,11 @@ SCENARIO("Modifying a turn order", "[lib][object][data]") REQUIRE(added == 0); } + THEN("its round progress is 0") + { + REQUIRE(instance.get_round_progress() == 0); + } + THEN("it's empty") { REQUIRE(instance.get_empty()); @@ -232,6 +247,11 @@ SCENARIO("Modifying a turn order", "[lib][object][data]") REQUIRE(added == 0); } + THEN("its round progress is 0") + { + REQUIRE(instance.get_round_progress() == 0); + } + THEN("it's empty") { REQUIRE(instance.get_empty()); @@ -254,6 +274,11 @@ SCENARIO("Modifying a turn order", "[lib][object][data]") REQUIRE(!list_model_notification.has_value()); } + THEN("its round progress is 0") + { + REQUIRE(instance.get_round_progress() == 0); + } + THEN("it's empty") { REQUIRE(instance.get_empty()); -- cgit v1.2.3