unbro should not require maximum buffer size (RT #129480)
[io-compress-brotli.git] / t / 01-uncompress.t
CommitLineData
f9995f31
MG
1#!/usr/bin/perl
2use v5.14;
3use warnings;
4
799b2a34 5use Test::More tests => 126;
c17e7d63 6use File::Slurper qw/read_binary/;
2786a68d
QR
7
8use IO::Uncompress::Brotli;
f9995f31 9
28ab7055 10for my $test (<brotli/tests/testdata/*.compressed*>) {
f9995f31 11 my ($expected) = $test =~ s/\.compressed.*//r;
c17e7d63 12 $expected = read_binary $expected;
f9995f31 13
c17e7d63 14 my $decoded = unbro ((scalar read_binary $test), 1_000_000);
799b2a34
MG
15 is $decoded, $expected, "$test (two-argument unbro)";
16
17 $decoded = unbro scalar read_binary $test;
18 is $decoded, $expected, "$test (one-argument unbro)";
f9995f31
MG
19
20 open FH, '<', $test;
c8ec5685 21 binmode FH;
f9995f31
MG
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.010983 seconds and 4 git commands to generate.