Zig 0.17.0-dev (Split by item)
This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig library itself.
Zig › std/ › compress/ › flate/ › Compress.zig › testingCheckDecompressedMatches
testingCheckDecompressedMatches
Compress.testingCheckDecompressedMatches
fn testingCheckDecompressedMatches (
flate_bytes : []const u8 ,
expected_size : u32 ,
expected_hash : flate .Container .Hasher ,
) !void
File
Code
fn testingCheckDecompressedMatches (
flate_bytes : []const u8 ,
expected_size : u32 ,
expected_hash : flate .Container .Hasher ,
) !void {
const container : flate .Container = expected_hash ;
var data_hash : flate .Container .Hasher = .init (container );
var data_size : u32 = 0 ;
var flate_r : Io .Reader = .fixed (flate_bytes );
var deflate_buf : [flate .max_window_len ]u8 = undefined ;
var deflate : flate .Decompress = .init (&flate_r , container , &deflate_buf );
while (deflate .reader .peekGreedy (1 )) |bytes | {
data_size += @intCast (bytes .len );
data_hash .update (bytes );
deflate .reader .toss (bytes .len );
} else |e | switch (e ) {
error .ReadFailed => return deflate .err .?,
error .EndOfStream => {},
}
try testingCheckContainerHash (
expected_size ,
expected_hash ,
data_hash ,
data_size ,
deflate .container_metadata ,
);
}