2011-08-22 19:04:28 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
2011-08-22 21:27:06 -04:00
|
|
|
# init the "game" and profile
|
|
|
|
export GSGP_ID=gsgptest
|
|
|
|
export GSGP_TITLE="Test Suite"
|
|
|
|
export GSGP_PROFILE=TEST
|
|
|
|
|
|
|
|
. "$( dirname $0 )/../util/common"
|
|
|
|
|
|
|
|
# annihilate profile to start fresh
|
|
|
|
rm -rf "$GSGP_PROFILE_PATH"
|
|
|
|
mkdir -p "$GSGP_PROFILE_PATH"
|
|
|
|
|
2011-08-22 19:04:28 -04:00
|
|
|
lastgiven=''
|
|
|
|
lastexpected=''
|
|
|
|
|
|
|
|
last()
|
|
|
|
{
|
|
|
|
lastgiven="$1"
|
|
|
|
lastexpected="$2"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
assert-equal()
|
|
|
|
{
|
|
|
|
last "$1" "$2"
|
|
|
|
[ "$1" == "$2" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
assert-eq()
|
|
|
|
{
|
|
|
|
last "$1" "$2"
|
|
|
|
[ $1 -eq $2 ]
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-08-22 23:48:30 -04:00
|
|
|
assert-no-exist()
|
|
|
|
{
|
|
|
|
last "$1 exists" "$1 to not exist"
|
|
|
|
[ ! -e "$1" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-08-22 21:27:06 -04:00
|
|
|
simplefail()
|
2011-08-22 19:04:28 -04:00
|
|
|
{
|
|
|
|
echo "FAILURE: $1" >&2
|
2011-08-22 21:27:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fail()
|
|
|
|
{
|
|
|
|
simplefail "$1"
|
2011-08-22 19:04:28 -04:00
|
|
|
echo "Expected '$lastexpected', but received '$lastgiven'" >&2
|
|
|
|
echo >&2
|
|
|
|
}
|