From 8875b6968b2f23f1bbc5d01a94694caff6fcea38 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Wed, 22 Apr 2026 12:53:02 +1000 Subject: [PATCH] Updated VM unit tests --- tests/units/test_vm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/units/test_vm.c b/tests/units/test_vm.c index 3b6fd84..696b39d 100644 --- a/tests/units/test_vm.c +++ b/tests/units/test_vm.c @@ -27,7 +27,7 @@ int test_setup_and_teardown(Toy_Bucket** bucketHandle) { //basic init & quit { //generate bytecode for testing - const char* source = "(1 + 2) * (3 + 4);"; + const char* source = "return (1 + 2) * (3 + 4);"; Toy_Lexer lexer; Toy_bindLexer(&lexer, source); @@ -71,8 +71,8 @@ int test_setup_and_teardown(Toy_Bucket** bucketHandle) { int test_simple_execution(Toy_Bucket** bucketHandle) { //test execution { - //generate bytecode for testing - const char* source = "(1 + 2) * (3 + 4);"; + //generate bytecode for testing ('return' leaves expressions on the stack) + const char* source = "return (1 + 2) * (3 + 4);"; Toy_Lexer lexer; Toy_bindLexer(&lexer, source); @@ -118,7 +118,7 @@ int test_opcode_not_equal(Toy_Bucket** bucketHandle) { //testing a specific opcode; '!=' is compressed into a single word, so lets check it works { //generate bytecode for testing - const char* source = "3 != 5;"; + const char* source = "return 3 != 5;"; Toy_Lexer lexer; Toy_bindLexer(&lexer, source);