-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
32 lines (24 loc) · 951 Bytes
/
Copy pathmain.py
File metadata and controls
32 lines (24 loc) · 951 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import arithmetic_arranger as aa
import test_module
if __name__ == '__main__':
# Perform unit tests first
print("Perform unit tests first...")
exec("test_module")
testing = test_module.MyTestCase()
testing.test_well_formatted_problems()
testing.test_too_many_problems()
testing.test_wrong_operator()
testing.test_operands_with_non_digit_characters()
testing.test_operands_with_more_than_4_digits()
# Testing the examples given in the exercise to see if I get the same outputs
print("No error during unit tests. Showing some examples of outputs...")
# Example #1
print("\nExample #1:")
problems = ["32 + 698", "3801 + 2", "45 + 43", "123 + 49"]
print(problems)
print(aa.arithmetic_arranger(problems))
# Example #2
print("\nExample #2:")
problems = ["32 + 8", "1 - 3801", "9999 + 9999", "523 - 49"]
print(problems)
print(aa.arithmetic_arranger(problems, True))