| 12345678910111213141516171819202122232425262728293031323334353637 |
- test_count = 0
- def test(result, expect) -> None:
- global test_count
- test_count += 1
- if result == expect:
- print("Test #" + str(test_count) + " SUCCESS.")
- return
- print("Test #" + str(test_count) + " FAIL.")
- print("Expected: \"" + repr(expect) + "\".")
- print("Result: \"" + repr(result) + "\".")
- print()
- exit(1)
- def test_error(error, function, *args, **kwargs) -> None:
- global test_count
- test_count += 1
- try:
- function(*args, **kwargs)
-
- print("Test #" + str(test_count) + " FAIL.")
- print("Function not raise any exception.")
- print()
- exit(1)
- except Exception as catched:
- if type(catched) is not error:
- print("Test #" + str(test_count) + " FAIL.")
- print("Expected: \"" + repr(error) + "\".")
- print("Catched: \"" + repr(catched) + "\".")
- print()
- exit(1)
-
- print("Test #" + str(test_count) + " SUCCESS.")
|