add test for equal

This commit is contained in:
hugogogo
2026-05-14 13:42:25 +02:00
parent 7b5aa97c0c
commit 201f2fa0ce
3 changed files with 16 additions and 15 deletions

View File

@@ -73,12 +73,10 @@ run_test() {
fi
fi
# If check_error is true, verify if the output contains an error message or non-zero exit code
if [[ "$check_error" == "error" ]]; then
if [[ $exit_code -ne 0 || "$out" == *"Error"* ]]; then
printf $B_GREEN"PASS$RESET\n"
printf $B_GREEN"PASS$RESET (Input: '%s')\n" "$input"
else
printf $B_RED"FAIL$RESET\n"
printf " "$B_WHITE"Input:$RESET '%s'\n" "$input"
@@ -90,7 +88,7 @@ run_test() {
else
# Compare with expected output
if [[ "$out" == "$expected" ]]; then
printf $B_GREEN"PASS$RESET\n"
printf $B_GREEN"PASS$RESET (Input: '%s')\n" "$input"
else
printf $B_RED"FAIL$RESET\n"
printf " "$B_WHITE"Input:$RESET '%s'\n" "$input"
@@ -136,8 +134,8 @@ Discriminant is strictly positive, the two solutions are:
run_test \
"4. flag -e" \
'-e "3 * x^2 + 2 * x - 7 * x^4 = 1 * x^4"' "\
" \
'-e "3 * x^2 + 2 * x - 7 * x^4 = 1 * x^4"' \
"" \
error
run_test \
@@ -160,8 +158,8 @@ Discriminant is strictly negative, the two complex solutions are:
run_test \
"7. float exponent" \
"3.4 * x^2 + 1 * x^1 - 2.0 * x^0 = 5 * x^1.2" "\
" \
"3.4 * x^2 + 1 * x^1 - 2.0 * x^0 = 5 * x^1.2" \
"" \
error
run_test \
@@ -280,12 +278,10 @@ The solution is:
0.75"
run_test \
"23. degree 2" \
"3x^2" "\
Reduced form: 0 * x^0 + 0 * x^1 + 3 * x^2 = 0
Polynomial degree: 2
Discriminant is equal to zero, the solution is:
0"
"23. degree 2 without [=]" \
"3x^2" \
"" \
error
run_test \
"24. degree 2" \