The moment of truth. Write check_both(src, expected):
1. Run the interpreter on src -> get the interpreter's answer
2. Run the compiler on src -> get WAT text
3. Run the VM on the WAT -> get the VM's answer
4. Compare both answers to expected
fn check_both(input: []const u8, expected: i64) void {
// Interpret
source = input;
pos = 0;
num_vars = 0;
fn_count = 0;
return_flag = false;
save_depth = 0;
skip();
const interp: i64 = program();
// Compile
c_program(input);
// Run VM
const compiled: i64 = vm_run_wat(out[0..out_len]);
if (interp == expected and compiled == expected) {
print(" ok {d}\n", .{expected});
} else {
print(" FAIL interp={d} compiled={d} want={d}\n", .{ interp, compiled, expected });
}
}