diff options
author | Tom Stellard <thomas.stellard@amd.com> | 2012-03-06 10:12:10 -0500 |
---|---|---|
committer | Tom Stellard <thomas.stellard@amd.com> | 2012-03-06 10:12:10 -0500 |
commit | 2167f587bc7ae7f889c88a7466d725f9d48414a0 (patch) | |
tree | 5c555e8aa6b995f2598b562725651e7da1cba24b | |
parent | 1f513c54ef5ba597bc696c6e9eb09f61df8ba293 (diff) |
Add a simple test runner
-rw-r--r-- | run_tests.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/run_tests.sh b/run_tests.sh new file mode 100644 index 0000000..e237d43 --- /dev/null +++ b/run_tests.sh @@ -0,0 +1,26 @@ +(( FAIL = 0 )) +(( PASS = 0 )) + + +run_test () { + echo "Running $1" + `$1 &>/dev/null` + if [ $? -eq 1 ]; then + echo "Failed" + (( FAIL++ )) + else + echo "Passed" + (( PASS++ )) + fi +} + +#Test random add +run_test "./math-int add 1 2 3" +#Same as above with arguments reversed +run_test "./math-int add 2 1 3" +#Test negative plus positive +run_test "./math-int add -5 10 5" +#Test negative plus negative +run_test "./math-int add -1 -4 -5" + +echo "$PASS passes, $FAIL fails" |