mirror of https://github.com/01-edu/public.git
Browse Source
fixing the test work with a range of numbers and add error checking fixing the solution according to the testpull/1717/head
3 changed files with 38 additions and 10 deletions
@ -1,25 +1,31 @@ |
|||||||
#!/usr/bin/env bash |
#!/usr/bin/env bash |
||||||
|
|
||||||
# Unofficial Bash Strict Mode |
# Unofficial Bash Strict Mode |
||||||
set -euo pipefail |
# set -euo pipefail |
||||||
IFS=' |
IFS=' |
||||||
' |
' |
||||||
script_dirS=$(cd -P "$(dirname "$BASH_SOURCE")" &>/dev/null && pwd) |
script_dirS=$(cd -P "$(dirname "$BASH_SOURCE")" &>/dev/null && pwd) |
||||||
|
|
||||||
challenge() { |
challenge() { |
||||||
|
|
||||||
submitted=$(echo -e "3\n2\n5\n7\n1\n4\n9\n8\n6\n10" | bash -c ""$script_dirS"/student/greatest-of-all.sh") |
submitted=$(echo -e "0\n3\n2\n5\n7\n1\n4\n9\n8\n6\n10" | bash -c ""$script_dirS"/student/greatest-of-all.sh") |
||||||
expected=$(echo -e "3\n2\n5\n7\n1\n4\n9\n8\n6\n10" | bash -c ""$script_dirS"/solutions/greatest-of-all.sh") |
expected=$(echo -e "0\n3\n2\n5\n7\n1\n4\n9\n8\n6\n10" | bash -c ""$script_dirS"/solutions/greatest-of-all.sh") |
||||||
diff <(echo "$submitted") <(echo "$expected") |
diff <(echo "$submitted") <(echo "$expected") |
||||||
submitted=$(echo -e "26\n85\n21\n94\n68\n60\n99\n31\n10\n98\n" | bash -c ""$script_dirS"/student/greatest-of-all.sh") |
submitted=$(echo -e "26\n85\n21\n94\n68\n60\n99\n31\n10\n98\n" | bash -c ""$script_dirS"/student/greatest-of-all.sh") |
||||||
expected=$(echo -e "26\n85\n21\n94\n68\n60\n99\n31\n10\n98\n" | bash -c ""$script_dirS"/solutions/greatest-of-all.sh") |
expected=$(echo -e "26\n85\n21\n94\n68\n60\n99\n31\n10\n98\n" | bash -c ""$script_dirS"/solutions/greatest-of-all.sh") |
||||||
diff <(echo "$submitted") <(echo "$expected") |
diff <(echo "$submitted") <(echo "$expected") |
||||||
submitted=$(echo -e "53\n59\n95\n76\n42\n10\n49\n59\n98\n75\n" | bash -c ""$script_dirS"/student/greatest-of-all.sh") |
|
||||||
expected=$(echo -e "53\n59\n95\n76\n42\n10\n49\n59\n98\n75\n" | bash -c ""$script_dirS"/solutions/greatest-of-all.sh") |
|
||||||
diff <(echo "$submitted") <(echo "$expected") |
|
||||||
submitted=$(echo -e "152\n485\n569\n611\n871\n551\n984\n895\n285\n989\n" | bash -c ""$script_dirS"/student/greatest-of-all.sh") |
submitted=$(echo -e "152\n485\n569\n611\n871\n551\n984\n895\n285\n989\n" | bash -c ""$script_dirS"/student/greatest-of-all.sh") |
||||||
expected=$(echo -e "152\n485\n569\n611\n871\n551\n984\n895\n285\n989\n" | bash -c ""$script_dirS"/solutions/greatest-of-all.sh") |
expected=$(echo -e "152\n485\n569\n611\n871\n551\n984\n895\n285\n989\n" | bash -c ""$script_dirS"/solutions/greatest-of-all.sh") |
||||||
diff <(echo "$submitted") <(echo "$expected") |
diff <(echo "$submitted") <(echo "$expected") |
||||||
|
submitted=$(echo -e "152\n10001\n569" | bash -c ""$script_dirS"/student/greatest-of-all.sh") |
||||||
|
expected=$(echo -e "152\n10001\n569" | bash -c ""$script_dirS"/solutions/greatest-of-all.sh") |
||||||
|
diff <(echo "$submitted") <(echo "$expected") |
||||||
|
submitted=$(echo -e "152\n485\nalpha\n" | bash -c ""$script_dirS"/student/greatest-of-all.sh") |
||||||
|
expected=$(echo -e "152\n485\nalpha\n" | bash -c ""$script_dirS"/solutions/greatest-of-all.sh") |
||||||
|
diff <(echo "$submitted") <(echo "$expected") |
||||||
|
submitted=$(echo -e "152\n485\n-45\n45\n" | bash -c ""$script_dirS"/student/greatest-of-all.sh") |
||||||
|
expected=$(echo -e "152\n485\n-45\n45" | bash -c ""$script_dirS"/solutions/greatest-of-all.sh") |
||||||
|
diff <(echo "$submitted") <(echo "$expected") |
||||||
} |
} |
||||||
|
|
||||||
challenge |
challenge |
||||||
|
Loading…
Reference in new issue