aboutsummaryrefslogtreecommitdiffstats
path: root/libtests/qtest
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2017-08-16 12:26:31 +0200
committerJay Berkenbilt <ejb@ql.org>2017-08-19 20:50:55 +0200
commit2d2f61966525cb948bcb6307cccbc3493b1825b5 (patch)
tree862dbdd156d2af563d0d20f755f7abeb2c200889 /libtests/qtest
parente0d1cd1f4b2de30967f9c70460c2d0765f003676 (diff)
downloadqpdf-2d2f61966525cb948bcb6307cccbc3493b1825b5.tar.zst
Implement Pl_RunLength pipeline
Diffstat (limited to 'libtests/qtest')
-rw-r--r--libtests/qtest/runlength.test75
-rw-r--r--libtests/qtest/runlength/011
-rw-r--r--libtests/qtest/runlength/01.encoded1
-rw-r--r--libtests/qtest/runlength/021
-rw-r--r--libtests/qtest/runlength/02.encoded1
-rw-r--r--libtests/qtest/runlength/03bin0 -> 516 bytes
-rw-r--r--libtests/qtest/runlength/03.encodedbin0 -> 275 bytes
-rw-r--r--libtests/qtest/runlength/041
-rw-r--r--libtests/qtest/runlength/04.encoded1
-rw-r--r--libtests/qtest/runlength/051
-rw-r--r--libtests/qtest/runlength/05.encoded1
-rw-r--r--libtests/qtest/runlength/empty.encoded1
12 files changed, 84 insertions, 0 deletions
diff --git a/libtests/qtest/runlength.test b/libtests/qtest/runlength.test
new file mode 100644
index 00000000..26b6155d
--- /dev/null
+++ b/libtests/qtest/runlength.test
@@ -0,0 +1,75 @@
+#!/usr/bin/env perl
+require 5.008;
+use warnings;
+use strict;
+
+chdir("runlength") or die "chdir testdir failed: $!\n";
+
+require TestDriver;
+
+my $td = new TestDriver('runlength');
+
+cleanup();
+
+my @files = (
+ "01", # basic case, ends with copy
+ "02", # basic case, ends with run
+ "03", # long run run
+ "04", # ends with copy, length % 128 == 0
+ "05", # run starts at byte 128
+ "empty", # empty file
+ );
+
+# Create this rather than committing an empty file, which always looks
+# like an error.
+open(F, ">empty");
+close(F);
+
+foreach my $f (@files)
+{
+ $td->runtest("encode $f",
+ {$td->COMMAND => "runlength -encode $f a"},
+ {$td->STRING => "", $td->EXIT_STATUS => 0});
+ $td->runtest("check encoded output",
+ {$td->FILE => "a"},
+ {$td->FILE => "$f.encoded"});
+ $td->runtest("decode $f.encoded",
+ {$td->COMMAND => "runlength -decode $f.encoded a"},
+ {$td->STRING => "", $td->EXIT_STATUS => 0});
+ $td->runtest("check decoded output",
+ {$td->FILE => "a"},
+ {$td->FILE => "$f"});
+}
+
+concatenate("01.encoded", "02.encoded", "concat.encoded");
+concatenate("01", "02", "concat");
+
+$td->runtest("decode with embedded EOD",
+ {$td->COMMAND => "runlength -decode concat.encoded a"},
+ {$td->STRING => "", $td->EXIT_STATUS => 0});
+$td->runtest("check decoded output",
+ {$td->FILE => "a"},
+ {$td->FILE => "concat"});
+
+cleanup();
+
+$td->report(2 + (4 * scalar(@files)));
+
+sub cleanup
+{
+ system("rm -f a concat concat.encoded empty");
+}
+
+sub concatenate
+{
+ my ($a, $b, $out) = @_;
+ open(F, ">$out");
+ foreach my $f ($a, $b)
+ {
+ local $/ = undef;
+ open(G, "<$f");
+ print F <G>;
+ close(G);
+ }
+ close(F);
+}
diff --git a/libtests/qtest/runlength/01 b/libtests/qtest/runlength/01
new file mode 100644
index 00000000..c39144df
--- /dev/null
+++ b/libtests/qtest/runlength/01
@@ -0,0 +1 @@
+wwwwwwwwwwwwwwwwwwwwwwwwwqqqqqrstv \ No newline at end of file
diff --git a/libtests/qtest/runlength/01.encoded b/libtests/qtest/runlength/01.encoded
new file mode 100644
index 00000000..fc26c6f6
--- /dev/null
+++ b/libtests/qtest/runlength/01.encoded
@@ -0,0 +1 @@
+čwüqrstv€ \ No newline at end of file
diff --git a/libtests/qtest/runlength/02 b/libtests/qtest/runlength/02
new file mode 100644
index 00000000..b5d6cfc8
--- /dev/null
+++ b/libtests/qtest/runlength/02
@@ -0,0 +1 @@
+wwwwwwwwwwwwwwwwwwwwwwwwwqqqqqrstvxxxxxxxxxxxxxxxxxxxxxxx \ No newline at end of file
diff --git a/libtests/qtest/runlength/02.encoded b/libtests/qtest/runlength/02.encoded
new file mode 100644
index 00000000..85bb323e
--- /dev/null
+++ b/libtests/qtest/runlength/02.encoded
@@ -0,0 +1 @@
+čwüqrstvęx€ \ No newline at end of file
diff --git a/libtests/qtest/runlength/03 b/libtests/qtest/runlength/03
new file mode 100644
index 00000000..b8dbdb28
--- /dev/null
+++ b/libtests/qtest/runlength/03
Binary files differ
diff --git a/libtests/qtest/runlength/03.encoded b/libtests/qtest/runlength/03.encoded
new file mode 100644
index 00000000..0fac6b58
--- /dev/null
+++ b/libtests/qtest/runlength/03.encoded
Binary files differ
diff --git a/libtests/qtest/runlength/04 b/libtests/qtest/runlength/04
new file mode 100644
index 00000000..9ad537ac
--- /dev/null
+++ b/libtests/qtest/runlength/04
@@ -0,0 +1 @@
+wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab \ No newline at end of file
diff --git a/libtests/qtest/runlength/04.encoded b/libtests/qtest/runlength/04.encoded
new file mode 100644
index 00000000..0c97dde2
--- /dev/null
+++ b/libtests/qtest/runlength/04.encoded
@@ -0,0 +1 @@
+wabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab€ \ No newline at end of file
diff --git a/libtests/qtest/runlength/05 b/libtests/qtest/runlength/05
new file mode 100644
index 00000000..979bf52b
--- /dev/null
+++ b/libtests/qtest/runlength/05
@@ -0,0 +1 @@
+ababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababbbbbb \ No newline at end of file
diff --git a/libtests/qtest/runlength/05.encoded b/libtests/qtest/runlength/05.encoded
new file mode 100644
index 00000000..2a645eef
--- /dev/null
+++ b/libtests/qtest/runlength/05.encoded
@@ -0,0 +1 @@
+~abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababaűb€ \ No newline at end of file
diff --git a/libtests/qtest/runlength/empty.encoded b/libtests/qtest/runlength/empty.encoded
new file mode 100644
index 00000000..5416677b
--- /dev/null
+++ b/libtests/qtest/runlength/empty.encoded
@@ -0,0 +1 @@
+€ \ No newline at end of file