Looks like the brainfuck is working. It can do a hello world program.
This commit is contained in:
parent
5b18849ddc
commit
38104f60f3
3 changed files with 78 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
|||
#include <catch2/catch_test_macros.hpp>
|
||||
#include "../game_engine.hpp"
|
||||
|
||||
TEST_CASE("brainfuck test", "[brainfuck]") {
|
||||
TEST_CASE("basic brainfuck test", "[brainfuck]") {
|
||||
Brainfucker bf;
|
||||
string code{"+.>+.>+.>"};
|
||||
|
||||
|
@ -23,6 +23,16 @@ TEST_CASE("brainfuck test", "[brainfuck]") {
|
|||
REQUIRE(bf.code.empty());
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("brainfuck loop test", "[brainfuck]") {
|
||||
Brainfucker bf;
|
||||
// this is a hello world program from wikipedia
|
||||
string code{"++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++."};
|
||||
|
||||
bf.set_code(code);
|
||||
bf.run(code.size());
|
||||
}
|
||||
|
||||
TEST_CASE("game engine can start and take hit", "[brainfuck]") {
|
||||
// test fails on purpose right now
|
||||
GameEngine game{4};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue