Why does task 1 fail complaining about a function (hit) from task 2 in C++ track? Shouldn’t task 1 pass, then I can move on to task 2?
namespace targets {
class Alien {
public:
Alien(int x, int y) : x_coordinate(x), y_coordinate(y), health(3) {
}
int get_health()
{
return health;
}
int x_coordinate{};
int y_coordinate{};
private:
int health{3};
};
}
Error:
In file included from /usr/local/include/catch2/benchmark/catch_benchmark.hpp:14,
from /usr/local/include/catch2/benchmark/catch_benchmark_all.hpp:24,
from /usr/local/include/catch2/catch_all.hpp:25,
from /tmp/ellens-alien-game/ellens_alien_game_test.cpp:3:
/tmp/ellens-alien-game/ellens_alien_game_test.cpp: In function 'void CATCH2_INTERNAL_TEST_6()':
/tmp/ellens-alien-game/ellens_alien_game_test.cpp:32:19: error: 'class targets::Alien' has no member named 'hit'
32 | REQUIRE(alien.hit());
| ^~~
In file included from /usr/local/include/catch2/catch_test_macros.hpp:11,
from /usr/local/include/catch2/catch_template_test_macros.hpp:20,
from /usr/local/include/catch2/catch_all.hpp:36:
/tmp/ellens-alien-game/ellens_alien_game_test.cpp:32:19: error: 'class targets::Alien' has no member named 'hit'
32 | REQUIRE(alien.hit());
| ^~~
/tmp/ellens-alien-game/ellens_alien_game_test.cpp:32:19: error: 'class targets::Alien' has no member named 'hit'
32 | REQUIRE(alien.hit());
| ^~~
/tmp/ellens-alien-game/ellens_alien_game_test.cpp: In function 'void CATCH2_INTERNAL_TEST_8()':
/tmp/ellens-alien-game/ellens_alien_game_test.cpp:37:19: error: 'class targets::Alien' has no member named 'is_alive'
37 | REQUIRE(alien.is_alive());
| ^~~~~~~~
/tmp/ellens-alien-game/ellens_alien_game_test.cpp:37:19: error: 'class targets::Alien' has no member named 'is_alive'
37 | REQUIRE(alien.is_alive());
| ^~~~~~~~
/tmp/ellens-alien-game/ellens_alien_game_test.cpp:37:19: error: 'class targets::Alien' has no member named 'is_alive'
37 | REQUIRE(alien.is_alive());
| ^~~~~~~~
/tmp/ellens-alien-game/ellens_alien_game_test.cpp:38:11: error: 'class targets::Alien' has no member named 'hit'
38 | alien.hit();
| ^~~
/tmp/ellens-alien-game/ellens_alien_game_test.cpp:39:19: error: 'class targets::Alien' has no member named 'is_alive'
39 | REQUIRE(alien.is_alive());
| ^~~~~~~~
/tmp/ellens-alien-game/ellens_alien_game_test.cpp:39:19: error: 'class targets::Alien' has no member named 'is_alive'
39 | REQUIRE(alien.is_alive());
| ^~~~~~~~
/tmp/ellens-alien-game/ellens_alien_game_test.cpp:39:19: error: 'class targets::Alien' has no member named 'is_alive'
39 | REQUIRE(alien.is_alive());
| ^~~~~~~~
/tmp/ellens-alien-game/ellens_alien_game_test.cpp:40:11: error: 'class targets::Alien' has no member named 'hit'
40 | alien.hit();
| ^~~
/tmp/ellens-alien-game/ellens_alien_game_test.cpp:41:19: error: 'class targets::Alien' has no member named 'is_alive'
41 | REQUIRE(alien.is_alive());
| ^~~~~~~~
/tmp/ellens-alien-game/ellens_alien_game_test.cpp:41:19: error: 'class targets::Alien' has no member named 'is_alive'
41 | REQUIRE(alien.is_alive());
| ^~~~~~~~
/tmp/ellens-alien-game/ellens_alien_game_test.cpp:41:19: error: 'class targets::Alien' has no member named 'is_alive'
41 | REQUIRE(alien.is_alive());
| ^~~~~~~~
/tmp/ellens-alien-game/ellens_alien_game_test.cpp:42:11: error: 'class targets::Alien' has no member named 'hit'
42 | alien.hit();
| ^~~
/tmp/ellens-alien-game/ellens_alien_game_test.cpp:43:20: error: 'class targets::Alien' has no member named 'is_alive'
43 | REQUIRE(!alien.is_alive());
| ^~~~~~~~
/tmp/ellens-alien-game/ellens_alien_game_test.cpp:43:20: error: 'class targets::Alien' has no member named 'is_alive'
43 | REQUIRE(!alien.is_alive());
| ^~~~~~~~
/tmp/ellens-alien-game/ellens_alien_game_test.cpp:43:20: error: 'class targets::Alien' has no member named 'is_alive'
43 | REQUIRE(!alien.is_alive());
| ^~~~~~~~
/tmp/ellens-alien-game/ellens_alien_game_test.cpp:44:11: error: 'class targets::Alien' has no member named 'hit'
44 | alien.hit();
| ^~~
/tmp/ellens-alien-game/ellens_alien_game_test.cpp:45:20: error: 'class targets::Alien' has no member named 'is_alive'
45 | REQUIRE(!alien.is_alive());
| ^~~~~~~~
/tmp/ellens-alien-game/ellens_alien_game_test.cpp:45:20: error: 'class targets::Alien' has no member named 'is_alive'
45 | REQUIRE(!alien.is_alive());
| ^~~~~~~~
/tmp/ellens-alien-game/ellens_alien_game_test.cpp:45:20: error: 'class targets::Alien' has no member named 'is_alive'
45 | REQUIRE(!alien.is_alive());
| ^~~~~~~~
/tmp/ellens-alien-game/ellens_alien_game_test.cpp: In function 'void CATCH2_INTERNAL_TEST_10()':
/tmp/ellens-alien-game/ellens_alien_game_test.cpp:50:19: error: 'class targets::Alien' has no member named 'teleport'
50 | REQUIRE(alien.teleport(99, 8));
| ^~~~~~~~
[.....]