#!/bin/sh
################################################################
#
#  [# Edit, Date, User, Module #]
#
#  test-script for monopoly-template
#
here=`pwd`
if test $? -ne 0 ; then exit 1; fi
tmp=/tmp/$$
mkdir $tmp
if test $? -ne 0 ; then exit 1; fi
cd $tmp
if test $? -ne 0 ; then exit 1; fi

fail()
{
	echo FAILED 1>&2
	cd $here
	chmod u+w `find $tmp -type d -print`
	rm -rf $tmp
	exit 1
}

pass()
{
	cd $here
	chmod u+w `find $tmp -type d -print`
	rm -rf $tmp
	exit 0
}

trap 'fail' 1 2 3 15

###  Enter argument list for `monopoly' here ###
arglist='testaccount'

/public/public/monopoly/diffpp > test.in << 'endOfSampleInput'
Account 300 end
Account 500 end
endOfSampleInput
if test $? -ne 0 ; then fail; fi

/public/public/monopoly/diffpp > test.ok << 'endOfExpectedOutput'
Account 300 end #a
Account 500 end #b

Account 179 end #a + 100 - 110 - 111
Account 611 end #b + 111
endOfExpectedOutput
if test $? -ne 0 ; then fail; fi

$here/monopoly $arglist < test.in | /public/public/monopoly/diffpp > test.out
if test $? -ne 0 ; then fail; fi

diff test.ok test.out
if test $? -ne 0 ; then fail; fi

# it probably worked
pass
