#!/bin/csh

set TESTS = "Form2 Form3 Form4 Form6 Form9 Form10 Form11 Form12 Form13 Form14 Form15 Form16 Form17 Form18 Form19 Form20 Form21 Form22 Form23 Form24 Form25 Form26 Form27 Form28 FormDia1 PanedWin1 PanedWin2 PanedWin3 PanedWin4 PanedWin5 PanedWin6 PanedWin7 PanedWin8 PanedWin9 PanedWin10 PanedWin11 PanedWin12 PanedWin13 PanedWin14 PanedWin15"

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

rm -f core
touch ./failures

Form1 -u xmPushButtonWidgetClass -I Form1a.Dat

	if ($status != 0) then
		if (-e core) then
			echo "backing up core to "$test".core"
			mv core $test.core
		endif
		echo "failure in test: Form1 case a"
		echo "Form1 case a" >> failures
	endif
	
Form1 -u xmArrowButtonWidgetClass -I Form1b.Dat
	if ($status != 0) then
		if (-e core) then
			echo "backing up core to "$test".core"
			mv core $test.core
		endif
		echo "failure in test: Form1 case b"
		echo "Form1 case b" >> failures
	endif

Form1 -u xmPushButtonWidgetClass -I Form1c.Dat
	if ($status != 0) then
		if (-e core) then
			echo "backing up core to "$test".core"
			mv core $test.core
		endif
		echo "failure in test: Form1 case c"
		echo "Form1 case c" >> failures
	endif

Form1 -u xmScaleWidgetClass -I Form1d.Dat -xrm "*XmScale*orientation: XmHORIZONTAL"
	if ($status != 0) then
		if (-e core) then
			echo "backing up core to "$test".core"
			mv core $test.core
		endif
		echo "failure in test: Form1 case d"
		echo "Form1 case d" >> failures
	endif

Form1 -u xmBulletinBoardWidgetClass -I Form1e.Dat -xrm "*Child1.height: 100" -xrm "*Child1.width: 400" -xrm "*Child2.width: 10" -xrm "*Child2.height: 10"
	if ($status != 0) then
		if (-e core) then
			echo "backing up core to "$test".core"
			mv core $test.core
		endif
		echo "failure in test: Form1 case e"
		echo "Form1 case e" >> failures
	endif

Form1 -u xmPushButtonWidgetClass -I Form1f.Dat -xrm "*Child1.width: 100" -xrm "*Child2.width: 100"
	if ($status != 0) then
		if (-e core) then
			echo "backing up core to "$test".core"
			mv core $test.core
		endif
		echo "failure in test: Form1 case f"
		echo "Form1 case f" >> failures
	endif

Form1 -u xmPushButtonWidgetClass -I Form1g.Dat -xrm "*Child1.resizable: False"
	if ($status != 0) then
		if (-e core) then
			echo "backing up core to "$test".core"
			mv core $test.core
		endif
		echo "failure in test: Form1 case g"
		echo "Form1 case g" >> failures
	endif

Form8 -u early
Form8 -u middle
Form8 -u late


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


