Zig Version
0.14.0
Steps to Reproduce and Observed Behavior
Using branch zig-0.14.0, commit fb3ecae be4ca3f
Code and sample output below.
Code to reproduce:
const BenchmarkDebug = struct {
num: usize,
pub fn run(self: @This(), allocator: Allocator) void {
std.debug.print("oopsies. {d}\n", .{ self.num });
_ = allocator;
}
};
test "benchmarkdebug" {
var runner = zbench.Benchmark.init(std.testing.allocator, .{});
defer runner.deinit();
const test_case = BenchmarkDebug{ .num = 1025 };
try runner.addParam("Benchmark1 ", &test_case, .{});
try runner.run(std.io.getStdErr().writer());
std.debug.print("address: {*}\n", .{ &test_case });
std.debug.print("address: {d}\n", .{ @intFromPtr(&test_case) });
}
Sample output:
...
oopsies. 19043096
oopsies. 19043096
Benchmark1 100000 284.664ms 2.846us ± 3.02us (2us ... 301.5us) 2.7us 15.3us 16.8us
address: main.BenchmarkDebug@1229318
address: 19043096
Expected Behavior
I expect the run function in my repro code to print the value in my context (1025), not its address (19043096).
I believe the run function called by parameterised tests should be typed fn (*T, Allocator) void or similar, but it is currently forced to have the type fn (T, Allocator) void.
Zig Version
0.14.0
Steps to Reproduce and Observed Behavior
Using branch
zig-0.14.0, commitfb3ecaebe4ca3fCode and sample output below.
Code to reproduce:
Sample output:
Expected Behavior
I expect the run function in my repro code to print the value in my context (
1025), not its address (19043096).I believe the
runfunction called by parameterised tests should be typedfn (*T, Allocator) voidor similar, but it is currently forced to have the typefn (T, Allocator) void.