Skip to content

Commit

Permalink
Add comments to the example tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkula committed May 11, 2023
1 parent e073c7c commit f185526
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/run-calculator-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ jobs:
OUTPUT_RUNS=True python3 your_tests.py | tee ./output.txt \
&& grep -q "TEST RUN:" ./output.txt \
&& rm -f output.txt \
|| echo "Either your tests failed or you didn't write any!"
|| (echo "ERROR: Either your tests failed or you didn't write any!" && false)
5 changes: 5 additions & 0 deletions calculator/tests/example_tests.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
#!/usr/bin/env python3
from calculator_adapter import run

### EXAMPLE TESTS
# Checks that the program outputs "3" for an input of "1 + 2"
assert run("1 + 2").output == "3"
# Checks that the program outputs "8" for an input of "2 * 4"
assert run("2 * 4").output == "8"
# Checks that the program exists successfully (no error) for input "2 * 4"
assert run("2 * 4").exit_status == 0
# Checks that the program fails (correctly errors) for input "2 @ 3"
assert run("2 @ 3").exit_status != 0

print("All tests passed!")

0 comments on commit f185526

Please sign in to comment.