refactor(division_test): make challenge function more modular

This commit is contained in:
Michele Sessa 2023-03-27 18:58:33 +01:00 committed by Michele
parent de9d5caeb7
commit dcee131cf0
1 changed files with 2 additions and 9 deletions

View File

@ -15,15 +15,8 @@ challenge() {
return return
fi fi
# Test with one or two arguments submitted=$(bash "$script_dirS"/student/division.sh $@)
if [ $# -eq 1 ] expected=$(bash "$script_dirS"/solutions/division.sh $@)
then
submitted=$(bash "$script_dirS"/student/division.sh $1)
expected=$(bash "$script_dirS"/solutions/division.sh $1)
else
submitted=$(bash "$script_dirS"/student/division.sh $1 $2)
expected=$(bash "$script_dirS"/solutions/division.sh $1 $2)
fi
diff <(echo "$submitted") <(echo "$expected") diff <(echo "$submitted") <(echo "$expected")
} }