From afecfbd4c24eec37402d8557c6a024f262337985 Mon Sep 17 00:00:00 2001 From: Han Bol Date: Tue, 10 Sep 2024 13:16:06 +0200 Subject: [PATCH 1/2] Hit requirement untested There is a requirement for hit() method which states: "Make sure that the health points do not drop below zero." Adding a "get_health() == 0" at the end of the hit test now tests whether this is the case. --- exercises/concept/ellens-alien-game/ellens_alien_game_test.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/exercises/concept/ellens-alien-game/ellens_alien_game_test.cpp b/exercises/concept/ellens-alien-game/ellens_alien_game_test.cpp index e1b719074..04a800a3f 100644 --- a/exercises/concept/ellens-alien-game/ellens_alien_game_test.cpp +++ b/exercises/concept/ellens-alien-game/ellens_alien_game_test.cpp @@ -43,6 +43,7 @@ TEST_CASE("Alien is alive while health is greater than 0 and stays dead afterwar REQUIRE(!alien.is_alive()); alien.hit(); REQUIRE(!alien.is_alive()); + REQUIRE(alien.get_health() == 0); } TEST_CASE("Alien Teleports reports succesful", "[task_4]") { From 4cbeff6548ef6685ac87c2012285f26beefa5bb3 Mon Sep 17 00:00:00 2001 From: Alexander Hans Date: Thu, 12 Sep 2024 11:43:28 +0200 Subject: [PATCH 2/2] fix: apply clang-format --- .../concept/ellens-alien-game/ellens_alien_game_test.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/exercises/concept/ellens-alien-game/ellens_alien_game_test.cpp b/exercises/concept/ellens-alien-game/ellens_alien_game_test.cpp index 04a800a3f..cbd5e6a4f 100644 --- a/exercises/concept/ellens-alien-game/ellens_alien_game_test.cpp +++ b/exercises/concept/ellens-alien-game/ellens_alien_game_test.cpp @@ -32,7 +32,9 @@ TEST_CASE("Alien is always hit", "[task_2]") { REQUIRE(alien.hit()); } -TEST_CASE("Alien is alive while health is greater than 0 and stays dead afterwards", "[task_3]") { +TEST_CASE( + "Alien is alive while health is greater than 0 and stays dead afterwards", + "[task_3]") { Alien alien{2, 54}; REQUIRE(alien.is_alive()); alien.hit();