From 393a02feba61173a248c51ffc7e7a8d8cfe8a330 Mon Sep 17 00:00:00 2001 From: emil Date: Sat, 2 Nov 2024 18:17:20 +0300 Subject: [PATCH] Make testing for all tests (got an error in TEST_MINIMAL_CASE) --- main.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 68a5fcd..7d73d23 100644 --- a/main.py +++ b/main.py @@ -253,6 +253,7 @@ def TEST_CASE_GENERAL(): expected_state = State.SOLVED if result.state == expected_state: print_result(result) + return 1 else: state_name = "" if result.state == State.UNSOLVED: @@ -262,6 +263,7 @@ def TEST_CASE_GENERAL(): elif result.state == State.SOLVED: state_name = "SOLVED" print(f"incorrect state type. expected SOLVED, got {state_name}.") + return 0 def TEST_MINIMIZE_CASE(): @@ -284,6 +286,7 @@ def TEST_MINIMIZE_CASE(): expected_state = State.SOLVED if result.state == expected_state: print_result(result) + return 1 else: state_name = "" if result.state == State.UNSOLVED: @@ -293,6 +296,7 @@ def TEST_MINIMIZE_CASE(): elif result.state == State.SOLVED: state_name = "SOLVED" print(f"incorrect state type. expected SOLVED, got {state_name}.") + return 0 @@ -317,6 +321,7 @@ def TEST_WITH_SLACK_CASE(): expected_state = State.SOLVED if result.state == expected_state: print_result(result) + return 1 else: state_name = "" if result.state == State.UNSOLVED: @@ -326,6 +331,7 @@ def TEST_WITH_SLACK_CASE(): elif result.state == State.SOLVED: state_name = "SOLVED" print(f"incorrect state type. expected SOLVED, got {state_name}.") + return 0 def TEST_UNBOUNDED_CASE(): print("----------------------------RUNNING_TEST_UNBOUNDED_CASE----------------------------") @@ -347,6 +353,7 @@ def TEST_UNBOUNDED_CASE(): expected_state = State.SOLVED if result.state == expected_state: print_result(result) + return 1 else: state_name = "" if result.state == State.UNSOLVED: @@ -356,6 +363,7 @@ def TEST_UNBOUNDED_CASE(): elif result.state == State.SOLVED: state_name = "SOLVED" print(f"incorrect state type. expected SOLVED, got {state_name}.") + return 0 def TEST_UNSOLVABLE_CASE(): print("----------------------------RUNNING_TEST_UNSOLVABLE_CASE----------------------------") @@ -380,6 +388,7 @@ def TEST_UNSOLVABLE_CASE(): expected_state = State.SOLVED if result.state == expected_state: print_result(result) + return 1 else: state_name = "" if result.state == State.UNSOLVED: @@ -388,4 +397,16 @@ def TEST_UNSOLVABLE_CASE(): state_name = "INAPPLICABLE" elif result.state == State.SOLVED: state_name = "SOLVED" - print(f"incorrect state type. expected SOLVED, got {state_name}.") \ No newline at end of file + print(f"incorrect state type. expected SOLVED, got {state_name}.") + return 0 + + +tests = [TEST_CASE_GENERAL(), TEST_MINIMIZE_CASE(), TEST_WITH_SLACK_CASE(), TEST_UNBOUNDED_CASE(), TEST_UNSOLVABLE_CASE()] +tests_passed = 0 +for test in tests: + tests_passed += test + + +print("----------------------------RESULTS----------------------------") +print("Total number of tests: " << tests.size()) +print("Total number of passed tests: " << tests_passed) \ No newline at end of file