0: #! /usr/bin/env perl
1: #
2: # test script for Compress::Bzip2
3: # david landgren 26-feb-2001
4:
5: use Compress::Bzip2;
6:
7: print "1..3\n";
8:
9: my( $source, $target, $verify );
10:
11: $source = '';
12: $target = Compress::Bzip2::compress( $source );
13: $verify = Compress::Bzip2::decompress( $target );
14:
15: print 'not ' if $verify ne $source;
16: print "ok 1\n";
17:
18: $source = 'x' x 10000;
19: $target = Compress::Bzip2::compress( $source );
20: $verify = Compress::Bzip2::decompress( $target );
21:
22: print 'not ' if $verify ne $source;
23: print "ok 2\n";
24:
25: $source = do {
26: $/ = undef;
27: my $input = shift || $0;
28: if( open IN, $input ) {
29: my $slurp = <IN>;
30: close IN;
31: $slurp;
32: }
33: else {
34: '';
35: }
36: };
37:
38: if( !$source ) {
39: print 'not ';
40: }
41: else {
42: $target = Compress::Bzip2::compress( $source );
43: $verify = Compress::Bzip2::decompress( $target );
44: print 'not ' if $verify ne $source;
45: }
46: print "ok 3\n";
47: __END__
I've mailed the test to the author, but in the meantime if
you want to use this wonderful compressor directly from
Perl, with this script you'll know if it works correctly
on your platform. |