From 8316ebd171d52fe6f1a0615f3fe2954e3a3d4353 Mon Sep 17 00:00:00 2001 From: eslopfer Date: Wed, 4 Jan 2023 09:43:33 +0000 Subject: [PATCH] test(plus): add tests --- sh/tests/plus_test.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 sh/tests/plus_test.sh diff --git a/sh/tests/plus_test.sh b/sh/tests/plus_test.sh new file mode 100644 index 00000000..c7571923 --- /dev/null +++ b/sh/tests/plus_test.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +set -euo pipefail +IFS=' +' + +script_dirS=$(cd -P "$(dirname "$BASH_SOURCE")" &>/dev/null && pwd) + +challenge() { + submitted=$(bash "$script_dirS"/student/plus.sh $1 $2) + expected=$(bash "$script_dirS"/solutions/plus.sh $1 $2) + + diff <(echo "$submitted") <(echo "$expected") +} + +challenge "1" "2" +challenge "4" "2" +challenge "3" "-3" +challenge "0" "0" +challenge "2" "-3" +challenge "-4" "1" +challenge "-2" "-1" +challenge "10" "-5" +challenge "-11" "20"