mirror of
https://github.com/qpdf/qpdf.git
synced 2024-11-14 00:34:03 +00:00
82 lines
2.2 KiB
Perl
82 lines
2.2 KiB
Perl
#!/usr/bin/env perl
|
|
require 5.008;
|
|
use warnings;
|
|
use strict;
|
|
|
|
require TestDriver;
|
|
|
|
my $td = new TestDriver('numrange');
|
|
|
|
my @nrange_tests = (
|
|
[",5",
|
|
"error at * in numeric range *,5: unexpected separator",
|
|
2],
|
|
["4,,5",
|
|
"error at * in numeric range 4,*,5: unexpected separator",
|
|
2],
|
|
["4,5,",
|
|
"error at * in numeric range 4,5,*: number expected",
|
|
2],
|
|
["z1,",
|
|
"error at * in numeric range z*1,: digit not expected",
|
|
2],
|
|
["1z,",
|
|
"error at * in numeric range 1*z,: z not expected",
|
|
2],
|
|
["1-5?",
|
|
"error at * in numeric range 1-5*?: unexpected character",
|
|
2],
|
|
["1-30",
|
|
"error in numeric range 1-30: number 30 out of range",
|
|
2],
|
|
["1-10,0,5",
|
|
"error in numeric range 1-10,0,5: number 0 out of range",
|
|
2],
|
|
["1-10,1234,5",
|
|
"error in numeric range 1-10,1234,5: number 1234 out of range",
|
|
2],
|
|
["1,r,3",
|
|
"error in numeric range 1,r,3: number 16 out of range",
|
|
2],
|
|
["1,r16,3",
|
|
"error in numeric range 1,r16,3: number 0 out of range",
|
|
2],
|
|
["1,3,5-10,z-13,13,9,z,2,r2-r4",
|
|
"numeric range 1,3,5-10,z-13,13,9,z,2,r2-r4" .
|
|
" -> 1 3 5 6 7 8 9 10 15 14 13 13 9 15 2 14 13 12",
|
|
0],
|
|
["r1-r15", # r\d+ at end
|
|
"numeric range r1-r15" .
|
|
" -> 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1",
|
|
0],
|
|
["1-10:quack",
|
|
"error at * in numeric range 1-10*:quack: unexpected even/odd modifier",
|
|
2],
|
|
["1-10:",
|
|
"error at * in numeric range 1-10*:: unexpected even/odd modifier",
|
|
2],
|
|
["1-10,r:",
|
|
"error at * in numeric range 1-10,r*:: unexpected even/odd modifier",
|
|
2],
|
|
["1-10,:",
|
|
"error at * in numeric range 1-10,*:: unexpected colon",
|
|
2],
|
|
["1-6,8-12:odd",
|
|
"numeric range 1-6,8-12:odd -> 1 3 5 8 10 12",
|
|
0],
|
|
["1-6,8-12:even",
|
|
"numeric range 1-6,8-12:even -> 2 4 6 9 11",
|
|
0],
|
|
);
|
|
foreach my $d (@nrange_tests)
|
|
{
|
|
my ($range, $output, $status) = @$d;
|
|
$td->runtest("numeric range $range",
|
|
{$td->COMMAND => ['numrange', $range],
|
|
$td->FILTER => "grep 'numeric range'"},
|
|
{$td->STRING => $output . "\n", $td->EXIT_STATUS => $status},
|
|
$td->NORMALIZE_NEWLINES);
|
|
}
|
|
|
|
$td->report(scalar(@nrange_tests));
|