| 1 |
root |
1.1 |
BEGIN { $| = 1; print "1..29\n"; } |
| 2 |
|
|
END {print "not ok 1\n" unless $loaded;} |
| 3 |
|
|
use Compress::LZF; |
| 4 |
|
|
$loaded = 1; |
| 5 |
|
|
print "ok 1\n"; |
| 6 |
|
|
|
| 7 |
|
|
my $tst = 2; |
| 8 |
|
|
|
| 9 |
|
|
for ("", |
| 10 |
|
|
"x" x 10000, |
| 11 |
|
|
rand().rand().rand() x 10000, |
| 12 |
|
|
join "", map rand, 1..10000 |
| 13 |
|
|
) { |
| 14 |
|
|
my $compr1 = compress $_; |
| 15 |
|
|
my $compr2 = compress $compr1; |
| 16 |
|
|
my $uncompr1 = decompress $compr1; |
| 17 |
|
|
my $compr3 = compress $_; |
| 18 |
|
|
my $uncompr2 = decompress $compr2; |
| 19 |
|
|
my $uncompr3 = decompress $uncompr2; |
| 20 |
|
|
|
| 21 |
|
|
print length($compr1) <= length($_)+1 ? "" : "not ", "ok ", $tst++, "\n"; |
| 22 |
|
|
print length($compr2) <= length($compr1)+1 ? "" : "not ", "ok ", $tst++, "\n"; |
| 23 |
|
|
print length($compr3) <= length($_)+1 ? "" : "not ", "ok ", $tst++, "\n"; |
| 24 |
|
|
print $compr1 eq $compr3 ? "" : "not ", "ok ", $tst++, "\n"; |
| 25 |
|
|
print $uncompr1 eq $_ ? "" : "not ", "ok ", $tst++, "\n"; |
| 26 |
|
|
print $uncompr2 eq $compr1 ? "" : "not ", "ok ", $tst++, "\n"; |
| 27 |
|
|
print $uncompr3 eq $_ ? "" : "not ", "ok ", $tst++, "\n"; |
| 28 |
|
|
} |