Clean up makefile and tests

This commit is contained in:
= 2020-05-15 21:27:45 +01:00
parent 58705b4aa9
commit 82f1f03d7b
2 changed files with 12 additions and 4 deletions

View File

@ -1,11 +1,16 @@
files = pebblisp.c tokens.c object.c env.c
all:
gcc -g -O0 -o pebblisp -D STANDALONE pebblisp.c tokens.c object.c env.c && ./tests.sh
gcc -g -O0 -o pebblisp -D STANDALONE $(files) && ./tests.sh
notest:
gcc -g -O0 -o pebblisp -D STANDALONE $(files)
val:
gcc -g -O0 -o pebblisp -D STANDALONE pebblisp.c tokens.c object.c env.c && ./tests.sh -val
gcc -g -O0 -o pebblisp -D STANDALONE $(files) && ./tests.sh -val
debug:
gcc -g -O0 -o pebblisp -D STANDALONE -D DEBUG pebblisp.c tokens.c object.c env.c && ./tests.sh
gcc -g -O0 -o pebblisp -D STANDALONE -D DEBUG $(files) && ./tests.sh
run:
./pebblisp

View File

@ -20,7 +20,7 @@ fail() {
check() {
local output
if (($VALGRIND == 1)); then
local output=$(valgrind --leak-check=full ./pebblisp "$2")
local output=$(valgrind --leak-check=full --track-origins=yes ./pebblisp "$2")
else
local output=$(./pebblisp "$2")
fi
@ -79,7 +79,9 @@ echo ""
check "ExplicitCat" "(cat \"Big\" \" Kitty\")" "Big Kitty"
check "CatNums" "(cat \"There are \" (+ 2 3) \" kitties\")" "There are 5 kitties"
check "ImplicitCat" "(+ \"There are \" (* 5 4) \" bonks\")" "There are 20 bonks"
# Not recommended
check "CatAssocLeft" "(+ 10 20 \" rascals\")" "30 rascals"
echo""
if [ "$FAILS" -ne "0" ]; then
echo "$FAILS Tests Failed"
@ -88,3 +90,4 @@ else
fi
echo "$PASSES Tests Passed"
echo ""