Skip to content

Commit 94b0f81

Browse files
committed
use BOOST_THREAD_TEST_IT
Tests grep -r 'BOOST_TEST.* < ' sometimes fails without details. BOOST_THREAD_TEST_IT reports what the difference is. Vim regex for replacement: s/BOOST_TEST(\(.*\) < \(.*\))/BOOST_THREAD_TEST_IT(\1, \2)/
1 parent 0faa52c commit 94b0f81

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

test/sync/futures/async/async_executor_pass.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include <boost/detail/lightweight_test.hpp>
3333
#include <boost/thread/executors/basic_thread_pool.hpp>
3434
#include <boost/thread/executor.hpp>
35+
#include "../../../timming.hpp"
3536

3637
typedef boost::chrono::high_resolution_clock Clock;
3738
typedef boost::chrono::milliseconds ms;
@@ -156,7 +157,7 @@ struct check_timer {
156157
}
157158
~check_timer() {
158159
Clock::time_point now = Clock::now();
159-
BOOST_TEST(now - start < delay);
160+
BOOST_THREAD_TEST_IT(now - start, delay);
160161
std::cout << __FILE__ << "[" << __LINE__ << "] " << (now - start).count() << std::endl;
161162
}
162163

test/sync/mutual_exclusion/locks/unique_lock/cons/time_point_pass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ void f2()
5555
boost::unique_lock<boost::timed_mutex> lk(m, Clock::now() + ms(250));
5656
BOOST_TEST(lk.owns_lock() == false);
5757
t1 = Clock::now();
58-
ns d = t1 - t0 - ms(250);
59-
BOOST_TEST(d < max_diff);
58+
ms d = boost::chrono::duration_cast<boost::chrono::milliseconds>(t1 - t0) - ms(250);
59+
BOOST_THREAD_TEST_IT(d, ns(max_diff));
6060
}
6161

6262
int main()

0 commit comments

Comments
 (0)