From af17ead850f90cf6e4476aa74975e68d7293fb27 Mon Sep 17 00:00:00 2001 From: Anastasis Grammenos Date: Sun, 16 Sep 2018 15:27:31 +0300 Subject: Add unit test infrastructure --- res/check_ck | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'res/check_ck') diff --git a/res/check_ck b/res/check_ck index 6e61e5c..ce35396 100755 --- a/res/check_ck +++ b/res/check_ck @@ -3,10 +3,12 @@ BIN=@CMAKE_BINARY_DIR@ TEST_LOCATION=@PROJECT_TESTING_GROUNDS@ +# used in regression tests function running { echo "--[TESTING $1]--" } +# used in regression tests function init { running $1 mkdir -p $TEST_LOCATION/vc @@ -23,7 +25,17 @@ function clear_tests { rm -rf $TEST_LOCATION } -function run { +function unit_tests { + echo -e "################################" + echo -e "########## Unit Tests ##########" + echo -e "################################" + ./ck-test +} + +function regression_tests { + echo -e "######################################" + echo -e "########## Regression Tests ##########" + echo -e "######################################" DIR=@BIN_TESTS_DIR@ for i in $( ls $DIR ); do ERROR="TEST "$i" FAILED:" @@ -33,10 +45,17 @@ function run { done } +function run { + unit_tests + regression_tests +} + function print_help { echo -e "ck test suite" - echo -e "run without flags to begin testing" + echo -e "use without flags to run all tests" echo -e "\nflags:" + echo -e " -u, --unit\t\trun only the unit tests" + echo -e " -r, --regression\trun only the regression tests" echo -e " -c, --clear\t\tremove test files" echo -e " \t\t use it if the tests fail" echo -e " -h, --help, *\t\tprint this" @@ -58,6 +77,14 @@ do clear_tests exit ;; + -u | --unit) + unit_tests + exit + ;; + -r | --regression) + regression_tests + exit + ;; *) # unknown option print_help exit -- cgit v1.2.3