2008-04-29 12:55:25 +00:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
require 5.008;
|
|
|
|
BEGIN { $^W = 1; }
|
|
|
|
use strict;
|
|
|
|
use File::Copy;
|
|
|
|
use Digest::MD5;
|
|
|
|
|
2018-01-13 19:32:39 +00:00
|
|
|
chdir("predictors") or die "chdir testdir failed: $!\n";
|
2008-04-29 12:55:25 +00:00
|
|
|
|
|
|
|
require TestDriver;
|
|
|
|
|
2018-01-13 19:32:39 +00:00
|
|
|
my $td = new TestDriver('predictors');
|
2008-04-29 12:55:25 +00:00
|
|
|
|
|
|
|
cleanup();
|
|
|
|
|
|
|
|
$td->runtest("decode columns = 4",
|
2018-01-13 19:32:39 +00:00
|
|
|
{$td->COMMAND => "predictors png decode in1 4 1 8"},
|
2008-04-29 12:55:25 +00:00
|
|
|
{$td->STRING => "done\n",
|
|
|
|
$td->EXIT_STATUS => 0},
|
|
|
|
$td->NORMALIZE_NEWLINES);
|
|
|
|
|
|
|
|
$td->runtest("check output",
|
|
|
|
{$td->FILE => "out"},
|
|
|
|
{$td->FILE => "out1"});
|
|
|
|
|
|
|
|
$td->runtest("decode columns = 5",
|
2018-01-13 19:32:39 +00:00
|
|
|
{$td->COMMAND => "predictors png decode in2 5 1 8"},
|
2008-04-29 12:55:25 +00:00
|
|
|
{$td->STRING => "done\n",
|
|
|
|
$td->EXIT_STATUS => 0},
|
|
|
|
$td->NORMALIZE_NEWLINES);
|
|
|
|
|
|
|
|
$td->runtest("check output",
|
|
|
|
{$td->FILE => "out"},
|
|
|
|
{$td->FILE => "out2"});
|
|
|
|
|
|
|
|
$td->runtest("encode columns = 4",
|
2018-01-13 19:32:39 +00:00
|
|
|
{$td->COMMAND => "predictors png encode out1 4 1 8"},
|
2008-04-29 12:55:25 +00:00
|
|
|
{$td->STRING => "done\n",
|
|
|
|
$td->EXIT_STATUS => 0},
|
|
|
|
$td->NORMALIZE_NEWLINES);
|
|
|
|
|
|
|
|
$td->runtest("check output",
|
|
|
|
{$td->FILE => "out"},
|
|
|
|
{$td->FILE => "in1"});
|
|
|
|
|
|
|
|
$td->runtest("encode columns = 5",
|
2018-01-13 19:32:39 +00:00
|
|
|
{$td->COMMAND => "predictors png encode out2 5 1 8"},
|
2008-04-29 12:55:25 +00:00
|
|
|
{$td->STRING => "done\n",
|
|
|
|
$td->EXIT_STATUS => 0},
|
|
|
|
$td->NORMALIZE_NEWLINES);
|
|
|
|
|
|
|
|
$td->runtest("check output",
|
|
|
|
{$td->FILE => "out"},
|
|
|
|
{$td->FILE => "in2"});
|
|
|
|
|
2018-01-13 19:15:20 +00:00
|
|
|
my @other_png = (
|
2017-12-25 15:27:45 +00:00
|
|
|
'01--32-3-16',
|
|
|
|
'02--32-1-8',
|
|
|
|
'03--32-3-8',
|
|
|
|
'04--32-1-8',
|
|
|
|
'05--32-3-8',
|
|
|
|
'06--32-1-8',
|
|
|
|
'07--32-3-8',
|
|
|
|
'08--32-1-8',
|
|
|
|
'09--32-3-8',
|
|
|
|
'10--32-1-8',
|
|
|
|
'11--32-3-8',
|
|
|
|
'12--32-1-4',
|
|
|
|
);
|
|
|
|
|
2018-01-13 19:15:20 +00:00
|
|
|
foreach my $i (@other_png)
|
2017-12-25 15:27:45 +00:00
|
|
|
{
|
|
|
|
$i =~ m/^.*?--(\d+)-(\d+)-(\d+)$/ or die;
|
|
|
|
my $columns = $1;
|
|
|
|
my $samples_per_pixel = $2;
|
|
|
|
my $bits_per_sample = $3;
|
|
|
|
$td->runtest("decode $i",
|
2018-01-13 19:32:39 +00:00
|
|
|
{$td->COMMAND => "predictors png decode $i.data" .
|
2017-12-25 15:27:45 +00:00
|
|
|
" $columns $samples_per_pixel $bits_per_sample"},
|
|
|
|
{$td->STRING => "done\n",
|
|
|
|
$td->EXIT_STATUS => 0},
|
|
|
|
$td->NORMALIZE_NEWLINES);
|
|
|
|
$td->runtest("check output for $i",
|
|
|
|
{$td->FILE => "out"},
|
|
|
|
{$td->FILE => "$i.decoded"});
|
|
|
|
}
|
|
|
|
|
2018-01-13 19:15:20 +00:00
|
|
|
my @tiff = (
|
|
|
|
'01--16-1-8',
|
|
|
|
'02--8-2-4',
|
|
|
|
'03--4-1-16',
|
|
|
|
);
|
|
|
|
|
|
|
|
foreach my $i (@tiff)
|
|
|
|
{
|
|
|
|
$i =~ m/^.*?--(\d+)-(\d+)-(\d+)$/ or die;
|
|
|
|
my $columns = $1;
|
|
|
|
my $samples_per_pixel = $2;
|
|
|
|
my $bits_per_sample = $3;
|
|
|
|
$td->runtest("decode tiff $i",
|
|
|
|
{$td->COMMAND => "predictors tiff decode tiff-$i.data" .
|
|
|
|
" $columns $samples_per_pixel $bits_per_sample"},
|
|
|
|
{$td->STRING => "done\n",
|
|
|
|
$td->EXIT_STATUS => 0},
|
|
|
|
$td->NORMALIZE_NEWLINES);
|
|
|
|
$td->runtest("check output for tiff-$i",
|
|
|
|
{$td->FILE => "out"},
|
|
|
|
{$td->FILE => "tiff-$i.decoded"});
|
|
|
|
$td->runtest("encode tiff $i",
|
|
|
|
{$td->COMMAND => "predictors tiff encode tiff-$i.decoded" .
|
|
|
|
" $columns $samples_per_pixel $bits_per_sample"},
|
|
|
|
{$td->STRING => "done\n",
|
|
|
|
$td->EXIT_STATUS => 0},
|
|
|
|
$td->NORMALIZE_NEWLINES);
|
|
|
|
$td->runtest("check output for tiff-$i",
|
|
|
|
{$td->FILE => "out"},
|
|
|
|
{$td->FILE => "tiff-$i.data"});
|
|
|
|
}
|
|
|
|
|
2008-04-29 12:55:25 +00:00
|
|
|
cleanup();
|
|
|
|
|
2018-01-13 19:15:20 +00:00
|
|
|
$td->report(8 + (2 * scalar(@other_png)) + (4 * scalar(@tiff)));
|
2008-04-29 12:55:25 +00:00
|
|
|
|
|
|
|
sub cleanup
|
|
|
|
{
|
|
|
|
unlink "out";
|
|
|
|
}
|