| ... | @@ -234,19 +234,10 @@ test "decompression" { | ... | @@ -234,19 +234,10 @@ test "decompression" { |
| 234 | try std.testing.expectEqual(uncompressed.len, res3); | 234 | try std.testing.expectEqual(uncompressed.len, res3); |
| 235 | try std.testing.expectEqualSlices(u8, uncompressed, buffer); | 235 | try std.testing.expectEqualSlices(u8, uncompressed, buffer); |
| 236 | | 236 | |
| | 237 | @memset(buffer, undefined); |
| 237 | const res19 = try decompress.decode(buffer, compressed19, true); | 238 | const res19 = try decompress.decode(buffer, compressed19, true); |
| 238 | try std.testing.expectEqual(uncompressed.len, res19); | 239 | try std.testing.expectEqual(uncompressed.len, res19); |
| 239 | try std.testing.expectEqualSlices(u8, uncompressed, buffer); | 240 | try std.testing.expectEqualSlices(u8, uncompressed, buffer); |
| 240 | } | | |
| 241 | | | |
| 242 | test "streaming decompression" { | | |
| 243 | // default stack size for wasm32 is too low for Decompressor - slightly | | |
| 244 | // over 1MiB stack space is needed via the --stack CLI flag | | |
| 245 | if (@import("builtin").target.cpu.arch == .wasm32) return error.SkipZigTest; | | |
| 246 | | | |
| 247 | const uncompressed = @embedFile("testdata/rfc8478.txt"); | | |
| 248 | const compressed3 = @embedFile("testdata/rfc8478.txt.zst.3"); | | |
| 249 | const compressed19 = @embedFile("testdata/rfc8478.txt.zst.19"); | | |
| 250 | | 241 | |
| 251 | try testReader(compressed3, uncompressed); | 242 | try testReader(compressed3, uncompressed); |
| 252 | try testReader(compressed19, uncompressed); | 243 | try testReader(compressed19, uncompressed); |
| ... | @@ -295,24 +286,6 @@ test "zero sized block" { | ... | @@ -295,24 +286,6 @@ test "zero sized block" { |
| 295 | | 286 | |
| 296 | try expectEqualDecoded("", input_raw); | 287 | try expectEqualDecoded("", input_raw); |
| 297 | try expectEqualDecoded("", input_rle); | 288 | try expectEqualDecoded("", input_rle); |
| 298 | } | | |
| 299 | | | |
| 300 | test "zero sized block streaming" { | | |
| 301 | // default stack size for wasm32 is too low for Decompressor - slightly | | |
| 302 | // over 1MiB stack space is needed via the --stack CLI flag | | |
| 303 | if (@import("builtin").target.cpu.arch == .wasm32) return error.SkipZigTest; | | |
| 304 | | | |
| 305 | const input_raw = | | |
| 306 | "\x28\xb5\x2f\xfd" ++ // zstandard frame magic number | | |
| 307 | "\x20\x00" ++ // frame header: only single_segment_flag set, frame_content_size zero | | |
| 308 | "\x01\x00\x00"; // block header with: last_block set, block_type raw, block_size zero | | |
| 309 | | | |
| 310 | const input_rle = | | |
| 311 | "\x28\xb5\x2f\xfd" ++ // zstandard frame magic number | | |
| 312 | "\x20\x00" ++ // frame header: only single_segment_flag set, frame_content_size zero | | |
| 313 | "\x03\x00\x00" ++ // block header with: last_block set, block_type rle, block_size zero | | |
| 314 | "\xaa"; // block_content | | |
| 315 | | | |
| 316 | try expectEqualDecodedStreaming("", input_raw); | 289 | try expectEqualDecodedStreaming("", input_raw); |
| 317 | try expectEqualDecodedStreaming("", input_rle); | 290 | try expectEqualDecodedStreaming("", input_rle); |
| 318 | } | 291 | } |