Commit 513ed692342ce2d98d4d505ade3d7b5d329d6c65

Authored by Jay Berkenbilt
1 parent a80e1a57

zlib-flate: make test work with alternative zlib

zlib-flate/qtest/1.compressed-1 deleted
No preview for this file type
zlib-flate/qtest/1.compressed-9 deleted
No preview for this file type
zlib-flate/qtest/zf.test
... ... @@ -7,22 +7,40 @@ require TestDriver;
7 7  
8 8 my $td = new TestDriver('zlib-flate');
9 9  
  10 +cleanup();
  11 +
  12 +open(F, "<1.uncompressed") or die;
  13 +undef $/;
  14 +my $unc = <F>;
  15 +close(F);
  16 +
  17 +open(F, ">a.uncompressed") or die;
  18 +for (my $i = 0; $i < 100; $i++)
  19 +{
  20 + print F $unc;
  21 +}
  22 +close(F);
  23 +
10 24 foreach my $level ('', '=1', '=9')
11 25 {
12 26 my $f = $level;
13 27 $f =~ s/=/-/;
14 28 $td->runtest("compress",
15 29 {$td->COMMAND =>
16   - "zlib-flate -compress$level < 1.uncompressed"},
17   - {$td->FILE => "1.compressed$f",
18   - $td->EXIT_STATUS => 0});
  30 + "zlib-flate -compress$level < a.uncompressed > a.$level"},
  31 + {$td->STRING => "", $td->EXIT_STATUS => 0});
19 32  
20 33 $td->runtest("uncompress",
21   - {$td->COMMAND => "zlib-flate -uncompress < 1.compressed"},
22   - {$td->FILE => "1.uncompressed",
23   - $td->EXIT_STATUS => 0});
  34 + {$td->COMMAND => "zlib-flate -uncompress < a.$level"},
  35 + {$td->FILE => "a.uncompressed", $td->EXIT_STATUS => 0});
24 36 }
25 37  
  38 +my $size1 = (stat("a.=1"))[7];
  39 +my $size9 = (stat("a.=9"))[7];
  40 +$td->runtest("higher compression is smaller",
  41 + {$td->STRING => ($size9 < $size1 ? "YES\n" : "$size9 $size1\n")},
  42 + {$td->STRING => "YES\n"});
  43 +
26 44 $td->runtest("error",
27 45 {$td->COMMAND => "zlib-flate -uncompress < 1.uncompressed"},
28 46 {$td->REGEXP => "flate: inflate: data: .*\n",
... ... @@ -36,4 +54,11 @@ $td-&gt;runtest(&quot;corrupted input&quot;,
36 54 $td->EXIT_STATUS => 3},
37 55 $td->NORMALIZE_NEWLINES);
38 56  
39   -$td->report(8);
  57 +$td->report(9);
  58 +
  59 +cleanup();
  60 +
  61 +sub cleanup
  62 +{
  63 + system("rm -f a.*");
  64 +}
... ...