Skip to content

Commit

Permalink
Improving metering test a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
Southporter committed Jun 14, 2024
1 parent ed2e5b5 commit 890ee86
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.{
.name = "bytebox",
.version = "0.0.1",
.minimum_zig_version = "0.12.0",
.minimum_zig_version = "0.13.0",
.paths = .{
"src",
"test/mem64",
Expand Down
6 changes: 6 additions & 0 deletions src/tests.zig
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ test "StackVM.Metering" {
.meter = 2,
});
try std.testing.expectError(metering.MeteringTrapError.TrapMeterExceeded, res);
try std.testing.expectEqual(5555, returns[0].I32);

const res2 = module_inst.resumeInvoke(&returns, .{ .meter = 5 });
try std.testing.expectError(metering.MeteringTrapError.TrapMeterExceeded, res2);
try std.testing.expectEqual(5555, returns[0].I32);

try module_inst.resumeInvoke(&returns, .{ .meter = 10000 });
try std.testing.expectEqual(89, returns[0].I32);
}
Expand Down

0 comments on commit 890ee86

Please sign in to comment.