citrun

watch C/C++ source code execute
Log | Files | Refs | LICENSE

commit 1575e056d6fc6319a2f3d87a19d45b1ee7781bb0
parent d8d96e4c782f8f1a1d9151dfab4a49681955040d
Author: kyle <kyle@getaddrinfo.net>
Date:   Mon, 26 Oct 2015 21:06:15 -0600

tests: add validation to fibonacci test

Diffstat:
Mrun_tests.sh | 4++--
Mtests/fibonacci.c.sh | 14++++++++++++--
2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/run_tests.sh b/run_tests.sh @@ -24,8 +24,8 @@ for t in `ls tests/*.c`; do continue fi - if ! sh ${t}.sh /tmp/bin; then - echo "$t:$RED tests failed!" + if ! sh ${t}.sh /tmp/bin "${t}"; then + echo "$t:$RED tests failed!$RESET" rm /tmp/bin continue fi diff --git a/tests/fibonacci.c.sh b/tests/fibonacci.c.sh @@ -1,4 +1,14 @@ #!/bin/sh -/tmp/bin 10 -/tmp/bin 20 +result="`/tmp/bin 10`" +if [ "$result" != "result: 55" ]; then + echo "${2}.sh: $result != \"result: 55\"" + exit 1 +fi + +result="`/tmp/bin 20`" +expected="result: 6765" +if [ "$result" != "$expected" ]; then + echo "${2}.sh: '$result' != '$expected'" + exit 1 +fi