Skip to content

Commit 43d0f68

Browse files
committed
use BOOST_THREAD_TEST_IT with BOOST_THREAD_TEST_TIME_MS
1 parent 97522b4 commit 43d0f68

File tree

2 files changed

+32
-32
lines changed

2 files changed

+32
-32
lines changed

test/sync/futures/async/async_pass.cpp

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include <boost/thread/csbl/memory/unique_ptr.hpp>
3636
#include <memory>
3737
#include <boost/detail/lightweight_test.hpp>
38+
#include "../../../timming.hpp"
3839

3940
typedef boost::chrono::high_resolution_clock Clock;
4041
typedef boost::chrono::milliseconds ms;
@@ -159,7 +160,7 @@ struct check_timer {
159160
}
160161
~check_timer() {
161162
Clock::time_point now = Clock::now();
162-
BOOST_TEST(now - start < delay);
163+
BOOST_THREAD_TEST_IT(now - start, delay);
163164
std::cout << __FILE__ << "[" << __LINE__ << "] " << (now - start).count() << std::endl;
164165
}
165166

@@ -217,7 +218,7 @@ int main()
217218
boost::this_thread::sleep_for(ms(300));
218219
int res;
219220
{
220-
check_timer timer(ms(500));
221+
check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS));
221222
res = f.get();
222223
}
223224
BOOST_TEST(res == 3);
@@ -241,7 +242,7 @@ int main()
241242
boost::this_thread::sleep_for(ms(300));
242243
int res;
243244
{
244-
check_timer timer(ms(500));
245+
check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS));
245246
res = f.get();
246247
}
247248
BOOST_TEST(res == 3);
@@ -265,7 +266,7 @@ int main()
265266
boost::this_thread::sleep_for(ms(300));
266267
int res;
267268
{
268-
check_timer timer(ms(500));
269+
check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS));
269270
res = f.get();
270271
}
271272
BOOST_TEST(res == 3);
@@ -289,7 +290,7 @@ int main()
289290
boost::this_thread::sleep_for(ms(300));
290291
int res;
291292
{
292-
check_timer timer(ms(500));
293+
check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS));
293294
res = f.get();
294295
}
295296
BOOST_TEST(res == 3);
@@ -314,7 +315,7 @@ int main()
314315
//boost::this_thread::sleep_for(ms(300));
315316
int res;
316317
{
317-
check_timer timer(ms(500));
318+
check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS));
318319
res = f.get();
319320
}
320321
BOOST_TEST(res == 3);
@@ -341,7 +342,7 @@ int main()
341342
boost::this_thread::sleep_for(ms(300));
342343
int res;
343344
{
344-
check_timer timer(ms(500));
345+
check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS));
345346
res = f.get();
346347
}
347348
BOOST_TEST(res == 3);
@@ -366,7 +367,7 @@ int main()
366367
boost::this_thread::sleep_for(ms(300));
367368
int res;
368369
{
369-
check_timer timer(ms(500));
370+
check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS));
370371
res = f.get();
371372
}
372373
BOOST_TEST(res == 3);
@@ -391,7 +392,7 @@ int main()
391392
boost::this_thread::sleep_for(ms(300));
392393
int res;
393394
{
394-
check_timer timer(ms(500));
395+
check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS));
395396
res = f.get();
396397
}
397398
BOOST_TEST(res == 3);
@@ -415,7 +416,7 @@ int main()
415416
boost::this_thread::sleep_for(ms(300));
416417
int res;
417418
{
418-
check_timer timer(ms(500));
419+
check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS));
419420
res = f.get();
420421
}
421422
BOOST_TEST(res == 3);
@@ -439,7 +440,7 @@ int main()
439440
boost::this_thread::sleep_for(ms(300));
440441
int res;
441442
{
442-
check_timer timer(ms(500));
443+
check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS));
443444
res = f.get();
444445
}
445446
BOOST_TEST(res == 3);
@@ -463,7 +464,7 @@ int main()
463464
//boost::this_thread::sleep_for(ms(300));
464465
int res;
465466
{
466-
check_timer timer(ms(500));
467+
check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS));
467468
res = f.get();
468469
}
469470
BOOST_TEST(res == 3);
@@ -487,7 +488,7 @@ int main()
487488
boost::this_thread::sleep_for(ms(300));
488489
int* res;
489490
{
490-
check_timer timer(ms(500));
491+
check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS));
491492
res = &f.get();
492493
}
493494
BOOST_TEST(res == &i);
@@ -510,7 +511,7 @@ int main()
510511
boost::this_thread::sleep_for(ms(300));
511512
int* res;
512513
{
513-
check_timer timer(ms(500));
514+
check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS));
514515
res = &f.get();
515516
}
516517
BOOST_TEST(res == &i);
@@ -533,7 +534,7 @@ int main()
533534
boost::this_thread::sleep_for(ms(300));
534535
int* res;
535536
{
536-
check_timer timer(ms(500));
537+
check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS));
537538
res = &f.get();
538539
}
539540
BOOST_TEST(res == &i);
@@ -557,7 +558,7 @@ int main()
557558
//boost::this_thread::sleep_for(ms(300));
558559
int* res;
559560
{
560-
check_timer timer(ms(500));
561+
check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS));
561562
res = &f.get();
562563
}
563564
BOOST_TEST(res == &i);
@@ -580,7 +581,7 @@ int main()
580581
boost::future<void> f = boost::async(f2);
581582
boost::this_thread::sleep_for(ms(300));
582583
{
583-
check_timer timer(ms(500));
584+
check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS));
584585
f.get();
585586
}
586587
}
@@ -601,7 +602,7 @@ int main()
601602
boost::future<void> f = boost::async(boost::launch::async, f2);
602603
boost::this_thread::sleep_for(ms(300));
603604
{
604-
check_timer timer(ms(500));
605+
check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS));
605606
f.get();
606607
}
607608
}
@@ -622,7 +623,7 @@ int main()
622623
boost::future<void> f = boost::async(boost::launch::any, f2);
623624
boost::this_thread::sleep_for(ms(300));
624625
{
625-
check_timer timer(ms(500));
626+
check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS));
626627
f.get();
627628
}
628629
}
@@ -644,7 +645,7 @@ int main()
644645
boost::future<void> f = boost::async(boost::launch::deferred, f2);
645646
//boost::this_thread::sleep_for(ms(300));
646647
{
647-
check_timer timer(ms(500));
648+
check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS));
648649
f.get();
649650
}
650651
}
@@ -668,7 +669,7 @@ int main()
668669
boost::this_thread::sleep_for(ms(300));
669670
MoveOnly res;
670671
{
671-
check_timer timer(ms(500));
672+
check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS));
672673
res = f.get();
673674
}
674675
BOOST_TEST_EQ(res.value, 2);
@@ -692,7 +693,7 @@ int main()
692693
//boost::this_thread::sleep_for(ms(300));
693694
MoveOnly res;
694695
{
695-
check_timer timer(ms(500));
696+
check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS));
696697
res = f.get();
697698
}
698699
BOOST_TEST_EQ(res.value, 2);
@@ -717,7 +718,7 @@ int main()
717718
boost::this_thread::sleep_for(ms(300));
718719
MoveOnly res;
719720
{
720-
check_timer timer(ms(500));
721+
check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS));
721722
res = f.get();
722723
}
723724
BOOST_TEST(res.value == 2);
@@ -740,7 +741,7 @@ int main()
740741
boost::this_thread::sleep_for(ms(300));
741742
boost::csbl::unique_ptr<int> res;
742743
{
743-
check_timer timer(ms(500));
744+
check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS));
744745
res = f.get();
745746
}
746747
BOOST_TEST(*res == 3);
@@ -765,7 +766,7 @@ int main()
765766
boost::this_thread::sleep_for(ms(300));
766767
boost::csbl::unique_ptr<int> res;
767768
{
768-
check_timer timer(ms(500));
769+
check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS));
769770
res = f.get();
770771
}
771772
BOOST_TEST(*res == 3);
@@ -788,7 +789,7 @@ int main()
788789
//boost::this_thread::sleep_for(ms(300));
789790
boost::csbl::unique_ptr<int> res;
790791
{
791-
check_timer timer(ms(500));
792+
check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS));
792793
res = f.get();
793794
}
794795
BOOST_TEST(*res == 3);
@@ -811,7 +812,7 @@ int main()
811812
boost::this_thread::sleep_for(ms(300));
812813
boost::csbl::unique_ptr<int> res;
813814
{
814-
check_timer timer(ms(500));
815+
check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS));
815816
res = f.get();
816817
}
817818
BOOST_TEST(*res == 3);
@@ -837,7 +838,7 @@ int main()
837838
boost::this_thread::sleep_for(ms(300));
838839
boost::csbl::unique_ptr<int> res;
839840
{
840-
check_timer timer(ms(500));
841+
check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS));
841842
res = f.get();
842843
}
843844
BOOST_TEST(*res == 3);
@@ -860,7 +861,7 @@ int main()
860861
//boost::this_thread::sleep_for(ms(300));
861862
boost::csbl::unique_ptr<int> res;
862863
{
863-
check_timer timer(ms(500));
864+
check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS));
864865
res = f.get();
865866
}
866867
BOOST_TEST(*res == 3);
@@ -883,7 +884,7 @@ int main()
883884
boost::this_thread::sleep_for(ms(300));
884885
boost::csbl::unique_ptr<int> res;
885886
{
886-
check_timer timer(ms(500));
887+
check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS));
887888
res = f.get();
888889
}
889890
BOOST_TEST(*res == 3);

test/test_condition_notify_all.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99
#undef BOOST_TEST
1010
#undef BOOST_ERROR
1111
#include <boost/thread/detail/config.hpp>
12-
1312
#include <boost/thread/thread_only.hpp>
14-
1513
#include <boost/test/unit_test.hpp>
14+
#include <boost/core/lightweight_test.hpp>
1615

1716
#include "./util.inl"
1817
#include "./condition_test_common.hpp"

0 commit comments

Comments
 (0)