test all <3
This commit is contained in:
49
aliases
49
aliases
@@ -48,7 +48,7 @@ cc-run-test-inline(){
|
|||||||
cc-clean
|
cc-clean
|
||||||
}
|
}
|
||||||
|
|
||||||
cc-run-test(){
|
cc-test(){
|
||||||
local file
|
local file
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
echo "Usage: cc-run <file> [args...]" >&2
|
echo "Usage: cc-run <file> [args...]" >&2
|
||||||
@@ -74,43 +74,16 @@ cc-run-test(){
|
|||||||
cc-clean
|
cc-clean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cc-test-all() {
|
||||||
cc-run-lax(){
|
# find .c files, exclude those ending with .test.c
|
||||||
local file
|
find . -type f -name '*.c' ! -name '*.test.c' -print0 |
|
||||||
if [ -z "$1" ]; then
|
while IFS= read -r -d '' file; do
|
||||||
echo "Usage: cc-run <file> [args...]" >&2
|
echo -e "----------$file: TESTING-------------\n"
|
||||||
|
cc-test "$file" || {
|
||||||
|
echo -e "\n----------$file: DONE (NOT OK)-------"
|
||||||
|
# echo "cc-test failed for $file" >&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
}
|
||||||
|
echo -e "\n----------$file: DONE (OK)-----------"
|
||||||
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
|
done
|
||||||
for test in *_test.out; do
|
|
||||||
"./${test}"
|
|
||||||
done
|
|
||||||
# cc-clean
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user