From 1f9b277887c00338480b4fb685dbc20792261d67 Mon Sep 17 00:00:00 2001 From: miguel Date: Tue, 31 Jan 2023 15:48:01 +0000 Subject: [PATCH] fix(grades): fix and add more tests --- sh/tests/grades_test.sh | 17 +++++++++++++++++ subjects/devops/grades/README.md | 7 ++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/sh/tests/grades_test.sh b/sh/tests/grades_test.sh index 6e0e9e71..1f6a1bda 100755 --- a/sh/tests/grades_test.sh +++ b/sh/tests/grades_test.sh @@ -19,6 +19,12 @@ $input EOF ) diff <(echo "$submitted") <(echo "$expected") + + if [ $? != 0 ]; then + exit 1 + fi + echo $submitted + echo $expected } challenge 1 "Student1 90 @@ -41,6 +47,11 @@ challenge 1 "Student6 challenge 1 "Student7 25 " +challenge 2 "Student1 +0 +Alice +100 +" challenge 3 "Bob 90 Alice @@ -66,3 +77,9 @@ Alice Eve 55 " +challenge 1 "Student1 +not_good +" +challenge 1 "Student1 +-75 +" diff --git a/subjects/devops/grades/README.md b/subjects/devops/grades/README.md index a1f8db4e..5b57cff8 100644 --- a/subjects/devops/grades/README.md +++ b/subjects/devops/grades/README.md @@ -15,6 +15,7 @@ $ ./grades.sh 1 Student Name #1: Sara Student Grade #1: 90 Sara: You did an excellent job! +$ ``` - If the student grade is anything equal or greater than 70 you will return the string `": You did a good job!"`: @@ -24,6 +25,7 @@ $ ./grades.sh 1 Student Name #1: Sara Student Grade #1: 75 Sara: You did a good job! +$ ``` - If the student grade is anything equal or greater than 50 you will return the string `": You need a bit more effort!"`: @@ -33,6 +35,7 @@ $ ./grades.sh 1 Student Name #1: Sara Student Grade #1: 51 Sara: You need a bit more effort! +$ ``` - If the student grade is anything lower than 50 you will return the string `": You had a poor performance!"`: @@ -42,6 +45,7 @@ $ ./grades.sh 1 Student Name #1: Sara Student Grade #1: 34 Sara: You had a poor performance! +$ ``` ### Error handling @@ -57,7 +61,7 @@ $ ./grades.sh 2 Student Name #1: Sara Student Grade #1: 101 Error: The grade '101' is not a valid input. Only numerical grades between 0 and 100 are accepted. -./grades.sh 2 +$ ./grades.sh 2 Student Name #1: Bob Student Grade #1: ten Error: The grade 'ten' is not a valid input. Only numerical grades between 0 and 100 are accepted. @@ -82,6 +86,7 @@ Sara: You had a poor performance! Norman: You need a bit more effort! James: You did a good job! Albert: You did an excellent job! +$ ``` ### Hints