test ergonomics
thanks tsmanner
This commit is contained in:
parent
e4e845384f
commit
0331364da2
@ -774,16 +774,14 @@ test "bdzIdx on str" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test "nblocks" {
|
test "nblocks" {
|
||||||
const T = struct { want: u32, arr: []const u8 };
|
const tests = .{
|
||||||
const tests = &[_]T{
|
.{ 0, &[_]u8{} },
|
||||||
.{ .want = 0, .arr = &[_]u8{} },
|
.{ 1, &[_]u8{ 1, 2, 42 } },
|
||||||
.{ .want = 1, .arr = &[_]u8{ 1, 2, 42 } },
|
.{ 1, &[_]u8{1} ** 63 },
|
||||||
.{ .want = 1, .arr = &[_]u8{1} ** 63 },
|
.{ 1, &[_]u8{1} ** 64 },
|
||||||
.{ .want = 1, .arr = &[_]u8{1} ** 64 },
|
.{ 2, &[_]u8{1} ** 65 },
|
||||||
.{ .want = 2, .arr = &[_]u8{1} ** 65 },
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for (tests) |tt| {
|
inline for (tests) |tt|
|
||||||
try testing.expectEqual(tt.want, nblocks(tt.arr));
|
try testing.expectEqual(@as(u32, tt[0]), nblocks(tt[1]));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user