From 8dfc184c00f7c04e70f861914a944e3dbee3a136 Mon Sep 17 00:00:00 2001 From: Matthew Hall Date: Sun, 4 Sep 2022 13:50:58 +1200 Subject: Add testing programs to repo --- test_programs/brainfuck/cat_eof0.bf | 2 ++ test_programs/brainfuck/hello_world.bf | 2 ++ test_programs/brainfuck/truth_machine.bf | 7 +++++++ 3 files changed, 11 insertions(+) create mode 100644 test_programs/brainfuck/cat_eof0.bf create mode 100644 test_programs/brainfuck/hello_world.bf create mode 100644 test_programs/brainfuck/truth_machine.bf (limited to 'test_programs/brainfuck') diff --git a/test_programs/brainfuck/cat_eof0.bf b/test_programs/brainfuck/cat_eof0.bf new file mode 100644 index 0000000..413fc13 --- /dev/null +++ b/test_programs/brainfuck/cat_eof0.bf @@ -0,0 +1,2 @@ +cat program where eof is trated as zero +,[.,] diff --git a/test_programs/brainfuck/hello_world.bf b/test_programs/brainfuck/hello_world.bf new file mode 100644 index 0000000..2b52c3e --- /dev/null +++ b/test_programs/brainfuck/hello_world.bf @@ -0,0 +1,2 @@ +Basic hello world program from esolangs wiki +++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++. diff --git a/test_programs/brainfuck/truth_machine.bf b/test_programs/brainfuck/truth_machine.bf new file mode 100644 index 0000000..964de9f --- /dev/null +++ b/test_programs/brainfuck/truth_machine.bf @@ -0,0 +1,7 @@ +my own personal attempt at making a truth machine in brainfuck +>+++++++++++++++++++++++++++++++++++++++++++++++++ set memory cell 1 to 49 (ascii code for '1') +<, move back to cell 0 and read the byte +------------------------------------------------ subtract 48 to test if it was '0' +[ if it wasn't zero +>.< output value of cell 1 and move back (loops forever) +]>-. otherwise subtract 1 from cell 0 and output the value (ascii code for '0') -- cgit v1.2.1