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