ROOTDIR="$(git rev-parse --git-dir)"

cd $ROOTDIR/..
echo "Testing the program before commit..."
echo -n "Building cduce..."
make > /dev/null 2> /dev/null
echo "done."
if test $? -ne 0; then
   echo "Building cduce failed. Aborting commit."
   exit 2
fi
echo "Testing..."
tests/test.sh
if test $? -ne 0; then
   echo "Tests failed. Aborting commit."
   exit 2
fi
echo "Success!"
exit 0
