feature. See also
. The project being documented here (as the example) is the Zig library itself.
Compress.testingCheckContainerHash
fn testingCheckContainerHash(
expected_size: u32,
expected_hash: flate.Container.Hasher,
actual_hash: flate.Container.Hasher,
actual_size: u32,
actual_meta: flate.Container.Metadata,
) !void
File
Code
fn testingCheckContainerHash(
expected_size: u32,
expected_hash: flate.Container.Hasher,
actual_hash: flate.Container.Hasher,
actual_size: u32,
actual_meta: flate.Container.Metadata,
) !void {
try std.testing.expectEqual(expected_size, actual_size);
switch (actual_hash) {
.raw => {},
.gzip => |gz| {
const expected_crc = expected_hash.gzip.crc.final();
try std.testing.expectEqual(expected_size, actual_meta.gzip.count);
try std.testing.expectEqual(expected_crc, gz.crc.final());
try std.testing.expectEqual(expected_crc, actual_meta.gzip.crc);
},
.zlib => |zl| {
const expected_adler = expected_hash.zlib.adler;
try std.testing.expectEqual(expected_adler, zl.adler);
try std.testing.expectEqual(expected_adler, actual_meta.zlib.adler);
},
}
}