This will fail the test if it takes more than 2 minutes to complete. However, if it takes more than 5 seconds to complete, it will print a warning. This allows us to keep an eye on test durations that may (or may not) accuse bugs or other problems we may want to fix or improve, without confusing those with correctness bugs.
Here's what it looks like when the assert fails; it is a bit uglier, but still understandable:
This adds a TEST_CHECK_TIME (and a TEST_CHECK_TIME_VERBOSE) macro that can be used inside the REQURE() macro in tests.
These allow us to decouple a test correctness timeout (say, 3 minutes) from a soft test duration check.
Example: (in state.cpp)
This will fail the test if it takes more than 2 minutes to complete. However, if it takes more than 5 seconds to complete, it will print a warning. This allows us to keep an eye on test durations that may (or may not) accuse bugs or other problems we may want to fix or improve, without confusing those with correctness bugs.
Here's what it looks like when the assert fails; it is a bit uglier, but still understandable: