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 }