Skip to content

Commit

Permalink
add unit test for additive and substractive
Browse files Browse the repository at this point in the history
  • Loading branch information
yashinomi committed Nov 6, 2020
1 parent 695512c commit be761e0
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test_parse_plus_or_minus.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from calc_str_eval import parse_add_or_minus


def main():
try:
correct: int = 1
equation: str = "0+1"
result = parse_add_or_minus(equation)
assert correct == result, f"want {correct}, got {result}"

correct: int = -1
equation: str = "0-1"
result = parse_add_or_minus(equation)
assert correct == result, f"want {correct}, got {result}"

correct: int = 1
equation: str = "2-1"
result = parse_add_or_minus(equation)
assert correct == result, f"want {correct}, got {result}"

correct: int = 5
equation: str = "2+3"
result = parse_add_or_minus(equation)
assert correct == result, f"want {correct}, got {result}"

except AssertionError as err:
print("AssertionError :", err)


if __name__ == "__main__":
main()

0 comments on commit be761e0

Please sign in to comment.