xref: /openbsd-src/gnu/usr.bin/perl/cpan/IO-Zlib/t/getc.t (revision f2a19305cfc49ea4d1a5feb55cd6c283c6f1e031)
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_getc_$$.gz";
14
15print "1..10\n";
16
17my $text = "abcd";
18my $file;
19
20ok(1, $file = IO::Zlib->new($name, "wb"));
21ok(2, $file->print($text));
22ok(3, $file->close());
23
24ok(4, $file = IO::Zlib->new($name, "rb"));
25ok(5, $file->getc() eq substr($text,0,1));
26ok(6, $file->getc() eq substr($text,1,1));
27ok(7, $file->getc() eq substr($text,2,1));
28ok(8, $file->getc() eq substr($text,3,1));
29ok(9, $file->getc() eq "");
30ok(10, $file->close());
31
32unlink($name);
33