about summary refs log tree commit diff stats
path: root/tests/earth.sh
diff options
context:
space:
mode:
authorDaniel Santos <dacs.git@brilhante.top>2022-03-15 13:36:40 +0000
committerDaniel Santos <dacs.git@brilhante.top>2022-03-15 14:34:39 +0000
commitb559d657c3cde5cd4d2475b3a0935a7236ef41d2 (patch)
tree314790276f4ee244502b7e9b9742bc92ca3805ef /tests/earth.sh
parentad3f14edbd227b7006a679a21b6514b0ac53913a (diff)
downloadnumericx-c-b559d657c3cde5cd4d2475b3a0935a7236ef41d2.tar.gz
test rule in Makefile
 * add tests/earth.sh
 * add to Makefile all the necessary rules for `make test`

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
Diffstat (limited to 'tests/earth.sh')
-rwxr-xr-xtests/earth.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/earth.sh b/tests/earth.sh
new file mode 100755
index 0000000..68cdc15
--- /dev/null
+++ b/tests/earth.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+current_branch=$(git rev-parse --abbrev-ref HEAD)
+git checkout stable
+make build-tests
+for i in {1..6} ; do \mv decimal-to-earth_test-${i} decimal-to-earth_test-${i}_stable; \mv earth-to-decimal_test-${i} earth-to-decimal_test-${i}_stable; done
+git checkout ${current_branch}
+make build-tests
+
+for i in {1..6}; do for n in {1..1000}; do [[ "$(decimal-to-earth_test-${i} $n)" == "$(decimal-to-earth_test-${i}_stable $n)" ]] || echo "[X] failed: decimal-to-earth_test-${i} $n" ; done; echo " * decimal-to-earth_test-${i} clean"; done
+for i in {1..6}; do for n in {1..1000}; do num=$(decimal-to-earth_test-${i} ${n}); [[ "$(earth-to-decimal_test-${i} ${num})" == "$(earth-to-decimal_test-${i}_stable ${num})" ]] || echo "[X] failed: earth-to-decimal_test-${i} ${num}" ; done; echo " * earth-to-decimal_test-${i} clean"; done
+
+echo
+
+echo "----"
+echo -e "----\n * void: decimal-to-earth_test-1 0 -> " $([[ "$(decimal-to-earth_test-1 0)" == "$(decimal-to-earth_test-1_stable 0)" ]] && echo clean || echo failed)
+
+echo "----"
+echo -e "----\n * out of domain: decimal-to-earth_test-1 abc -> " $([[ "$(decimal-to-earth_test-1 abc)" == "$(decimal-to-earth_test-1_stable abc)" ]] && echo clean || echo failed)
+