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