xref: /openbsd/gnu/usr.bin/perl/cpan/IO-Zlib/t/large.t (revision f2a19305)
1use strict;
2use warnings;
3
4use IO::Zlib;
5
6sub ok
7{
8    my ($no, $ok) = @_ ;
9    print "ok $no\n" if $ok ;
10    print "not ok $no\n" unless $ok ;
11}
12
13my $name = "test_large_$$.gz";
14
15print "1..7\n";
16
17my $contents = "";
18
19foreach (1 .. 5000)
20{
21     $contents .= chr(int(rand(255)));
22}
23
24my $file;
25
26ok(1, $file = IO::Zlib->new($name, "wb"));
27ok(2, $file->print($contents));
28ok(3, $file->close());
29
30my $uncomp;
31
32ok(4, $file = IO::Zlib->new($name, "rb"));
33ok(5, $file->read($uncomp, 8192) == length($contents));
34ok(6, $file->close());
35
36unlink($name);
37
38ok(7, $contents eq $uncomp);
39