From 442a49ad5a48d417345959b903ae6a6d32d55759 Mon Sep 17 00:00:00 2001 From: Haidong Ji Date: Fri, 15 Apr 2022 15:51:30 -0500 Subject: Great C programming fun Excellent fundamentals and displine training, many tools and techniques exercises: gdb, emacs, valgrind, git --- 22_tests_power/run_all.sh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 22_tests_power/run_all.sh (limited to '22_tests_power/run_all.sh') diff --git a/22_tests_power/run_all.sh b/22_tests_power/run_all.sh new file mode 100755 index 0000000..68f709d --- /dev/null +++ b/22_tests_power/run_all.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +for i in /usr/local/l2p/power/power*.o +do + test=`basename $i | sed 's/power//' | sed 's/.o//'` + if [ "$test" == "" ] + then + echo "**Testing correct implementation **" + else + echo "**Testing broken implementation ${test} **" + fi + echo "-------------------------------------" + echo "" + gcc -o test-power test-power.c $i + if [ "$?" != "0" ] + then + echo "Could not compile test-power.c with $i" > /dev/stderr + exit 1 + fi + ./test-power + if [ "$?" != 0 ] + then + if [ "$test" == "" ] + then + echo "Your test program falsely failed the correct implementation!" > /dev/stderr + exit 1 + fi + else + if [ "$test" != "" ] + then + echo "Your test program did not identify $i as broken!" > /dev/stderr + exit 1 + fi + fi + echo "" +done -- cgit v1.2.3