13 #++ $totalBad unless $ok ;
15 print "ok $no\n" if $ok ;
16 print "not ok $no\n" unless $ok ;
24 open (F, "<$filename")
25 or die "Cannot open $filename: $!\n" ;
38 my $len = length $hello ;
43 # Check zlib_version and ZLIB_VERSION are the same.
44 ok(1, Compress::Zlib::zlib_version eq ZLIB_VERSION) ;
47 # gzip - filehandle tests
48 # ========================
52 my $filename = "fh.gz" ;
53 my $hello = "hello, hello, I'm back again" ;
54 my $len = length $hello ;
56 my $f = new IO::File ">$filename" ;
57 binmode $f ; # for OS/2
61 my $line_one = "first line\n" ;
64 ok(3, my $fil = gzopen($f, "wb")) ;
66 ok(4, $fil->gzwrite($hello) == $len) ;
68 ok(5, ! $fil->gzclose ) ;
71 ok(6, my $g = new IO::File "<$filename") ;
72 binmode $g ; # for OS/2
75 my $ret = read($g, $first, length($line_one));
76 ok(7, $ret == length($line_one));
78 ok(8, $first eq $line_one) ;
80 ok(9, $fil = gzopen($g, "rb") ) ;
82 ok(10, (my $x = $fil->gzread($uncomp)) == $len) ;
84 ok(11, ! $fil->gzclose ) ;
88 ok(12, $hello eq $uncomp) ;
93 my $filename = "fh.gz" ;
94 my $hello = "hello, hello, I'm back again" ;
95 my $len = length $hello ;
100 ok(13, open FH1, ">$filename") ;
101 binmode FH1; # for OS/2
103 my $line_one = "first line\n" ;
106 ok(14, my $fil = gzopen(\*FH1, "wb")) ;
108 ok(15, $fil->gzwrite($hello) == $len) ;
110 ok(16, ! $fil->gzclose ) ;
113 ok(17, my $g = open FH2, "<$filename") ;
114 binmode FH2; # for OS/2
117 my $ret = read(FH2, $first, length($line_one));
118 ok(18, $ret == length($line_one));
120 ok(19, $first eq $line_one) ;
122 ok(20, $fil = gzopen(*FH2, "rb") ) ;
123 ok(21, (my $x = $fil->gzread($uncomp)) == $len) ;
125 ok(22, ! $fil->gzclose ) ;
129 ok(23, $hello eq $uncomp) ;