1use IO::Zlib; 2 3sub ok 4{ 5 my ($no, $ok) = @_ ; 6 7 #++ $total ; 8 #++ $totalBad unless $ok ; 9 10 print "ok $no\n" if $ok ; 11 print "not ok $no\n" unless $ok ; 12} 13 14print "1..10\n"; 15 16$hello = <<EOM ; 17hello world 18this is a test 19EOM 20 21$name = "test$$"; 22 23if (open(FH, ">$name")) { 24 binmode FH; 25 print FH $hello; 26 close FH; 27} else { 28 die "$name: $!"; 29} 30 31ok(1, $file = IO::Zlib->new()); 32ok(2, $file->open($name, "rb")); 33ok(3, !$file->eof()); 34ok(4, $file->read($uncomp, 1024) == length($hello)); 35ok(5, $file->eof()); 36ok(6, $file->opened()); 37ok(7, $file->close()); 38ok(8, !$file->opened()); 39 40unlink($name); 41 42ok(9, $hello eq $uncomp); 43 44ok(10, !defined(IO::Zlib->new($name, "rb"))); 45 46