🌉 bridged from @aion@lemmy.world by Tidepool
aion
@aion.lemmy.world.ap.tdpl.io
Using expectEqual
Is this the best way to use
expectEqual?zig
fn add(a: i64, b: i64) i64 { return a + b; } test "basic test" { try std.testing.expectEqual(@as(i64, 10), add(3, 7)); }Without the
@asthe test doesn't even compile:./src/main.zig:12:40: error: expected type 'comptime_int', found 'i64' try std.testing.expectEqual(10, add(3, 7));Having to use
@asseems makes the test less readable. It seems to me inferring the type ofexpectedfrom the type ofactualwould make more sense.Badlands National Park
Starting with the original Befunge-93 spec
3D Printed Gallifreyan
Designed with Adrian Wielgosik's Translator