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 14$name="test.gz"; 15 16print "1..7\n"; 17 18$contents = ""; 19 20foreach (1 .. 5000) 21{ 22 $contents .= chr(int(rand(255))); 23} 24 25ok(1, $file = IO::Zlib->new($name, "wb")); 26ok(2, $file->print($contents)); 27ok(3, $file->close()); 28 29ok(4, $file = IO::Zlib->new($name, "rb")); 30ok(5, $file->read($uncomp, 8192) == length($contents)); 31ok(6, $file->close()); 32 33unlink($name); 34 35ok(7, $contents eq $uncomp); 36