#!/bin/csh

set TESTS = "Navigation1 Navigation3 Navigation4 Navigation5 \
             Navigation6 Navigation7 Navigation8 Navigation9 \
             Navigation11 Navigation12 Navigation13 Navigation14"

if (-e ./failures) then
	echo "backing up failures file"
	mv failures failures.bak
endif

rm -f core
touch ./failures

foreach test ($TESTS)
	./$test
	if ($status != 0) then
		if (-e core) then
			echo "backing up core to "$test".core"
			mv core $test.core
		endif
		echo "failure in test: "$test
		echo $test >> failures
	endif
	
end

Navigation2 -u unmap -I Navigation2b.Dat
if ($status != 0) then
	if (-e core) then
		echo "backing up core to Navigation2a.core"
		mv core Navigation2a.core
	endif
	echo "failure in test: Navigation2a"
	echo "Navigation2a" >> failures
endif

Navigation2 -u unmanage -I Navigation2c.Dat
if ($status != 0) then
	if (-e core) then
		echo "backing up core to Navigation2b.core"
		mv core Navigation2b.core
	endif
	echo "failure in test: Navigation2b"
	echo "Navigation2b" >> failures
endif

Navigation2 -u insensitive -I Navigation2a.Dat
if ($status != 0) then
	if (-e core) then
		echo "backing up core to Navigation2c.core"
		mv core Navigation2c.core
	endif
	echo "failure in test: Navigation2c"
	echo "Navigation2c" >> failures
endif

Navigation2 -u destroy -I Navigation2c.Dat
if ($status != 0) then
	if (-e core) then
		echo "backing up core to Navigation2d.core"
		mv core Navigation2d.core
	endif
	echo "failure in test: Navigation2d"
	echo "Navigation2d" >> failures
endif

Navigation10 -u unmap
if ($status != 0) then
	if (-e core) then
		echo "backing up core to Navigation10a.core"
		mv core Navigation10a.core
	endif
	echo "failure in test: Navigation10a"
	echo "Navigation10a" >> failures
endif

Navigation10 -u unmanage
if ($status != 0) then
	if (-e core) then
		echo "backing up core to Navigation10b.core"
		mv core Navigation10b.core
	endif
	echo "failure in test: Navigation10b"
 	echo "Navigation10b" >> failures
endif

Navigation10 -u destroy 
if ($status != 0) then
	if (-e core) then
		echo "backing up core to Navigation10c.core"
		mv core Navigation10c.core
	endif
	echo "failure in test: Navigation10c"
	echo "Navigation10c" >> failures
endif
