forked from lda/telodendria
Add support for unit testing.
This commit is contained in:
parent
2e5d21d309
commit
a39b0d9f9a
1 changed files with 21 additions and 1 deletions
22
tools/bin/td
22
tools/bin/td
|
@ -117,7 +117,27 @@ recipe_format() {
|
||||||
|
|
||||||
# Execute all the unit tests and report any failures.
|
# Execute all the unit tests and report any failures.
|
||||||
recipe_test() {
|
recipe_test() {
|
||||||
echo "Unit tests are not implemented yet."
|
passed=0
|
||||||
|
failed=0
|
||||||
|
mkdir -p "build/tests"
|
||||||
|
for testSrc in $(find tests -name 'Test*.c'); do
|
||||||
|
testBin=$(basename "$testSrc" .c)
|
||||||
|
testBin="build/tests/$testBin"
|
||||||
|
|
||||||
|
if ! $CC $CFLAGS -I src -o "$testBin" "$testSrc"; then
|
||||||
|
failed=$((failed + 1))
|
||||||
|
break;
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! "$testBin"; then
|
||||||
|
failed=$((failed + 1))
|
||||||
|
break;
|
||||||
|
fi
|
||||||
|
|
||||||
|
passed=$((passed + 1))
|
||||||
|
done
|
||||||
|
echo "Passed: $passed, failed: $failed"
|
||||||
|
echo "Total: $((passed + failed))"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Deploy the Telodendria website by copying the required files to
|
# Deploy the Telodendria website by copying the required files to
|
||||||
|
|
Loading…
Reference in a new issue