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