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