tests/objview_test.pl
author Axel Jacobs <axel@jaloxa.eu>
Mon, 27 Jun 2011 21:17:24 +0100
changeset 25 9bae974f3ebd
parent 21 3ea159f28920
permissions -rw-r--r--
Added a second RGBE and a XYZE image to test data.

#!/usr/bin/perl

# objview_test.pl
# This file is part of the testsuite of the Radiance csh2perl project.
# You may copy and modify this file as basis for other tests.
#
# (c) Axel Jacobs, 27 June 2011

use strict;
use warnings;

my $script = "objview";
my $csh = "../orig/$script.csh";
my $perl = "../bin/$script.perl";
print "script: $script\n";

my $object = "data/objects/mybox.rad";
my $material = "data/objects/objects.mat";

# Options are arrays of [STDIN, command-line options].
# Please include the pipe symbol as part of STDIN.
# Put a leading space in front of STDIN to line up the output.
my @options = (
	["", "$material $object"],
	# [" cat $material $object |", ""],   # The old csh script doesn't like STDIN
	# Can't test OpenGL output on my system. Please add.
);

# Run old CSH and new Perl script with different options,
# compare the resulting images.
my $total = 0;
my $fail = 0;
my $index = 0;
my $opts;
foreach $opts (@options) {
	# Hmm, not sure how to compare old and new automatically without screen-shooting.
	my $stdin = @$opts[0];
	my $args = @$opts[1];
	$total++;

	my $cshcmd = "$script.csh $args";
	print " $stdin $cshcmd\n";
	system "$stdin csh ../orig/$cshcmd >/dev/null &";

	my $perlcmd = "$script.pl $args";
	print " $stdin $perlcmd\n";
	system "$stdin perl ../bin/$perlcmd >/dev/null &";

	print "    Please compare the two rvu displays. Are they identical [y/N]? ";
	my $identical = <>;
	chomp $identical;
	if( lc( $identical ) eq 'y' ) {
		print "      Ok: Output appears to be identical.\n";
	} else {
		print "      Error: Output appears to be different.\n";
		$fail++;
	}
}

print "$fail of $total tests failed.\n";

#EOF