Added primitive unit testing in tests/

This commit is contained in:
2016-03-27 12:07:53 -07:00
parent 6642358073
commit 25e3b5c517
6 changed files with 62 additions and 1 deletions

20
tests/test.sh Normal file
View File

@@ -0,0 +1,20 @@
#!/bin/bash
for file in *.c
do
filebase=$(basename $file | sed 's/\.c$//')
compile_def=$(cat <<EOF
function shunittest_compile_${filebase} {
set -e ; make ${filebase}.elf >&2 ; test -e ${filebase}.elf ; set +e
}
EOF
)
eval "$compile_def"
run_def=$(cat <<EOF
function shunittest_run_${filebase} {
set -e ; ./${filebase}.elf >&2 ; set +e
}
EOF
)
eval "$run_def"
done