# HG changeset patch # User Axel Jacobs # Date 1309291567 -3600 # Node ID eef8e42d689cbdb5ca6ace744458598b19260f8a # Parent a9f74601ca3c11ab65d27a41cd84abd3f3a1f368 Added test for xyzimage. diff -r a9f74601ca3c -r eef8e42d689c tests/xyzimage_test.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/xyzimage_test.pl Tue Jun 28 21:06:07 2011 +0100 @@ -0,0 +1,62 @@ +#!/usr/bin/perl + +# xyzimage_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, 28 June 2011 + +use strict; +use warnings; + +my $script = "xyzimage"; +my $csh = "../orig/$script.csh"; +my $perl = "../bin/$script.perl"; +print "script: $script\n"; + +my $img = "data/images/street-xyze_rle_400x400.hdr"; + +# 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 = ( + ["", "$img"], + ["", "-g 1.0 $img"], + ["", "-p 0.65 0.25 0.15 0.75 0.15 0.2 0.4 0.35 $img"], + ["", "-p 0.5 0.25 0.15 0.75 0.15 0.2 0.4 0.35 $img"], +); + +# 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