#!/usr/bin/env bash
# $LastChangedDate: 2010-05-25 21:26:05 -0400 (Tue, 25 May 2010) $
# LEGAL: COPYRIGHT (C) 2010 JIM E. BROOKS WWW.PALOMINO3D.ORG
# Run all tests.  Everything should be compiled with DEBUG.

export ROOT_DIR="`pwd`/.."
export TOOLS_DIR="${ROOT_DIR}/tools"
export TEST_DIR="${ROOT_DIR}/tests"
export MAKE=`$TOOLS_DIR/which-make.sh`

# Check if project has been compiled for DEBUG.
if ( ! ${TOOLS_DIR}/if-debug-build.sh ${ROOT_DIR} ); then
    echo "ERROR: Need to build project as DEBUG."
    exit 1
fi

# Build/run tests.
$MAKE &&
( cd ${TEST_DIR}/base     && ./run-tests.sh ) &&
( cd ${TEST_DIR}/graphics && ./run-tests.sh ) &&
( cd ${TEST_DIR}/lua      && ./run-tests.sh ) &&
( cd ${TEST_DIR}/lua_bind && ./run-tests.sh ) &&
( cd ${TEST_DIR}/math     && ./run-tests.sh )
