mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
553 B
30 lines
553 B
#!/usr/bin/env bash |
|
|
|
|
|
# Unofficial Bash Strict Mode |
|
set -euo pipefail |
|
IFS=' |
|
' |
|
|
|
script_dirS=$(cd -P "$(dirname "$BASH_SOURCE")" &>/dev/null && pwd) |
|
|
|
challenge() { |
|
submitted=$(bash "$script_dirS"/student/array-selector.sh "$@") |
|
expected=$(bash "$script_dirS"/solutions/array-selector.sh "$@") |
|
|
|
diff <(echo "$submitted") <(echo "$expected") |
|
} |
|
|
|
# Test with numbers - out of range included |
|
for num in {0..6} |
|
do |
|
challenge $num |
|
done |
|
|
|
# Test with a value that is not a digit |
|
|
|
challenge "abc" |
|
|
|
# Test with wrong number of arguments |
|
|
|
challenge
|
|
|