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