Test Overview
This test checks if all the statements in a simple function are executed at least once. It verifies that the function returns the correct output for given inputs, ensuring full statement coverage.
This test checks if all the statements in a simple function are executed at least once. It verifies that the function returns the correct output for given inputs, ensuring full statement coverage.
def max_of_two(a, b): if a > b: return a else: return b def test_max_of_two(): assert max_of_two(5, 3) == 5 assert max_of_two(2, 4) == 4 assert max_of_two(7, 7) == 7 if __name__ == "__main__": test_max_of_two()
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts | Test environment ready, function max_of_two defined | - | PASS |
| 2 | Call max_of_two(5, 3) | Function executes with a=5, b=3 | Check if returned value == 5 | PASS |
| 3 | Call max_of_two(2, 4) | Function executes with a=2, b=4 | Check if returned value == 4 | PASS |
| 4 | Call max_of_two(7, 7) | Function executes with a=7, b=7 | Check if returned value == 7 | PASS |
| 5 | All assertions passed, test ends | All statements in max_of_two executed at least once | Verify full statement coverage | PASS |