From 6d7fdefc229352520c88c97c8075f01f885e6d0b Mon Sep 17 00:00:00 2001 From: Roman Volovoy Date: Wed, 3 Jun 2026 19:12:55 +0200 Subject: [PATCH] test all <3 --- aliases | 53 +++++++++++++---------------------------------------- 1 file changed, 13 insertions(+), 40 deletions(-) diff --git a/aliases b/aliases index c8dcb93..9a8ccc2 100644 --- a/aliases +++ b/aliases @@ -48,7 +48,7 @@ cc-run-test-inline(){ cc-clean } -cc-run-test(){ +cc-test(){ local file if [ -z "$1" ]; then echo "Usage: cc-run [args...]" >&2 @@ -74,43 +74,16 @@ cc-run-test(){ cc-clean } - -cc-run-lax(){ - local file - if [ -z "$1" ]; then - echo "Usage: cc-run [args...]" >&2 - return 1 - fi - - cc-clean - - file="$1" - shift - - if command -v norminette &>/dev/null - then - norminette "${file}" - fi - - cc -std=c99 "${file}" -o "${file}.out" -DTEST=please && \ - "./${file}.out" "$@" - - cc-clean -} - -cc-test(){ - local test base - cc-clean - if ! ls *_test.c >/dev/null 2>&1; then - echo "No _test.c files found" >&2 - return 1 - fi - for test in *_test.c; do - base="${test%.c}" - cc "${test}" -o "${base}.out" -Wall -Wextra -Werror - done - for test in *_test.out; do - "./${test}" - done - # cc-clean +cc-test-all() { + # find .c files, exclude those ending with .test.c + find . -type f -name '*.c' ! -name '*.test.c' -print0 | + while IFS= read -r -d '' file; do + echo -e "----------$file: TESTING-------------\n" + cc-test "$file" || { + echo -e "\n----------$file: DONE (NOT OK)-------" + # echo "cc-test failed for $file" >&2 + return 1 + } + echo -e "\n----------$file: DONE (OK)-----------" + done }