Outsourced test definition to separate file

Add cmd options --, --run-all
This commit is contained in:
2022-03-18 21:48:39 +01:00
parent e878a7b2ac
commit 1802f18339
2 changed files with 109 additions and 55 deletions

70
test/totest.sh Normal file
View File

@@ -0,0 +1,70 @@
#!/usr/bin/env bash
########## Competition Block ##########
# Each competition link is given to both tools
# and the output is compared
# [0] = Title
# [1] = path for competition
# [2] = path for competition
# ...
compete_links=( "Test - Valid links"
"/dev/stdin"
"$test_dir/tmp/a"*
"$test_dir/tmp/a 3"
"/bin/adb"
)
compete_all=( "Test - everything starting from /"
/**/*
)
tocompete_init() {
# TODO initialize custom test structure
# Add tests to global test array from test_rdlink
tocompete+=(
compete_links
)
}
tocompete_clean() {
# TODO clean custom test structure
echo "tocompete_clean"
}
tocompete_init
########## Assertion Block ##########
# Assertion string compare test
# [0] = Title
# [1] expected == [2] input
# [3] expected == [4] input
# ...
assert_string=( "Assert - invalid files"
"/opt/rdlink/test/a" "a"
"/opt/rdlink/test/b" "b"
"/opt/rdlink/test/c" "c"
)
toassert_init() {
# TODO initilaize custom test structure
# Add test arrays to global test array from test_rdlink
toassert+=(
assert_string
)
}
toassert_clean() {
# TODO clean
echo "toassert_clean"
}
totest_cleanall() {
echo
tocompete_clean
toassert_clean
}
trap totest_cleanall EXIT
toassert_init