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