Browse Source

fix(grades): fix and add more tests

DEV-4397-piscine-ai-missing-file-for-ex-7-of-nlp
miguel 2 years ago committed by MSilva95
parent
commit
1f9b277887
  1. 17
      sh/tests/grades_test.sh
  2. 7
      subjects/devops/grades/README.md

17
sh/tests/grades_test.sh

@ -19,6 +19,12 @@ $input
EOF EOF
) )
diff <(echo "$submitted") <(echo "$expected") diff <(echo "$submitted") <(echo "$expected")
if [ $? != 0 ]; then
exit 1
fi
echo $submitted
echo $expected
} }
challenge 1 "Student1 challenge 1 "Student1
90 90
@ -41,6 +47,11 @@ challenge 1 "Student6
challenge 1 "Student7 challenge 1 "Student7
25 25
" "
challenge 2 "Student1
0
Alice
100
"
challenge 3 "Bob challenge 3 "Bob
90 90
Alice Alice
@ -66,3 +77,9 @@ Alice
Eve Eve
55 55
" "
challenge 1 "Student1
not_good
"
challenge 1 "Student1
-75
"

7
subjects/devops/grades/README.md

@ -15,6 +15,7 @@ $ ./grades.sh 1
Student Name #1: Sara Student Name #1: Sara
Student Grade #1: 90 Student Grade #1: 90
Sara: You did an excellent job! Sara: You did an excellent job!
$
``` ```
- If the student grade is anything equal or greater than 70 you will return the string `"<name>: You did a good job!"`: - If the student grade is anything equal or greater than 70 you will return the string `"<name>: You did a good job!"`:
@ -24,6 +25,7 @@ $ ./grades.sh 1
Student Name #1: Sara Student Name #1: Sara
Student Grade #1: 75 Student Grade #1: 75
Sara: You did a good job! Sara: You did a good job!
$
``` ```
- If the student grade is anything equal or greater than 50 you will return the string `"<name>: You need a bit more effort!"`: - If the student grade is anything equal or greater than 50 you will return the string `"<name>: You need a bit more effort!"`:
@ -33,6 +35,7 @@ $ ./grades.sh 1
Student Name #1: Sara Student Name #1: Sara
Student Grade #1: 51 Student Grade #1: 51
Sara: You need a bit more effort! Sara: You need a bit more effort!
$
``` ```
- If the student grade is anything lower than 50 you will return the string `"<name>: You had a poor performance!"`: - If the student grade is anything lower than 50 you will return the string `"<name>: You had a poor performance!"`:
@ -42,6 +45,7 @@ $ ./grades.sh 1
Student Name #1: Sara Student Name #1: Sara
Student Grade #1: 34 Student Grade #1: 34
Sara: You had a poor performance! Sara: You had a poor performance!
$
``` ```
### Error handling ### Error handling
@ -57,7 +61,7 @@ $ ./grades.sh 2
Student Name #1: Sara Student Name #1: Sara
Student Grade #1: 101 Student Grade #1: 101
Error: The grade '101' is not a valid input. Only numerical grades between 0 and 100 are accepted. 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 Name #1: Bob
Student Grade #1: ten Student Grade #1: ten
Error: The grade 'ten' is not a valid input. Only numerical grades between 0 and 100 are accepted. 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! Norman: You need a bit more effort!
James: You did a good job! James: You did a good job!
Albert: You did an excellent job! Albert: You did an excellent job!
$
``` ```
### Hints ### Hints

Loading…
Cancel
Save