Add tests for compression, and a CLI tool for manual testing.
[io-compress-brotli.git] / t / 01-uncompress.t
1 #!/usr/bin/perl
2 use v5.14;
3 use warnings;
4
5 use Test::More tests => 80;
6 use File::Slurp;
7
8 use IO::Uncompress::Brotli;
9
10 my $todo_re = qr/empty\.compressed\.(?:1[7-9]|2)|x\.compressed\.0[12]/;
11
12 for my $test (<brotli/tests/testdata/*.compressed*>) {
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 }
This page took 0.025657 seconds and 5 git commands to generate.