tests/falsecolor_test.pl
changeset 22 617fa1f9ccb3
parent 20 a29baf51b980
equal deleted inserted replaced
21:3ea159f28920 22:617fa1f9ccb3
    38 my $total = 0;
    38 my $total = 0;
    39 my $fail = 0;
    39 my $fail = 0;
    40 my $index = 0;
    40 my $index = 0;
    41 my $opts;
    41 my $opts;
    42 foreach $opts (@options) {
    42 foreach $opts (@options) {
    43 		my $stdin = @$opts[0];
    43 	my $stdin = @$opts[0];
    44 		my $args = @$opts[1];
    44 	my $args = @$opts[1];
    45 		$total++;
    45 	$total++;
    46 
    46 
    47 		my $cshout = "$tmpdir/${script}_csh$index.hdr";
    47 	my $cshout = "$tmpdir/${script}_csh$index.hdr";
    48 		my $cshcmd = "$script.csh $args > $cshout";
    48 	my $cshcmd = "$script.csh $args > $cshout";
    49 		print " $stdin $cshcmd\n";
    49 	print " $stdin $cshcmd\n";
    50 		system "$stdin csh ../orig/$cshcmd";
    50 	system "$stdin csh ../orig/$cshcmd";
    51 
    51 
    52 		my $perlout = "$tmpdir/${script}_perl$index.hdr";
    52 	my $perlout = "$tmpdir/${script}_perl$index.hdr";
    53 		my $perlcmd = "$script.pl $args > $perlout";
    53 	my $perlcmd = "$script.pl $args > $perlout";
    54 		print " $stdin $perlcmd\n";
    54 	print " $stdin $perlcmd\n";
    55 		system "$stdin perl ../bin/$perlcmd";
    55 	system "$stdin perl ../bin/$perlcmd";
    56 
    56 
    57 		my $diffimg = "$tmpdir/${script}_diff$index.hdr";
    57 	my $diffimg = "$tmpdir/${script}_diff$index.hdr";
    58 		my $uval = &compare_images("$cshout", "$perlout", "$diffimg");
    58 	my $uval = &compare_images("$cshout", "$perlout", "$diffimg");
    59 		if( $uval > 0 ) {
    59 	if( $uval > 0 ) {
    60 			print "      Error: Diff image $diffimg contains $uval unique values (should be one).\n";
    60 		print "      Error: Diff image $diffimg contains $uval unique values (should be one).\n";
    61 			system "ximage $diffimg";
    61 		system "ximage $diffimg";
    62 			$fail++;
    62 		$fail++;
    63 		} else {
    63 	} else {
    64 			print "      Ok: Images $cshout and $perlout are identical.\n";
    64 		print "      Ok: Images $cshout and $perlout are identical.\n";
    65 		}
    65 	}
    66 }
    66 }
    67 
    67 
    68 print "$fail of $total tests failed.\n";
    68 print "$fail of $total tests failed.\n";
    69 print "temp dir $tmpdir not removed. Please remove manually.\n";
    69 print "temp dir $tmpdir not removed. Please remove manually.\n";
    70 
    70