aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGavin Howard <yzena.tech@gmail.com>2021-04-01 07:56:26 -0600
committerGavin Howard <yzena.tech@gmail.com>2021-04-01 07:56:26 -0600
commite9ae81114186bb3a5f1a6259453d40f4267ae1e2 (patch)
treee82b3bcf5c3114b6944de3b02315048828fc325a
parent160490c7d8c1da86c87481e7908d6a1a033c985f (diff)
downloadbc-e9ae81114186bb3a5f1a6259453d40f4267ae1e2.tar.gz
Add the dc easter script to the test suite
-rwxr-xr-xtests/dc/scripts/easter.sh47
-rwxr-xr-xtests/other.sh31
2 files changed, 76 insertions, 2 deletions
diff --git a/tests/dc/scripts/easter.sh b/tests/dc/scripts/easter.sh
new file mode 100755
index 00000000..dd030e40
--- /dev/null
+++ b/tests/dc/scripts/easter.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+if test $# -lt 2
+then
+ echo usage: $0 dc_exec year
+ exit 1
+fi
+
+dc_exec="$1"
+shift
+
+year="$1"
+shift
+
+echo $year '
+[
+ ddsf
+ [
+ lfp
+ [too early
+ ]P
+ q
+ ]s@
+ 1583>@
+ ddd19%1+sg100/1+d3*4/12-sx8*5+25/5-sz5*4/lx-10-sdlg11*20+lz+lx-30%
+ d
+ [30+]s@
+ 0>@d
+ [
+ [1+]s@
+ lg11<@
+ ]s@
+ 25=@d
+ [1+]s@
+ 24=@se44le-d
+ [30+]s@
+ 21>@dld+7%-7+
+ [March ]sm
+ d
+ [
+ 31-
+ [April ]sm
+ ]s@
+ 31<@psnlmPpsn1z>p
+]sp
+lpx' | "$dc_exec" | tr '\012' ' '
+echo ''
diff --git a/tests/other.sh b/tests/other.sh
index 8c56e25d..27f55a5e 100755
--- a/tests/other.sh
+++ b/tests/other.sh
@@ -118,6 +118,9 @@ if [ "$d" = "bc" ]; then
err="$?"
checktest_retcode "$d" "$?" "environment var"
+
+ printf 'pass\n'
+
else
export DC_ENV_ARGS="'-x'"
@@ -130,9 +133,33 @@ else
"$exe" -e 4pR "$@" > /dev/null
checktest_retcode "$d" "$?" "environment var"
-fi
-printf 'pass\n'
+ printf 'pass\n'
+
+ set +e
+
+ printf 'three\n' | head -c3 > /dev/null
+ err=$?
+
+ if [ "$err" -eq 0 ]; then
+
+ printf 'Running dc Easter script...'
+
+ easter_res="$testdir/dc_outputs/easter.txt"
+ easter_out="$testdir/dc_outputs/easter_results.txt"
+
+ printf '4 April 2021\n' > "$easter_res"
+
+ "$testdir/dc/scripts/easter.sh" "$exe" 2021 | head -c12 > "$easter_out"
+ printf '\n' >> "$easter_out"
+ err="$?"
+
+ checktest "$d" "$err" "Easter script" "$easter_res" "$easter_out"
+
+ printf 'pass\n'
+ fi
+
+fi
out1="$testdir/../.log_$d.txt"
out2="$testdir/../.log_${d}_test.txt"