Something went wrong. Try again.
a fantasy console written in Zig
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435const std = @import("std");const sys = @import("system.zig");
test "load value into accumulator" { var system: sys.System = .{}; try system.loadFile(std.testing.io_instance.io(), "tests/first.bin"); try system.step(); try std.testing.expectEqual(0x52, system.a);}
test "load values and check registers afterwards" { var system: sys.System = .{}; try system.loadFile(std.testing.io_instance.io(), "tests/second.bin");
while (system.read(system.pc) != 0x00) { try system.step(); }
try std.testing.expectEqual(2, system.a); try std.testing.expectEqual(1, system.c);}
test "load values, add values, jump" { var system: sys.System = .{}; try system.loadFile(std.testing.io_instance.io(), "tests/third.bin");
while (system.read(system.pc) != 0x00) { try system.step(); }
try std.testing.expectEqual(0x03, system.a); try std.testing.expectEqual(0x03, system.c); try std.testing.expectEqual(0xa911, system.pc);}