Skip to content

Commit

Permalink
fix(ellens-alien-game): add check for hit requirement
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nash8114 authored Sep 12, 2024
1 parent a224a68 commit c372ebe
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -43,6 +45,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]") {
Expand Down

0 comments on commit c372ebe

Please sign in to comment.