fn testLeb128Encoding(comptime T: type, value: T, encoding: []const u8) !void T: typevalue: Tencoding: []const u82126
2127
2128
2129
2130
2131
2132
2133
2134
2135fn testLeb128Encoding(comptime T: type, value: T, encoding: []const u8) !void {
const info = @typeInfo(T).int;
const max_bytes = @divFloor(info.bits -| 1, 7) + 1;
var bytes: [max_bytes]u8 = undefined;
var fw: Writer = .fixed(&bytes);
try writeLeb128(&fw, value);
try std.testing.expectEqualSlices(u8, encoding, fw.buffered());
}