This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update Scalar-List-Utils to CPAN version 1.26
[perl5.git] / cpan / IO-Zlib / t / uncomp1.t
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 print "1..10\n";
15
16 $hello = <<EOM ;
17 hello world
18 this is a test
19 EOM
20
21 $name = "test$$";
22
23 if (open(FH, ">$name")) {
24     binmode FH;
25     print FH $hello;
26     close FH;
27 } else {
28     die "$name: $!";
29 }
30
31 ok(1, $file = IO::Zlib->new());
32 ok(2, $file->open($name, "rb"));
33 ok(3, !$file->eof());
34 ok(4, $file->read($uncomp, 1024) == length($hello));
35 ok(5, $file->eof());
36 ok(6, $file->opened());
37 ok(7, $file->close());
38 ok(8, !$file->opened());
39
40 unlink($name);
41
42 ok(9, $hello eq $uncomp);
43
44 ok(10, !defined(IO::Zlib->new($name, "rb")));
45