Testing Route Logic
A developer writes a function to determine if a bus is ‘on-time’ based on the scheduled arrival and the actual arrival time. If the difference is less than or equal to 5 minutes, the bus is marked as on-time. Otherwise, it is marked as delayed.
The developer performs test cases to verify the logic.
| Scheduled | Actual | Expected Result |
|---|---|---|
| 10:00 | 10:04 | On-time |
| 10:00 | 10:05 | On-time |
| 10:00 | 10:06 | Delayed |
The developer finds that the test case where the actual arrival is 10:05 fails. Which conclusion is most accurate?
Testing has proven that the code is correct for all possible arrival times.
The test cases show that the program logic is error-free because most tests passed.
The test cases reveal an error, suggesting the comparison operator used in the code may be incorrect.
The test cases demonstrate that the program behavior is correct and no further debugging is needed.
Question Leaderboard
Not enough data yet to show leaderboard.
