|
|
|
@ -1,7 +1,7 @@ |
|
|
|
|
#include <doctest.h> |
|
|
|
|
#include <catch2/catch_test_macros.hpp> |
|
|
|
|
#include "../game_engine.hpp" |
|
|
|
|
|
|
|
|
|
TEST_CASE("brainfuck test") { |
|
|
|
|
TEST_CASE("brainfuck test", "[brainfuck]") { |
|
|
|
|
Brainfucker bf; |
|
|
|
|
string code{"+.>+.>+.>"}; |
|
|
|
|
|
|
|
|
@ -10,23 +10,23 @@ TEST_CASE("brainfuck test") { |
|
|
|
|
// this is actually ticks, not code length
|
|
|
|
|
bf.run(code.size()); |
|
|
|
|
|
|
|
|
|
CHECK(bf.data[0] == 1); |
|
|
|
|
CHECK(bf.data[1] == 1); |
|
|
|
|
CHECK(bf.data[2] == 1); |
|
|
|
|
REQUIRE(bf.data[0] == 1); |
|
|
|
|
REQUIRE(bf.data[1] == 1); |
|
|
|
|
REQUIRE(bf.data[2] == 1); |
|
|
|
|
|
|
|
|
|
bf.reset(); |
|
|
|
|
|
|
|
|
|
CHECK(bf.data[0] == 0); |
|
|
|
|
CHECK(bf.data[1] == 0); |
|
|
|
|
CHECK(bf.data[2] == 0); |
|
|
|
|
REQUIRE(bf.data[0] == 0); |
|
|
|
|
REQUIRE(bf.data[1] == 0); |
|
|
|
|
REQUIRE(bf.data[2] == 0); |
|
|
|
|
|
|
|
|
|
CHECK(bf.code.empty()); |
|
|
|
|
REQUIRE(bf.code.empty()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST_CASE("game engine can start and take hit") { |
|
|
|
|
TEST_CASE("game engine can start and take hit", "[brainfuck]") { |
|
|
|
|
// test fails on purpose right now
|
|
|
|
|
GameEngine game{4}; |
|
|
|
|
string err{"error"}; |
|
|
|
|
game.hit(err); |
|
|
|
|
CHECK(game.is_dead() == true); |
|
|
|
|
REQUIRE(game.is_dead() == true); |
|
|
|
|
} |
|
|
|
|