]> iEval git - io-compress-brotli.git/blame - t/02-roundtrip.t
Fix bin/bro-perl
[io-compress-brotli.git] / t / 02-roundtrip.t
CommitLineData
2786a68d
QR
1#!/usr/bin/perl
2use v5.14;
3use warnings;
4
5use Test::More tests => 114;
6use File::Slurp;
7
8use IO::Compress::Brotli;
9use IO::Uncompress::Brotli;
10
11for my $test (<brotli/tests/testdata/*.compressed>) {
12 my ($source) = $test =~ s/\.compressed$//r;
13 $source = read_file $source;
14
9aa33e85
MG
15 for my $quality (9,11) {
16 my $encoded = bro($source, $quality);
56bfd9c0 17 my $decoded = unbro($encoded, 1_000_000);
2786a68d 18
9aa33e85
MG
19 is $decoded, $source, "$test - quality $quality";
20 }
2786a68d 21
9aa33e85 22 for my $quality (1,5,9,11) {
2786a68d
QR
23 my $enc = IO::Compress::Brotli->create;
24 $enc->quality($quality);
9aa33e85
MG
25 my $encoded = $enc->compress($source);
26 $encoded .= $enc->finish();
2786a68d
QR
27
28 my $dec = IO::Uncompress::Brotli->create;
9aa33e85 29 my $decoded = $dec->decompress($encoded);
2786a68d 30
9aa33e85
MG
31 is $decoded, $source, "$test - streaming / quality $quality";
32 }
2786a68d 33}
This page took 0.024691 seconds and 4 git commands to generate.