commit 9eb0256d8f18f61ec8467d4d7a9b653861e4d915
parent 7a7226da8471bf74df4fb0de08efd21a17a243e9
Author: Walther Chen <walther.chen@gmail.com>
Date: Sun, 6 Nov 2022 23:31:17 -0500
simplify test to just interpreter
Diffstat:
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/main.zig b/src/main.zig
@@ -117,7 +117,9 @@ const Program = struct {
}
};
-test "hello world" {
+test "interpret hello world" {
+ // Doesn't test parsing stage (so this input cannot have comments)
+
const hello_world = "++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.";
var list = ArrayList(u8).init(std.testing.allocator);
@@ -130,8 +132,7 @@ test "hello world" {
var rdr = empty_in.reader();
var wtr = list.writer();
- const program = try parse(hello_world, std.testing.allocator);
- defer program.deinit();
+ const program = Program{ .instructions = hello_world, .alloc = std.testing.allocator };
try interpret(program, &memory, rdr, wtr);
try expectEqualSlices(u8, "Hello World!\n", list.items);
}