diff --git a/tools/bin/td b/tools/bin/td index 5f40a03..93c7a94 100644 --- a/tools/bin/td +++ b/tools/bin/td @@ -117,7 +117,27 @@ recipe_format() { # Execute all the unit tests and report any failures. 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