]>
Commit | Line | Data |
---|---|---|
2786a68d QR |
1 | #!/usr/bin/perl |
2 | use v5.14; | |
3 | use warnings; | |
4 | ||
5 | use Test::More tests => 114; | |
6 | use File::Slurp; | |
7 | ||
8 | use IO::Compress::Brotli; | |
9 | use IO::Uncompress::Brotli; | |
10 | ||
11 | for my $test (<brotli/tests/testdata/*.compressed>) { | |
12 | my ($source) = $test =~ s/\.compressed$//r; | |
13 | $source = read_file $source; | |
14 | ||
15 | for my $quality (9,11) { | |
16 | my $encoded = bro($source, $quality); | |
17 | my $decoded = unbro($encoded); | |
18 | ||
19 | is $decoded, $source, "$test - quality $quality"; | |
20 | } | |
21 | ||
22 | for my $quality (1,5,9,11) { | |
23 | my $enc = IO::Compress::Brotli->create; | |
24 | $enc->quality($quality); | |
25 | my $encoded = $enc->compress($source, 1); | |
26 | $encoded .= $enc->finish(); | |
27 | ||
28 | my $dec = IO::Uncompress::Brotli->create; | |
29 | my $decoded = $dec->decompress($encoded); | |
30 | ||
31 | is $decoded, $source, "$test - streaming / quality $quality"; | |
32 | } | |
33 | } |