Add tests for ex17-ec
This commit is contained in:
parent
1970801db8
commit
5d2b2e8e8e
@ -1,8 +1,6 @@
|
|||||||
CFLAGS=-Wall -g
|
CFLAGS=-Wall -g
|
||||||
|
|
||||||
EXERCISES := \
|
EXERCISES := $(shell ./list-exercises)
|
||||||
ex1 ex3 ex4 ex5 ex6 ex7 ex8 ex9 ex9-ec \
|
|
||||||
ex10 ex11 ex12 ex13 ex14 ex15 ex16 ex17 ex17-ec
|
|
||||||
|
|
||||||
all: $(EXERCISES)
|
all: $(EXERCISES)
|
||||||
|
|
||||||
@ -10,4 +8,7 @@ clean:
|
|||||||
$(RM) $(EXERCISES)
|
$(RM) $(EXERCISES)
|
||||||
|
|
||||||
test:
|
test:
|
||||||
./runtests
|
@./runtests
|
||||||
|
|
||||||
|
exercises:
|
||||||
|
@echo $(EXERCISES)
|
||||||
|
5
lcthw-remnants-2/list-exercises
Executable file
5
lcthw-remnants-2/list-exercises
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
for f in *.c ; do
|
||||||
|
echo "${f/.c/}"
|
||||||
|
done
|
@ -1 +1,31 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
[[ $DEBUG ]] && set -x
|
||||||
|
|
||||||
|
test_ex17-ec() {
|
||||||
|
local testdb=$(mktemp /var/tmp/XXXXXXX.dat)
|
||||||
|
trap "rm ${testdb}" EXIT INT TERM
|
||||||
|
./ex17-ec "${testdb}" c
|
||||||
|
./ex17-ec "${testdb}" l &>/dev/null
|
||||||
|
./ex17-ec "${testdb}" s 1 nancy pwnr@dungeon.info "Dark corner"
|
||||||
|
./ex17-ec "${testdb}" s 2 fran eagleeye16@hotmail.com "Falcon's nest"
|
||||||
|
./ex17-ec "${testdb}" l &>/dev/null
|
||||||
|
./ex17-ec "${testdb}" d 1
|
||||||
|
./ex17-ec "${testdb}" s 1 portia wanda@aeromar.mx "Fancy town"
|
||||||
|
./ex17-ec "${testdb}" f nest &>/dev/null
|
||||||
|
echo "OK"
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
for ex in $(./list-exercises) ; do
|
||||||
|
func_name="test_${ex}"
|
||||||
|
if type "${func_name}" &>/dev/null ; then
|
||||||
|
echo -en "---> ${ex}: "
|
||||||
|
"${func_name}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
Loading…
Reference in New Issue
Block a user