AMDG On 03/22/2011 11:52 PM, Stirling Westrup wrote:
I have been using Boost.test to run some simple unit tests as I build my code. I've come across a case where I need to test if my code runs within an acceptable time limit. I know that the execution monitor has a timeout system for testing that sort of thing, but I can't figure out how it is supposed to be integrated into the unit test framework.
Well, you can just use boost::execution_monitor.
There's nothing incompatible between it and the
Unit Test Framework.
Unfortunately, as the documentation notes:
unit_test::readwrite_property<int> p_timeout; //
Specifies the seconds that elapse before a timer_error occurs.
May be ignored on some platforms.
I tried the following on both Linux and Windows,
and it didn't work on Windows.
#include
Ideally, I'd love to just have a BOOST_CHECK_TIMED( f(), timeout) that I could invoke to ensure that the code returns true, and returns within the specified timeout interval.
In Christ, Steven Watanabe