10 #++ $totalBad unless $ok ;
12 print "ok $no\n" if $ok ;
13 print "not ok $no\n" unless $ok ;
14 printf "# Failed test at line %d\n", (caller)[2] unless $ok ;
19 my($filename, @strings) = @_ ;
20 open (F, ">$filename")
21 or die "Cannot open $filename: $!\n" ;
33 open (F, "<$filename")
34 or die "Cannot open $filename: $!\n" ;
45 $Inc = '-"I[.blib.lib]" -"I[.blib.arch]"';
47 elsif ($^O eq 'MSWin32') {
49 { $Inc .= qq["-I$_" ]}
57 $Perl = ($ENV{'FULLPERL'} or $^X or 'perl') ;
58 $Perl = qq["$Perl"] if $^O eq 'MSWin32' ;
61 my $examples = $ENV{PERL_CORE} ? "../ext/Compress/Zlib/examples" : "./examples";
73 my @hello1 = grep(s/$/\n/, split(/\n/, $hello1)) ;
86 my @hello2 = grep(s/$/\n/, split(/\n/, $hello2)) ;
95 my $file1 = "hello1.gz" ;
96 my $file2 = "hello2.gz" ;
97 unlink $file1, $file2 ;
99 my $hello1_uue = <<'EOM';
100 M'XL("(W#+3$" VAE;&QO,0#+2,W)R><JR<@L5@ BKD2%DM3B$J[<U.+BQ/14
101 ;K@J%$A#@JB@% Z"Z5(74O!0N &D:".,V
104 my $hello2_uue = <<'EOM';
105 M'XL("*[#+3$" VAE;&QO,@#C\L@O3ZGD*LG(+%8 HI*,5*[BU.3\O!2NM,R<
106 A5*X*A0(0X*HH!0.NHM3$G)Q*D#*%5* : #) E6<^
109 # Write a test .gz file
112 writeFile($file1, unpack("u", $hello1_uue)) ;
113 writeFile($file2, unpack("u", $hello2_uue)) ;
117 $a = `$Perl $Inc ${examples}/gzcat $file1 $file2 2>&1` ;
120 ok(2, $a eq $hello1 . $hello2) ;
121 #print "? = $? [$a]\n";
127 $a = ($^O eq 'MSWin32' || $^O eq 'VMS'
128 ? `$Perl $Inc ${examples}/gzgrep "^x" $file1 $file2 2>&1`
129 : `$Perl $Inc ${examples}/gzgrep '^x' $file1 $file2 2>&1`) ;
132 ok(4, $a eq join('', grep(/^x/, @hello1, @hello2))) ;
133 #print "? = $? [$a]\n";
136 unlink $file1, $file2 ;
143 my $stderr = "err.out" ;
145 writeFile($file1, $hello1) ;
146 writeFile($file2, $hello2) ;
148 # there's no way to set binmode on backticks in Win32 so we won't use $a later
149 $a = `$Perl $Inc ${examples}/filtdef $file1 $file2 2>$stderr` ;
151 ok(6, -s $stderr == 0) ;
154 $a = `$Perl $Inc ${examples}/filtdef $file1 $file2 | $Perl $Inc ${examples}/filtinf 2>$stderr`;
156 ok(8, -s $stderr == 0) ;
157 ok(9, $a eq $hello1 . $hello2) ;
163 writeFile($file1, $hello1) ;
164 $a = `$Perl $Inc ${examples}/gzstream <$file1 >$file2 2>$stderr` ;
166 ok(11, -s $stderr == 0) ;
168 my $b = `$Perl $Inc ${examples}/gzcat $file2 2>&1` ;
170 ok(13, $b eq $hello1 ) ;
174 unlink $file1, $file2, $stderr ;