4 @INC = ("../lib", "lib");
18 # use Test::NoWarnings, if available
21 if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };
23 plan tests => 288 + $extra ;
25 use_ok('Compress::Zlib', 2) ;
34 my $len = length $hello ;
36 # Check zlib_version and ZLIB_VERSION are the same.
37 is Compress::Zlib::zlib_version, ZLIB_VERSION ;
43 print "#\n#Length $i\n#\n";
45 my $hello = "I am a HAL 9000 computer" x 2001;
50 while $tmp =~ s/^(.{$i})//;
51 push @hello, $tmp if length $tmp ;
53 my ($err, $x, $X, $status);
55 ok( ($x, $err) = new Compress::Zlib::Deflate (-AppendOutput => 1));
57 cmp_ok $err, '==', Z_OK, " status is Z_OK" ;
59 ok ! defined $x->msg(), " no msg" ;
60 is $x->total_in(), 0, " total_in == 0" ;
61 is $x->total_out(), 0, " total_out == 0" ;
66 $status = $x->deflate($_, $out) ;
67 last unless $status == Z_OK ;
70 cmp_ok $status, '==', Z_OK, " status is Z_OK" ;
72 cmp_ok $x->flush($out), '==', Z_OK, " flush returned Z_OK" ;
74 ok ! defined $x->msg(), " no msg" ;
75 is $x->total_in(), length $hello, " length total_in" ;
76 is $x->total_out(), length $out, " length total_out" ;
80 push @Answer, $1 while $tmp =~ s/^(.{$i})//;
81 push @Answer, $tmp if length $tmp ;
84 ok(($k, $err) = new Compress::Zlib::Inflate( -AppendOutput => 1));
86 cmp_ok $err, '==', Z_OK, " status is Z_OK" ;
88 ok ! defined $k->msg(), " no msg" ;
89 is $k->total_in(), 0, " total_in == 0" ;
90 is $k->total_out(), 0, " total_out == 0" ;
96 $status = $k->inflate($_, $GOT) ;
97 last if $status == Z_STREAM_END or $status != Z_OK ;
101 cmp_ok $status, '==', Z_STREAM_END, " status is Z_STREAM_END" ;
102 is $GOT, $hello, " got expected output" ;
103 ok ! defined $k->msg(), " no msg" ;
104 is $k->total_in(), length $out, " length total_in ok" ;
105 is $k->total_out(), length $hello, " length total_out ok" ;