Cleanup the engine since I won't do the brainfuck thing, then fix up the log a bit.

This commit is contained in:
Zed A. Shaw 2024-09-02 16:13:21 -04:00
parent 8edb37ceb4
commit fdb3f24377
6 changed files with 11 additions and 159 deletions

View file

@ -4,43 +4,6 @@
using namespace fmt;
TEST_CASE("basic brainfuck test", "[brainfuck]") {
Brainfucker bf;
string code{"+.>+.>+.>"};
bf.set_code(code);
bf.run(code.size());
REQUIRE(bf.data[0] == 1);
REQUIRE(bf.data[1] == 1);
REQUIRE(bf.data[2] == 1);
bf.reset();
REQUIRE(bf.data[0] == 0);
REQUIRE(bf.data[1] == 0);
REQUIRE(bf.data[2] == 0);
REQUIRE(bf.code.empty());
}
TEST_CASE("brainfuck loop test", "[brainfuck]") {
Brainfucker bf;
const string expected{"Hello World!\n"};
// this is a hello world program from wikipedia
// but at the end I rewind dp so I can analyze it
string code{"++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++."};
bf.set_code(code);
// have it run a bunch of times
bf.run(10000);
string output = bf.to_string();
REQUIRE(output == expected);
}
TEST_CASE("game engine can start and take hit", "[game_engine]") {
// test fails on purpose right now
GameEngine game{4};