2022-06-05 08:48:38 +03:00
|
|
|
module deflate
|
|
|
|
|
|
|
|
const gzip_magic_numbers = [u8(0x1f), 0x8b]
|
2022-06-03 09:00:11 +03:00
|
|
|
|
2022-10-20 22:14:33 +03:00
|
|
|
fn test_gzip() {
|
2022-06-03 09:00:11 +03:00
|
|
|
uncompressed := 'Hello world!'
|
2022-10-20 22:14:33 +03:00
|
|
|
compressed := compress(uncompressed.bytes())!
|
2022-06-05 08:48:38 +03:00
|
|
|
first2 := compressed[0..2]
|
|
|
|
assert first2 != deflate.gzip_magic_numbers
|
2022-10-20 22:14:33 +03:00
|
|
|
decompressed := decompress(compressed)!
|
2022-06-03 09:00:11 +03:00
|
|
|
assert decompressed == uncompressed.bytes()
|
|
|
|
}
|