summaryrefslogtreecommitdiff
path: root/test/scorsh_functions
diff options
context:
space:
mode:
authorKatolaZ <katolaz@freaknet.org>2017-08-09 09:53:34 +0100
committerKatolaZ <katolaz@freaknet.org>2017-08-09 09:53:34 +0100
commit231beb5c3fc50f40e31b9e00237c67f267188057 (patch)
tree269eff309883d5ae7e8e3fdfc012aa91d53416cf /test/scorsh_functions
parent8062fc191395fbedd431fd18d23a7a60e2107e90 (diff)
preliminary testbed
Diffstat (limited to 'test/scorsh_functions')
-rw-r--r--test/scorsh_functions56
1 files changed, 56 insertions, 0 deletions
diff --git a/test/scorsh_functions b/test/scorsh_functions
new file mode 100644
index 0000000..1917188
--- /dev/null
+++ b/test/scorsh_functions
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+STATUS_FILE=./.exit_status
+
+## func
+failed(){
+
+ TEST_NAME="$1"
+ TEST_SECTION="$2"
+
+ echo "[\033[31mFAILED\033[0m] -- ${TEST_NAME}:${TEST_SECTION} "
+ FAILED_TESTS=$((${FAILED_TESTS} + 1))
+}
+
+## func
+passed(){
+
+ TEST_NAME="$1"
+ TEST_SECTION="$2"
+
+ echo "[\033[32mPASSED\033[0m] -- ${TEST_NAME}:${TEST_SECTION} "
+ PASSED_TESTS=$((${PASSED_TESTS} + 1))
+}
+
+
+## func
+check(){
+
+ EXPR="$1"
+ TEST_NAME="$2"
+ TEST_SECTION="$3"
+
+ TOT_TESTS=$((${TOT_TESTS} + 1))
+
+ ##echo "EXPR: ${EXPR}"
+ if $(echo ${EXPR}) ; then
+ passed ${TEST_NAME} ${TEST_SECTION}
+ else
+ failed ${TEST_NAME} ${TEST_SECTION}
+ fi
+}
+
+## func
+report_results(){
+
+ echo -n "TOTAL_TESTS: ${TOT_TESTS} -- "
+ echo -n "\033[32mPASSED: ${PASSED_TESTS}\033[0m -- "
+ echo "\033[31mFAILED: ${FAILED_TESTS}\033[0m "
+}
+
+# func
+return_results(){
+ echo "TOT_TESTS=${TOT_TESTS};PASSED_TESTS=${PASSED_TESTS};FAILED_TESTS=${FAILED_TESTS};">${STATUS_FILE}
+}
+
+