#!/bin/sh

# Note:  use sed to strip blanks because not all systems have same version
# of diff.

if [ "x$GCTLIB" = "x" ]
then
  GCTLIB=`pwd`/../../../
  PATH=.:`pwd`/../../..:$PATH
fi

ROOT=..
. $ROOT/run.source

clean


# Second argument usually used to make note about a bug.
doit()
{
	echo "$INDENT" " $1" " $2"
	$TEST_GCT $TEST_ARGS -c -B$GCTLIB $1.c > $1.OUT 2>&1
	diff $1.OUT $1.ref
}

# Like doit, but also check the output.
temp_doit()
{
	doit $1 $2
	diff -b T$1.c $1.Tref
}

# Compatibility tests
cp compat-ctrl gct-ctrl
gct-init $GCTLIB
doit compat

# Visibility tests.
cp vis-ctrl gct-ctrl
gct-init $GCTLIB
doit vis-bug
doit vis-empty
doit vis-visib
doit vis-shad1
doit vis-shad2
doit vis-param
doit vis-noshad
doit vis-init

# Temporary creation tests.
cp temp-ctrl gct-ctrl
gct-init $GCTLIB
TEST_GCT=gct-ansi
temp_doit temp-type
temp_doit temp-wher


exit 0
