mirror of
https://github.com/qpdf/qpdf.git
synced 2024-11-18 10:25:12 +00:00
cb769c62e5
This comment expands all tabs using an 8-character tab-width. You should ignore this commit when using git blame or use git blame -w. In the early days, I used to use tabs where possible for indentation, since emacs did this automatically. In recent years, I have switched to only using spaces, which means qpdf source code has been a mixture of spaces and tabs. I have avoided cleaning this up because of not wanting gratuitous whitespaces change to cloud the output of git blame, but I changed my mind after discussing with users who view qpdf source code in editors/IDEs that have other tab widths by default and in light of the fact that I am planning to start applying automatic code formatting soon.
75 lines
1.6 KiB
Perl
75 lines
1.6 KiB
Perl
#!/usr/bin/env perl
|
|
require 5.008;
|
|
BEGIN { $^W = 1; }
|
|
use strict;
|
|
use File::Copy;
|
|
use Digest::MD5;
|
|
|
|
chdir("flate") or die "chdir testdir failed: $!\n";
|
|
|
|
require TestDriver;
|
|
|
|
cleanup();
|
|
|
|
my $td = new TestDriver('flate');
|
|
|
|
cleanup();
|
|
|
|
open(F, ">farbage") or die;
|
|
binmode F;
|
|
print F "q" x 10000, "\n";
|
|
print F "w" x 10000, "\n";
|
|
print F "e" x 10000, "\n";
|
|
print F "r" x 10000, "\n";
|
|
print F "t" x 10000, "\n";
|
|
print F "y" x 10000, "\n";
|
|
print F "u" x 10000, "\n";
|
|
print F "i" x 10000, "\n";
|
|
print F "o" x 10000, "\n";
|
|
print F "p" x 10000, "\n";
|
|
close(F);
|
|
|
|
check_file("farbage", "a6449c61db5b0645c0693b7560b77a60");
|
|
|
|
$td->runtest("run driver",
|
|
{$td->COMMAND => "flate farbage"},,
|
|
{$td->STRING => "bytes written to o3: 100010\ndone\n",
|
|
$td->EXIT_STATUS => 0},
|
|
$td->NORMALIZE_NEWLINES);
|
|
|
|
check_file("farbage", "a6449c61db5b0645c0693b7560b77a60");
|
|
|
|
$td->runtest("compressed file correct",
|
|
{$td->FILE => "farbage.1"},
|
|
{$td->FILE => "compressed"});
|
|
|
|
$td->runtest("uncompress filter works",
|
|
{$td->FILE => "farbage"},
|
|
{$td->FILE => "farbage.2"});
|
|
|
|
$td->runtest("double filter works",
|
|
{$td->FILE => "farbage"},
|
|
{$td->FILE => "farbage.3"});
|
|
|
|
cleanup();
|
|
|
|
$td->report(6);
|
|
|
|
sub cleanup
|
|
{
|
|
system("rm -f farbage*");
|
|
}
|
|
|
|
sub check_file
|
|
{
|
|
my ($file, $sum) = @_;
|
|
open(F, "<$file") or die "open $file";
|
|
my $md5 = new Digest::MD5;
|
|
$md5->addfile(*F);
|
|
close(F);
|
|
my $result = $md5->hexdigest;
|
|
$td->runtest("check $file",
|
|
{$td->STRING => "$result\n"},
|
|
{$td->STRING => "$sum\n"});
|
|
}
|