aboutsummaryrefslogtreecommitdiffstats
path: root/tests/all.sh
diff options
context:
space:
mode:
authorGavin Howard <yzena.tech@gmail.com>2018-10-25 15:48:23 -0600
committerGavin Howard <yzena.tech@gmail.com>2018-10-25 15:48:23 -0600
commit4863d28f6859f04d1600c75711b016513e61dead (patch)
treebf63fed8bd3cb84bcfe8ef6dc4d46162aa725ab8 /tests/all.sh
parentbd0987119ced47e5594437ec1ce84e6fed2fa7f7 (diff)
downloadplatform_external_bc-4863d28f6859f04d1600c75711b016513e61dead.tar.gz
platform_external_bc-4863d28f6859f04d1600c75711b016513e61dead.tar.bz2
platform_external_bc-4863d28f6859f04d1600c75711b016513e61dead.zip
Add tests to increase coverage
Diffstat (limited to 'tests/all.sh')
-rwxr-xr-xtests/all.sh90
1 files changed, 90 insertions, 0 deletions
diff --git a/tests/all.sh b/tests/all.sh
index bb4ad334..76d8ca2a 100755
--- a/tests/all.sh
+++ b/tests/all.sh
@@ -35,6 +35,17 @@ else
shift
fi
+if [ "$d" = "bc" ]; then
+
+ halt="quit"
+
+ echo -e "\nRunning $d limits tests...\n"
+ echo "limits" | "$exe"
+
+else
+ halt="q"
+fi
+
echo -e "\nRunning $d tests...\n"
while read t; do
@@ -43,3 +54,82 @@ done < "$testdir/$d/all.txt"
sh "$testdir/scripts.sh" "$d" "$exe" "$@"
sh "$testdir/errors.sh" "$d" "$exe" "$@"
+
+echo -e "\nRunning quit test...\n"
+
+if [ "$d" = "bc" ]; then
+ halt="quit"
+else
+ halt="q"
+fi
+
+echo "$halt" | "$exe"
+
+echo -e "\nRunning arg tests...\n"
+
+f="$testdir/$d/add.txt"
+exprs=$(cat "$f")
+results=$(cat "$testdir/$d/add_results.txt")
+
+out1="$testdir/../.log_bc.txt"
+out2="$testdir/../.log_test.txt"
+
+echo -e "$results\n$results\n$results\n$results" > "$out1"
+
+"$exe" -e "$exprs" -f "$f" --expression "$exprs" --file "$f" > "$out2"
+
+diff "$out1" "$out2"
+err="$?"
+
+if [ "$d" = "bc" ]; then
+ echo "$halt" | "$exe" -i
+fi
+echo "$halt" | "$exe" -h > /dev/null
+echo "$halt" | "$exe" -v > /dev/null
+echo "$halt" | "$exe" -V > /dev/null
+
+set +e
+
+"$exe" -u -e "$exprs"
+err="$?"
+
+if [ "$err" -eq 0 ]; then
+ echo "$d did not return an error ($err) on invalid argument test"
+ echo "exiting..."
+ exit 1
+fi
+
+echo -e "\nRunning directory test...\n"
+
+"$exe" "$testdir"
+err="$?"
+
+if [ "$err" -eq 0 ]; then
+ echo "$d did not return an error ($err) on directory test"
+ echo "exiting..."
+ exit 1
+fi
+
+echo -e "\nRunning binary file test...\n"
+
+bin=$(which cat)
+
+"$exe" "$bin"
+err="$?"
+
+if [ "$err" -eq 0 ]; then
+ echo "$d did not return an error ($err) on binary file test"
+ echo "exiting..."
+ exit 1
+fi
+
+echo -e "\nRunning binary stdin test...\n"
+
+cat "$bin" | "$exe"
+err="$?"
+
+if [ "$err" -eq 0 ]; then
+ echo "$d did not return an error ($err) on binary stdin test"
+ echo "exiting..."
+ exit 1
+fi