#!/bin/csh -f
############################################################################
#	File:		run_regress
#
#	This file runs the simple regression tests using the version
#	of nawk in the parent directory.  Don't assume that nawk
#	works just because it passes the tests in this directory.  These
#	tests check a couple really simple cases.  Hopefully, as time
#	progresses they will get better, but don't count on it.
#
############################################################################

set NAWK = ../nawk				# Version of nawk to use

if (`$NAWK -f test1 smallfile` != 4) then
	echo "nawk failed test 1"
	set failed	
endif

if (`$NAWK -f test2 smallfile` != 5) then
	echo "nawk failed test 2"
	set failed
endif

if (`$NAWK -f test3 < /dev/null` != "ok") then
	echo "nawk failed test 3"
	set failed
endif

if (`/bin/echo "B\0346che" | $NAWK '{gsub(/\346/, "ae") ; print}'` != "Baeche") then
	echo "nawk failed test 4"
	set failed
endif

if (`/bin/echo '\011' | $NAWK '/^[ \t]*$/ { print "okay" }'` != "okay") then
	echo "nawk failed test 5"
	set failed
endif

if (`/bin/echo| $NAWK '/^[ \t]*$/ { print "okay" }'` != "okay") then
	echo "nawk failed test 6"
	set failed
endif

#
#  If we get to this point, all the regression tests passed.
#

if ( ! $?failed) echo "Regression test passed."
