#!/bin/sh

# Run the tests
set -x

mv -f moss-world.pix moss-world.pix.$$
mv -f moss-world.log moss-world.log.$$
../rt/rt -M -f512 -o moss-world.pix ../db/moss-world.g all.g LIGHT \
	2> moss-world.log << EOF
1.572026215e+02
6.379990387e+01 3.271768951e+01 3.366661453e+01
-5.735764503e-01 8.191520572e-01 0.000000000e+00 
0.000000000e+00 -3.461886346e-01 -2.424038798e-01 9.063078165e-01 
0.000000000e+00 7.424039245e-01 5.198368430e-01 4.226182699e-01 
0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 
1.000000000e+00 
EOF
cmp ../pix/moss-world.pix moss-world.pix
if test $? = 0
then
	echo moss-world.pix:  RIGHT answers
else
	echo moss-world.pix:  WRONG WRONG WRONG
fi


mv -f star.pix star.pix.$$
mv -f star.log star.log.$$
../rt/rt -M -f512 -o star.pix ../db/star.g all LIGHT 2> star.log <<EOF
6.350000000e+03
4.800976563e+03 2.412207764e+03 3.230107727e+02
-6.733560562e-01 6.130643487e-01 4.132114947e-01 
0.000000000e+00 5.539599657e-01 4.823888093e-02 8.311441541e-01 
0.000000000e+00 4.896120727e-01 7.885590792e-01 -3.720948100e-01 
0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 
1.000000000e+00 
EOF
cmp ../pix/star.pix star.pix
if test $? = 0
then
	echo star.pix:  RIGHT answers
else
	echo star.pix:  WRONG WRONG WRONG
fi


mv -f building.pix building.pix.$$
mv -f building.log building.log.$$
../rt/rt -M -f512 -o building.pix ../db/building.g newfloor1 newfloor2 LIGHT \
	2> building.log <<EOF
1.800000000e+03
6.345012207e+02 8.633251343e+02 8.310771484e+02
-5.735764503e-01 8.191520572e-01 0.000000000e+00 
0.000000000e+00 -3.461886346e-01 -2.424038798e-01 9.063078165e-01 
0.000000000e+00 7.424039245e-01 5.198368430e-01 4.226182699e-01 
0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 
1.000000000e+00 
EOF
cmp ../pix/building.pix building.pix
if test $? = 0
then
	echo building.pix:  RIGHT answers
else
	echo building.pix:  WRONG WRONG WRONG
fi

echo Testing complete, check your times against the VAX log files in ../pix/.
