]> iEval git - io-compress-brotli.git/blame - t/01-uncompress.t
Use the decoded size to measure the throughput, same as bro tool.
[io-compress-brotli.git] / t / 01-uncompress.t
CommitLineData
f9995f31
MG
1#!/usr/bin/perl
2use v5.14;
3use warnings;
4
2786a68d 5use Test::More tests => 80;
f9995f31 6use File::Slurp;
2786a68d
QR
7
8use IO::Uncompress::Brotli;
f9995f31
MG
9
10my $todo_re = qr/empty\.compressed\.(?:1[7-9]|2)|x\.compressed\.0[12]/;
11
28ab7055 12for my $test (<brotli/tests/testdata/*.compressed*>) {
f9995f31
MG
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.02576 seconds and 4 git commands to generate.