2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-06-26 07:12:45 +00:00
qpdf/qpdf/qtest/many-nulls.test
Jay Berkenbilt 4f4b908605 Add a file with arrays with lots of nulls to the test suite
A bug was fixed between qpdf 8.4.2 and 9.0.0 regarding this type of
file (see #305 and #311), but it was necessary to retest after some
major refactoring work at the lexical and parsing layers. This lays
the groundwork for including this in performance benchmarks and in the
qpdf test suite rather than having to keep a large,
non-redistributable file around.

20 arrays of 20K nulls is plenty for performance memory testing and
doesn't take too long to run. Compared to qpdf 8.4.2, in qpdf 11.0.0,
the file generated here uses 3% of the RAM and runs over 4 times
faster.
2022-09-01 16:15:54 -04:00

35 lines
1019 B
Perl

#!/usr/bin/env perl
require 5.008;
use warnings;
use strict;
unshift(@INC, '.');
require qpdf_test_helpers;
chdir("qpdf") or die "chdir testdir failed: $!\n";
require TestDriver;
cleanup();
my $td = new TestDriver('many-nulls');
# The output of test_many_nulls is also used in performance testing.
# If it changes, consider whether it should be updated in
# performance-test-files as well. See performance_check at the top of
# the source tree.
$td->runtest("create file with many nulls",
{$td->COMMAND => "test_many_nulls a.pdf"},
{$td->STRING => "", $td->EXIT_STATUS => 0},
$td->NORMALIZE_NEWLINES);
$td->runtest("compare output",
{$td->FILE => "a.pdf"},
{$td->FILE => "many-nulls.pdf"},
$td->NORMALIZE_NEWLINES);
$td->runtest("run check file",
{$td->COMMAND => "qpdf --check a.pdf"},
{$td->FILE => "many-nulls.out", $td->EXIT_STATUS => 0},
$td->NORMALIZE_NEWLINES);
cleanup();
$td->report(3);