]>
Commit | Line | Data |
---|---|---|
1 | #!/usr/bin/perl | |
2 | use v5.14; | |
3 | use warnings; | |
4 | ||
5 | use Test::More tests => 81; | |
6 | use File::Slurp; | |
7 | BEGIN{ use_ok('IO::Uncompress::Brotli'); } | |
8 | ||
9 | my $todo_re = qr/empty\.compressed\.(?:1[7-9]|2)|x\.compressed\.0[12]/; | |
10 | ||
11 | for my $test (<t/testdata/*.compressed*>) { | |
12 | my ($expected) = $test =~ s/\.compressed.*//r; | |
13 | $expected = read_file $expected; | |
14 | ||
15 | if($test !~ $todo_re) { | |
16 | my $decoded = unbro (scalar read_file $test); | |
17 | is $decoded, $expected, "$test"; | |
18 | } | |
19 | ||
20 | open FH, '<', $test; | |
21 | my $unbro = IO::Uncompress::Brotli->create; | |
22 | my ($buf, $out); | |
23 | until (eof FH) { | |
24 | read FH, $buf, 100; | |
25 | $out .= $unbro->decompress($buf); | |
26 | } | |
27 | is $out, $expected, "$test (streaming)"; | |
28 | } |