::boost::unit_test::test_results rc = ::boost::unit_test::results_collector.results(
id);
116 #if BOOST_VERSION >= 108700 117 #define BOOST_TEST_DETAIL_DUMMY_COND false 119 #define BOOST_TEST_DETAIL_DUMMY_COND ::boost::test_tools::tt_detail::dummy_cond() 122 #if BOOST_VERSION >= 105900 123 # if BOOST_VERSION >= 106000 124 # define BOOST_CHECK_THROW_IMPL_EX( S, E, P, postfix, TL, guard ) \ 127 BOOST_TEST_PASSPOINT(); \ 130 BOOST_TEST_TOOL_IMPL( 2, false, "exception "BOOST_STRINGIZE(E) \
131" expected but not raised", \
132TL, CHECK_MSG, _ ); \
133} catch( E const& ex ) { \
134::boost::ignore_unused( ex ); \
136BOOST_TEST_TOOL_IMPL( 2, P, \
137"exception \"" BOOST_STRINGIZE( E ) \
138"\" raised as expected" postfix, \
139TL, CHECK_MSG, _ ); \
142BOOST_TEST_TOOL_IMPL( 2, false, \
143"an unexpected exception was thrown by " \
144BOOST_STRINGIZE( S ), \
145TL, CHECK_MSG, _ ); \
147} while( BOOST_TEST_DETAIL_DUMMY_COND ) \
150 # define BOOST_THROW_AFFIX "" 151 # define BOOST_EXCEPTION_AFFIX(P) \ 152 ": validation on the raised exception through predicate \""\
153BOOST_STRINGIZE(P) "\""
156 # define BOOST_CHECK_THROW_IMPL_EX( S, E, P, prefix, TL, guard ) \ 159 BOOST_TEST_PASSPOINT(); \ 162 BOOST_TEST_TOOL_IMPL( 2, false, "exception "BOOST_STRINGIZE(E) \
164TL, CHECK_MSG, _ ); \
165} catch( E const& ex ) { \
166::boost::unit_test::ut_detail::ignore_unused_variable_warning( ex ); \
168BOOST_TEST_TOOL_IMPL( 2, P, prefix BOOST_STRINGIZE( E ) " is caught", \
169TL, CHECK_MSG, _ ); \
172BOOST_TEST_TOOL_IMPL( 2, false, \
173"an unexpected exception was thrown by " \
174BOOST_STRINGIZE( S ), \
175TL, CHECK_MSG, _ ); \
177} while( BOOST_TEST_DETAIL_DUMMY_COND ) \
181 # define BOOST_CHECK_NO_THROW_IMPL_EX( S, TL, guard ) \ 186 BOOST_TEST_TOOL_IMPL( 2, true, "no exceptions thrown by "\
187BOOST_STRINGIZE( S ), \
188TL, CHECK_MSG, _ ); \
189} catch (std::exception& ex) { \
191BOOST_TEST_TOOL_IMPL( 2, false, "an std::exception was thrown by " \
192BOOST_STRINGIZE( S ) " : " << ex.what(), \
193TL, CHECK_MSG, _ ); \
196BOOST_TEST_TOOL_IMPL( 2, false, "a nonstandard exception thrown by " \
197BOOST_STRINGIZE( S ), \
198TL, CHECK_MSG, _ ); \
200} while( BOOST_TEST_DETAIL_DUMMY_COND ) \
203 # define BOOST_CHECK_THROW_IMPL_EX( S, E, P, prefix, TL, guard ) \ 205 BOOST_TEST_PASSPOINT(); \ 208 BOOST_CHECK_IMPL( false, "exception "BOOST_STRINGIZE( E ) \
209" is expected", TL, CHECK_MSG ); } \
210catch( E const& ex ) { \
211boost::unit_test::ut_detail::ignore_unused_variable_warning( ex ); \
213BOOST_CHECK_IMPL( P, prefix BOOST_STRINGIZE( E ) " is caught", \
218BOOST_CHECK_IMPL(false, "an unexpected exception was thrown by " \
219BOOST_STRINGIZE( S ), \
224 # define BOOST_CHECK_NO_THROW_IMPL_EX( S, TL, guard ) \ 228 BOOST_CHECK_IMPL( true, "no exceptions thrown by "BOOST_STRINGIZE( S ), \
231catch (std::exception& ex) { \
233BOOST_CHECK_IMPL( false, "an std::exception was thrown by " \
234BOOST_STRINGIZE( S ) " : " << ex.what(), \
239BOOST_CHECK_IMPL( false, "a nonstandard exception thrown by " \
240BOOST_STRINGIZE( S ), \
246 #ifndef BOOST_THROW_AFFIX 247 # define BOOST_THROW_AFFIX "exception " 248 # define BOOST_EXCEPTION_AFFIX(P) "incorrect exception " 251 # define BOOST_CHECK_THROW_IMPL( S, E, P, affix, TL ) \ 252 BOOST_CHECK_THROW_IMPL_EX( S, E, P, affix, TL, ) 253 # define BOOST_CHECK_THROW_IMPL_MT_SAFE( S, E, P, affix, TL ) \ 254 BOOST_CHECK_THROW_IMPL_EX( S, E, P, affix, TL, \ 255 NCBI_NS_NCBI::CFastMutexGuard _ncbitest_guard( \ 256 NCBI_NS_NCBI::g_NcbiTestMutex) ) 258 #define BOOST_WARN_THROW_MT_SAFE( S, E ) \ 259 BOOST_CHECK_THROW_IMPL_MT_SAFE( S, E, true, BOOST_THROW_AFFIX, WARN ) 260 #define BOOST_CHECK_THROW_MT_SAFE( S, E ) \ 261 BOOST_CHECK_THROW_IMPL_MT_SAFE( S, E, true, BOOST_THROW_AFFIX, CHECK ) 262 #define BOOST_REQUIRE_THROW_MT_SAFE( S, E ) \ 263 BOOST_CHECK_THROW_IMPL_MT_SAFE( S, E, true, BOOST_THROW_AFFIX, REQUIRE ) 265 #define BOOST_WARN_EXCEPTION_MT_SAFE( S, E, P ) \ 266 BOOST_CHECK_THROW_IMPL_MT_SAFE( S, E, P( ex ), BOOST_EXCEPTION_AFFIX(P), \ 268 #define BOOST_CHECK_EXCEPTION_MT_SAFE( S, E, P ) \ 269 BOOST_CHECK_THROW_IMPL_MT_SAFE( S, E, P( ex ), BOOST_EXCEPTION_AFFIX(P), \ 271 #define BOOST_REQUIRE_EXCEPTION_MT_SAFE( S, E, P ) \ 272 BOOST_CHECK_THROW_IMPL_MT_SAFE( S, E, P( ex ), BOOST_EXCEPTION_AFFIX(P), \ 275 #define BOOST_CHECK_NO_THROW_IMPL( S, TL ) \ 276 BOOST_CHECK_NO_THROW_IMPL_EX( S, TL, ) 277 #define BOOST_CHECK_NO_THROW_IMPL_MT_SAFE( S, TL ) \ 278 BOOST_CHECK_NO_THROW_IMPL_EX( S, TL, \ 279 NCBI_NS_NCBI::CFastMutexGuard \ 281 NCBI_NS_NCBI::g_NcbiTestMutex) ) 283 #define BOOST_WARN_NO_THROW_MT_SAFE( S ) \ 284 BOOST_CHECK_NO_THROW_IMPL_MT_SAFE( S, WARN ) 285 #define BOOST_CHECK_NO_THROW_MT_SAFE( S ) \ 286 BOOST_CHECK_NO_THROW_IMPL_MT_SAFE( S, CHECK ) 287 #define BOOST_REQUIRE_NO_THROW_MT_SAFE( S ) \ 288 BOOST_CHECK_NO_THROW_IMPL_MT_SAFE( S, REQUIRE ) 291 #if BOOST_VERSION >= 104200 292 # define NCBI_BOOST_LOCATION() , boost::execution_exception::location() 294 # define NCBI_BOOST_LOCATION() 297 #ifdef BOOST_FIXTURE_TEST_CASE_NO_DECOR 298 # if BOOST_VERSION < 106900 302 typedefcollector collector_t;
307 # define NCBI_BOOST_DECORATOR_ARG \ 308 , boost::unit_test::decorator::collector_t::instance() 310 # define NCBI_BOOST_DECORATOR_ARG 313 #ifdef BOOST_FIXTURE_TEST_CASE_NO_DECOR 314 # define BOOST_FIXTURE_TEST_CASE_WITH_DECOR( test_name, F, decorators ) \ 315 struct test_name : public F { void test_method(); }; \ 317 static void BOOST_AUTO_TC_INVOKER( test_name )() \ 319 NCBI_NS_NCBI::CDiagContext& dctx = NCBI_NS_NCBI::GetDiagContext(); \ 320 NCBI_NS_NCBI::CRequestContext& rctx = dctx.GetRequestContext(); \ 321 rctx.SetRequestID(); \ 322 NCBI_NS_NCBI::CRequestContextGuard_Base rg(&rctx); \ 323 dctx.PrintRequestStart().Print("test_name", #test_name); \
324BOOST_TEST_CHECKPOINT('"' << #test_name << "\" fixture entry."); \
326BOOST_TEST_CHECKPOINT('"' << #test_name << "\" entry."); \
330catch (NCBI_NS_NCBI::CException& ex) { \
331ERR_POST("Uncaught exception in \"" \
332<< boost::unit_test \
333::framework::current_test_case().p_name \
335char* msg = NcbiSysChar_strdup(ex.what()); \
336NCBI_NS_NCBI::CNcbiTestMemoryCleanupList::GetInstance()->Add(msg); \
337throw boost::execution_exception( \
338boost::execution_exception::cpp_exception_error, \
340NCBI_BOOST_LOCATION() ); \
342BOOST_TEST_CHECKPOINT('"' << #test_name << "\" exit."); \
345struct BOOST_AUTO_TC_UNIQUE_ID( test_name ) {}; \
347static ::NCBI_NS_NCBI::SNcbiTestRegistrar \
348BOOST_JOIN( BOOST_JOIN( test_name, _registrar ), __LINE__ ) ( \
349boost::unit_test::make_test_case( \
350&BOOST_AUTO_TC_INVOKER( test_name ), #test_name, \
351__FILE__, __LINE__ ), \
352::NCBI_NS_NCBI::SNcbiTestTCTimeout< \
353BOOST_AUTO_TC_UNIQUE_ID( test_name )>::instance()->value(), \
356void test_name::test_method() \
359 # define BOOST_FIXTURE_TEST_CASE( test_name, F ) \ 360 struct test_name : public F { void test_method(); }; \ 362 static void BOOST_AUTO_TC_INVOKER( test_name )() \ 364 NCBI_NS_NCBI::CDiagContext& dctx = NCBI_NS_NCBI::GetDiagContext(); \ 365 NCBI_NS_NCBI::CRequestContext& rctx = dctx.GetRequestContext(); \ 366 rctx.SetRequestID(); \ 367 NCBI_NS_NCBI::CRequestContextGuard_Base rg(&rctx); \ 368 dctx.PrintRequestStart().Print("test_name", #test_name); \
373catch (NCBI_NS_NCBI::CException& ex) { \
374ERR_POST("Uncaught exception in \"" \
375<< boost::unit_test \
376::framework::current_test_case().p_name \
378char* msg = NcbiSysChar_strdup(ex.what()); \
379NCBI_NS_NCBI::CNcbiTestMemoryCleanupList::GetInstance()->Add(msg); \
380throw boost::execution_exception( \
381boost::execution_exception::cpp_exception_error, \
383NCBI_BOOST_LOCATION() ); \
387struct BOOST_AUTO_TC_UNIQUE_ID( test_name ) {}; \
389static ::NCBI_NS_NCBI::SNcbiTestRegistrar \
390BOOST_JOIN( BOOST_JOIN( test_name, _registrar ), __LINE__ ) ( \
391boost::unit_test::make_test_case( \
392&BOOST_AUTO_TC_INVOKER( test_name ), #test_name ), \
393boost::unit_test::ut_detail::auto_tc_exp_fail< \
394BOOST_AUTO_TC_UNIQUE_ID( test_name )>::instance()->value(), \
395::NCBI_NS_NCBI::SNcbiTestTCTimeout< \
396BOOST_AUTO_TC_UNIQUE_ID( test_name )>::instance()->value() ); \
398void test_name::test_method() \
402 #define BOOST_PARAM_TEST_CASE( function, begin, end ) \ 403 ::NCBI_NS_NCBI::NcbiTestGenTestCases( function, \ 404 BOOST_TEST_STRINGIZE( function ), \ 410 #define BOOST_AUTO_TEST_CASE_TIMEOUT(test_name, n) \ 411 struct BOOST_AUTO_TC_UNIQUE_ID( test_name ); \ 413 static struct BOOST_JOIN( test_name, _timeout_spec ) \ 415 SNcbiTestTCTimeout<BOOST_AUTO_TC_UNIQUE_ID( test_name ) > \ 417 BOOST_JOIN( test_name, _timeout_spec )() \ 419 SNcbiTestTCTimeout<BOOST_AUTO_TC_UNIQUE_ID( test_name ) >( n ) \ 421 } BOOST_JOIN( test_name, _timeout_spec_inst ); \ 429 #define BOOST_AUTO_PARAM_TEST_CASE( function, begin, end ) \ 430 BOOST_AUTO_TU_REGISTRAR(function) ( \ 431 BOOST_PARAM_TEST_CASE(function, begin, end) \ 432 NCBI_BOOST_DECORATOR_ARG) \ 435 #define BOOST_TIMEOUT(M) \ 437 throw boost::execution_exception( \ 438 boost::execution_exception::timeout_error, M \ 439 NCBI_BOOST_LOCATION()); \ 444 # define BOOST_TEST_TOOL_PASS_ARG_ONLY( r, _, arg ) , arg 446 #if BOOST_VERSION >= 105900 448 # define NCBITEST_CHECK_IMPL_EX(frwd_type, P, check_descr, TL, CT, ARGS) \ 449 BOOST_CHECK_NO_THROW_IMPL( \ 450 BOOST_TEST_TOOL_IMPL(frwd_type, P, check_descr, TL, CT, ARGS), TL) 452 # define NCBITEST_CHECK_IMPL(P, check_descr, TL, CT) \ 453 NCBITEST_CHECK_IMPL_EX(2, P, check_descr, TL, CT, _) 455 # define NCBITEST_CHECK_WITH_ARGS_IMPL(P, check_descr, TL, CT, ARGS) \ 456 NCBITEST_CHECK_IMPL_EX(0, ::boost::test_tools::tt_detail::P(), \ 457 check_descr, TL, CT, ARGS) 459 # define NCBITEST_CHECK_IMPL_MT_SAFE(P, check_descr, TL, CT) \ 461 bool _ncbitest_value; \ 462 NCBI_NS_NCBI::CFastMutexGuard _ncbitest_guard \ 463 (NCBI_NS_NCBI::eEmptyGuard); \ 464 BOOST_CHECK_NO_THROW_IMPL_EX(_ncbitest_value = (P);, TL, \ 465 _ncbitest_guard.Guard(NCBI_NS_NCBI::g_NcbiTestMutex)); \ 466 BOOST_TEST_TOOL_IMPL(2, _ncbitest_value, check_descr, TL, CT, _); \ 467 } while( BOOST_TEST_DETAIL_DUMMY_COND ) 469 # define BOOST_PP_BOOL_00 0 471 # define BOOST_TEST_TOOL_PASS_PRED00( P, ARGS ) P 473 # define BOOST_TEST_TOOL_PASS_ARGS00( ARGS ) \ 474 BOOST_PP_SEQ_FOR_EACH( BOOST_TEST_TOOL_PASS_ARG_ONLY, _, ARGS ) 476 # define NCBITEST_CHECK_WITH_2_ARGS_IMPL_MT_SAFE(P, descr, TL, CT, A1, A2) \ 478 std::decay<decltype(A1)>::type _ncbitest_value1; \ 479 std::decay<decltype(A2)>::type _ncbitest_value2; \ 480 NCBI_NS_NCBI::CFastMutexGuard _ncbitest_guard \ 481 (NCBI_NS_NCBI::eEmptyGuard); \ 482 BOOST_CHECK_NO_THROW_IMPL_EX( \ 483 _ncbitest_value1 = (A1); _ncbitest_value2 = (A2);, TL, \ 484 _ncbitest_guard.Guard(NCBI_NS_NCBI::g_NcbiTestMutex)); \ 485 BOOST_TEST_TOOL_IMPL(00, ::boost::test_tools::tt_detail::P(), \ 487 (_ncbitest_value1)(BOOST_STRINGIZE(A1)) \ 488 (_ncbitest_value2)(BOOST_STRINGIZE(A2))); \ 489 } while( BOOST_TEST_DETAIL_DUMMY_COND ) 491 # define BOOST_CHECK_IMPL_MT_SAFE( P, check_descr, TL, CT ) \ 493 bool _ncbitest_value = (P); \ 494 NCBI_NS_NCBI::CFastMutexGuard _ncbitest_guard \ 495 (NCBI_NS_NCBI::g_NcbiTestMutex); \ 496 BOOST_TEST_TOOL_IMPL( 2, _ncbitest_value, check_descr, TL, CT, _ ); \ 497 } while( BOOST_TEST_DETAIL_DUMMY_COND ) 499 # define BOOST_CHECK_WITH_2_ARGS_IMPL_MT_SAFE(P, descr, TL, CT, A1, A2) \ 501 auto _ncbitest_value1 = A1; \ 502 auto _ncbitest_value2 = A2; \ 503 NCBI_NS_NCBI::CFastMutexGuard _ncbitest_guard \ 504 (NCBI_NS_NCBI::g_NcbiTestMutex); \ 505 BOOST_TEST_TOOL_IMPL(00, ::boost::test_tools::tt_detail::P(), \ 507 (_ncbitest_value1)(BOOST_STRINGIZE(A1)) \ 508 (_ncbitest_value2)(BOOST_STRINGIZE(A2))); \ 509 } while( BOOST_TEST_DETAIL_DUMMY_COND ) 511 # define BOOST_CLOSE_IMPL_MT_SAFE( L, R, T, TL ) \ 513 auto _ncbitest_l = L; \ 514 auto _ncbitest_r = R; \ 515 auto _ncbitest_t = ::boost::math::fpc::percent_tolerance(T); \ 516 NCBI_NS_NCBI::CFastMutexGuard _ncbitest_guard \ 517 (NCBI_NS_NCBI::g_NcbiTestMutex); \ 518 BOOST_TEST_TOOL_IMPL( \ 519 00, ::boost::test_tools::check_is_close_t(), "", TL, CHECK_CLOSE, \
520(_ncbitest_l)(BOOST_STRINGIZE(L))(_ncbitest_r)(BOOST_STRINGIZE(R))\
521(_ncbitest_t)("")); \
522} while ( BOOST_TEST_DETAIL_DUMMY_COND )
524 # define BOOST_EQUAL_COLLECTIONS_IMPL_MT_SAFE( LB, LE, RB, RE, TL ) \ 526 NCBI_NS_NCBI::CFastMutexGuard _ncbitest_guard \ 527 (NCBI_NS_NCBI::g_NcbiTestMutex); \ 528 BOOST_TEST_TOOL_IMPL( \ 529 1, ::boost::test_tools::tt_detail::equal_coll_impl(), \ 530 "", TL, CHECK_EQUAL_COLL, (LB)(LE)(RB)(RE) ); \
531} while( BOOST_TEST_DETAIL_DUMMY_COND )
535 # define NCBITEST_CHECK_IMPL(P, check_descr, TL, CT) \ 536 BOOST_CHECK_NO_THROW_IMPL(BOOST_CHECK_IMPL(P, check_descr, TL, CT), TL) 538 # define NCBITEST_CHECK_WITH_ARGS_IMPL(P, check_descr, TL, CT, ARGS) \ 539 BOOST_CHECK_NO_THROW_IMPL(BOOST_CHECK_WITH_ARGS_IMPL( \ 540 ::boost::test_tools::tt_detail::P(), check_descr, TL, CT, ARGS), TL) 542 # define NCBITEST_CHECK_IMPL_MT_SAFE(P, check_descr, TL, CT) \ 544 bool _ncbitest_value; \ 545 NCBI_NS_NCBI::CFastMutexGuard _ncbitest_guard \ 546 (NCBI_NS_NCBI::eEmptyGuard); \ 547 BOOST_CHECK_NO_THROW_IMPL_EX(_ncbitest_value = (P), TL, \ 548 _ncbitest_guard.Guard(NCBI_NS_NCBI::g_NcbiTestMutex)); \ 549 BOOST_CHECK_IMPL(_ncbitest_value, check_descr, TL, CT); \ 550 } while ( ::boost::test_tools::dummy_cond ) 552 # define NCBITEST_CHECK_WITH_2_ARGS_IMPL_MT_SAFE(P, descr, TL, CT, A1, A2) \ 554 std::decay<decltype(A1)>::type _ncbitest_value1; \ 555 std::decay<decltype(A2)>::type _ncbitest_value2; \ 556 NCBI_NS_NCBI::CFastMutexGuard _ncbitest_guard \ 557 (NCBI_NS_NCBI::eEmptyGuard); \ 558 BOOST_CHECK_NO_THROW_IMPL_EX( \ 559 _ncbitest_value1 = (A1); _ncbitest_value2 = (A2);, TL, \ 560 _ncbitest_guard.Guard(NCBI_NS_NCBI::g_NcbiTestMutex)); \ 562 BOOST_TEST_TOOL_IMPL( check_frwd, \ 563 ::boost::test_tools::tt_detail::P(), \ 565 BOOST_PP_SEQ_FOR_EACH( BOOST_TEST_TOOL_PASS_ARG_ONLY, '_', \ 566 (_ncbitest_value1)(BOOST_STRINGIZE(A1)) \ 567 (_ncbitest_value2)(BOOST_STRINGIZE(A2)))); \ 568 } while ( ::boost::test_tools::dummy_cond ) 570 # define BOOST_CHECK_IMPL_MT_SAFE( P, check_descr, TL, CT ) \ 572 bool _ncbitest_value = (P); \ 573 NCBI_NS_NCBI::CFastMutexGuard _ncbitest_guard \ 574 (NCBI_NS_NCBI::g_NcbiTestMutex); \ 575 BOOST_CHECK_IMPL( _ncbitest_value, check_descr, TL, CT ); \ 576 } while ( ::boost::test_tools::dummy_cond ) 578 # define BOOST_CHECK_WITH_2_ARGS_IMPL_MT_SAFE(P, descr, TL, CT, A1, A2) \ 580 auto _ncbitest_value1 = A1; \ 581 auto _ncbitest_value2 = A2; \ 582 NCBI_NS_NCBI::CFastMutexGuard _ncbitest_guard \ 583 (NCBI_NS_NCBI::g_NcbiTestMutex); \ 584 BOOST_TEST_PASSPOINT(); \ 585 BOOST_TEST_TOOL_IMPL( check_frwd, \ 586 ::boost::test_tools::tt_detail::P(), \ 588 BOOST_PP_SEQ_FOR_EACH( BOOST_TEST_TOOL_PASS_ARG_ONLY, '_', \ 589 (_ncbitest_value1)(BOOST_STRINGIZE(A1)) \ 590 (_ncbitest_value2)(BOOST_STRINGIZE(A2)))); \ 591 } while ( ::boost::test_tools::dummy_cond ) 593 # define BOOST_CLOSE_IMPL_MT_SAFE( L, R, T, TL ) \ 595 auto _ncbitest_l = L; \ 596 auto _ncbitest_r = R; \ 597 auto _ncbitest_t = ::boost::test_tools::percent_tolerance(T); \ 598 NCBI_NS_NCBI::CFastMutexGuard _ncbitest_guard \ 599 (NCBI_NS_NCBI::g_NcbiTestMutex); \ 600 BOOST_TEST_PASSPOINT(); \ 601 BOOST_TEST_TOOL_IMPL(check_frwd, ::boost::test_tools::check_is_close, \ 602 "", TL, CHECK_CLOSE) \
603BOOST_PP_SEQ_FOR_EACH(BOOST_TEST_TOOL_PASS_ARG_ONLY, '_', \
604(_ncbitest_l)(BOOST_STRINGIZE(L)) \
605(_ncbitest_r)(BOOST_STRINGIZE(R)) \
606(_ncbitest_t)(""))); \
607} while ( ::boost::test_tools::dummy_cond )
609 # define BOOST_EQUAL_COLLECTIONS_IMPL_MT_SAFE( LB, LE, RB, RE, TL ) \ 611 NCBI_NS_NCBI::CFastMutexGuard _ncbitest_guard \ 612 (NCBI_NS_NCBI::g_NcbiTestMutex); \ 613 BOOST_EQUAL_COLLECTIONS_IMPL( LB, LE, RB, RE, TL ); \ 614 } while( ::boost::test_tools::dummy_cond ) 620 #define NCBITEST_WARN(P) NCBITEST_CHECK_IMPL( (P), BOOST_TEST_STRINGIZE( P ), WARN, CHECK_PRED ) 621 #define NCBITEST_CHECK(P) NCBITEST_CHECK_IMPL( (P), BOOST_TEST_STRINGIZE( P ), CHECK, CHECK_PRED ) 622 #define NCBITEST_REQUIRE(P) NCBITEST_CHECK_IMPL( (P), BOOST_TEST_STRINGIZE( P ), REQUIRE, CHECK_PRED ) 624 #define NCBITEST_WARN_MT_SAFE(P) \ 625 NCBITEST_CHECK_IMPL_MT_SAFE( (P), BOOST_TEST_STRINGIZE( P ), WARN, \ 627 #define NCBITEST_CHECK_MT_SAFE(P) \ 628 NCBITEST_CHECK_IMPL_MT_SAFE( (P), BOOST_TEST_STRINGIZE( P ), CHECK, \ 630 #define NCBITEST_REQUIRE_MT_SAFE(P) \ 631 NCBITEST_CHECK_IMPL_MT_SAFE( (P), BOOST_TEST_STRINGIZE( P ), REQUIRE, \ 635 #define NCBITEST_WARN_MESSAGE( P, M ) NCBITEST_CHECK_IMPL( (P), M, WARN, CHECK_MSG ) 636 #define NCBITEST_CHECK_MESSAGE( P, M ) NCBITEST_CHECK_IMPL( (P), M, CHECK, CHECK_MSG ) 637 #define NCBITEST_REQUIRE_MESSAGE( P, M ) NCBITEST_CHECK_IMPL( (P), M, REQUIRE, CHECK_MSG ) 639 #define NCBITEST_WARN_MESSAGE_MT_SAFE( P, M ) \ 640 NCBITEST_CHECK_IMPL_MT_SAFE( (P), M, WARN, CHECK_MSG ) 641 #define NCBITEST_CHECK_MESSAGE_MT_SAFE( P, M ) \ 642 NCBITEST_CHECK_IMPL_MT_SAFE( (P), M, CHECK, CHECK_MSG ) 643 #define NCBITEST_REQUIRE_MESSAGE_MT_SAFE( P, M ) \ 644 NCBITEST_CHECK_IMPL_MT_SAFE( (P), M, REQUIRE, CHECK_MSG ) 647 #define NCBITEST_WARN_EQUAL( L, R ) \ 648 NCBITEST_CHECK_WITH_ARGS_IMPL( equal_impl_frwd, "", WARN, CHECK_EQUAL, (L)(R) )
649 #define NCBITEST_CHECK_EQUAL( L, R ) \ 650 NCBITEST_CHECK_WITH_ARGS_IMPL( equal_impl_frwd, "", CHECK, CHECK_EQUAL, (L)(R) )
651 #define NCBITEST_REQUIRE_EQUAL( L, R ) \ 652 NCBITEST_CHECK_WITH_ARGS_IMPL( equal_impl_frwd, "", REQUIRE, CHECK_EQUAL, (L)(R) )
654 #define NCBITEST_WARN_EQUAL_MT_SAFE( L, R ) \ 655 NCBITEST_CHECK_WITH_2_ARGS_IMPL_MT_SAFE( equal_impl_frwd, "", WARN, \
657 #define NCBITEST_CHECK_EQUAL_MT_SAFE( L, R ) \ 658 NCBITEST_CHECK_WITH_2_ARGS_IMPL_MT_SAFE( equal_impl_frwd, "", CHECK, \
660 #define NCBITEST_REQUIRE_EQUAL_MT_SAFE( L, R ) \ 661 NCBITEST_CHECK_WITH_2_ARGS_IMPL_MT_SAFE( equal_impl_frwd, "", REQUIRE, \
665 #define NCBITEST_WARN_NE( L, R ) \ 666 NCBITEST_CHECK_WITH_ARGS_IMPL( ne_impl, "", WARN, CHECK_NE, (L)(R) )
667 #define NCBITEST_CHECK_NE( L, R ) \ 668 NCBITEST_CHECK_WITH_ARGS_IMPL( ne_impl, "", CHECK, CHECK_NE, (L)(R) )
669 #define NCBITEST_REQUIRE_NE( L, R ) \ 670 NCBITEST_CHECK_WITH_ARGS_IMPL( ne_impl, "", REQUIRE, CHECK_NE, (L)(R) )
672 #define NCBITEST_WARN_NE_MT_SAFE( L, R ) \ 673 NCBITEST_CHECK_WITH_2_ARGS_IMPL_MT_SAFE( ne_impl, "", WARN, \
675 #define NCBITEST_CHECK_NE_MT_SAFE( L, R ) \ 676 NCBITEST_CHECK_WITH_2_ARGS_IMPL_MT_SAFE( ne_impl, "", CHECK, \
678 #define NCBITEST_REQUIRE_NE_MT_SAFE( L, R ) \ 679 NCBITEST_CHECK_WITH_2_ARGS_IMPL_MT_SAFE( ne_impl, "", REQUIRE, \
683 #define BOOST_WARN_MT_SAFE( P ) \ 684 BOOST_CHECK_IMPL_MT_SAFE( (P), BOOST_TEST_STRINGIZE(P), WARN, CHECK_PRED ) 685 #define BOOST_CHECK_MT_SAFE( P ) \ 686 BOOST_CHECK_IMPL_MT_SAFE( (P), BOOST_TEST_STRINGIZE(P), CHECK, CHECK_PRED ) 687 #define BOOST_REQUIRE_MT_SAFE( P ) \ 688 BOOST_CHECK_IMPL_MT_SAFE( (P), BOOST_TEST_STRINGIZE(P), REQUIRE, \ 691 #define BOOST_WARN_MESSAGE_MT_SAFE( P, M ) \ 692 BOOST_CHECK_IMPL_MT_SAFE( (P), M, WARN, CHECK_MSG ) 693 #define BOOST_CHECK_MESSAGE_MT_SAFE( P, M ) \ 694 BOOST_CHECK_IMPL_MT_SAFE( (P), M, CHECK, CHECK_MSG ) 695 #define BOOST_REQUIRE_MESSAGE_MT_SAFE( P, M ) \ 696 BOOST_CHECK_IMPL_MT_SAFE( (P), M, REQUIRE, CHECK_MSG ) 698 #define BOOST_WARN_EQUAL_MT_SAFE( L, R ) \ 699 BOOST_CHECK_WITH_2_ARGS_IMPL_MT_SAFE( equal_impl_frwd, "", WARN, \
701 #define BOOST_CHECK_EQUAL_MT_SAFE( L, R ) \ 702 BOOST_CHECK_WITH_2_ARGS_IMPL_MT_SAFE( equal_impl_frwd, "", CHECK, \
704 #define BOOST_REQUIRE_EQUAL_MT_SAFE( L, R ) \ 705 BOOST_CHECK_WITH_2_ARGS_IMPL_MT_SAFE( equal_impl_frwd, "", REQUIRE, \
708 #define BOOST_WARN_NE_MT_SAFE( L, R ) \ 709 BOOST_CHECK_WITH_2_ARGS_IMPL_MT_SAFE( ne_impl, "", WARN, CHECK_NE, L, R )
710 #define BOOST_CHECK_NE_MT_SAFE( L, R ) \ 711 BOOST_CHECK_WITH_2_ARGS_IMPL_MT_SAFE( ne_impl, "", CHECK, CHECK_NE, L, R )
712 #define BOOST_REQUIRE_NE_MT_SAFE( L, R ) \ 713 BOOST_CHECK_WITH_2_ARGS_IMPL_MT_SAFE(ne_impl, "", REQUIRE, CHECK_NE, L, R )
715 #define BOOST_ERROR_MT_SAFE( M ) BOOST_CHECK_MESSAGE_MT_SAFE( false, M ) 716 #define BOOST_FAIL_MT_SAFE( M ) BOOST_REQUIRE_MESSAGE_MT_SAFE( false, M ) 718 #define BOOST_TEST_MESSAGE_MT_SAFE( M ) \ 720 NCBI_NS_NCBI::CFastMutexGuard _ncbitest_guard \ 721 (NCBI_NS_NCBI::g_NcbiTestMutex); \ 722 BOOST_TEST_MESSAGE( M ); \ 725 #define BOOST_WARN_CLOSE_MT_SAFE( L, R, T ) \ 726 BOOST_CLOSE_IMPL_MT_SAFE( L, R, T, WARN ) 727 #define BOOST_CHECK_CLOSE_MT_SAFE( L, R, T ) \ 728 BOOST_CLOSE_IMPL_MT_SAFE( L, R, T, CHECK ) 729 #define BOOST_REQUIRE_CLOSE_MT_SAFE( L, R, T ) \ 730 BOOST_CLOSE_IMPL_MT_SAFE( L, R, T, REQUIRE ) 732 #define BOOST_WARN_EQUAL_COLLECTIONS_MT_SAFE( LB, LE, RB, RE ) \ 733 BOOST_EQUAL_COLLECTIONS_IMPL_MT_SAFE( LB, LE, RB, RE, WARN ) 734 #define BOOST_CHECK_EQUAL_COLLECTIONS_MT_SAFE( LB, LE, RB, RE ) \ 735 BOOST_EQUAL_COLLECTIONS_IMPL_MT_SAFE( LB, LE, RB, RE, CHECK ) 736 #define BOOST_REQUIRE_EQUAL_COLLECTIONS_MT_SAFE( LB, LE, RB, RE ) \ 737 BOOST_EQUAL_COLLECTIONS_IMPL_MT_SAFE( LB, LE, RB, RE, REQUIRE ) 741 #ifdef __clang_analyzer__ 742 # undef BOOST_REQUIRE 743 # define BOOST_REQUIRE(P) _ALWAYS_ASSERT(P) 744 # undef BOOST_REQUIRE_MT_SAFE 745 # define BOOST_REQUIRE_MT_SAFE(P) BOOST_REQUIRE(P) 746 # undef BOOST_REQUIRE_MESSAGE 747 # define BOOST_REQUIRE_MESSAGE(P, M) _ALWAYS_ASSERT((FORMAT(M), (P))) 748 # undef BOOST_REQUIRE_MESSAGE_MT_SAFE 749 # define BOOST_REQUIRE_MESSAGE_MT_SAFE(P, M) BOOST_REQUIRE_MESSAGE(P, M) 750 # undef BOOST_REQUIRE_EQUAL 751 # define BOOST_REQUIRE_EQUAL(L, R) _ALWAYS_ASSERT((L) == (R)) 752 # undef BOOST_REQUIRE_EQUAL_MT_SAFE 753 # define BOOST_REQUIRE_EQUAL_MT_SAFE(L, R) BOOST_REQUIRE_EQUAL(L, R) 754 # undef BOOST_REQUIRE_NE 755 # define BOOST_REQUIRE_NE(L, R) _ALWAYS_ASSERT((L) != (R)) 756 # undef BOOST_REQUIRE_NE_MT_SAFE 757 # define BOOST_REQUIRE_NE_MT_SAFE(L, R) BOOST_REQUIRE_NE(L, R) 758 # undef BOOST_REQUIRE_NO_THROW 759 # define BOOST_REQUIRE_NO_THROW(S) try { S; } catch (...) { _ALWAYS_TROUBLE; } 760 # undef BOOST_REQUIRE_NO_THROW_MT_SAFE 761 # define BOOST_REQUIRE_NO_THROW_MT_SAFE(S) BOOST_REQUIRE_NO_THROW(S) 762 # undef BOOST_REQUIRE_THROW 763 # define BOOST_REQUIRE_THROW(S, E) \ 764 do { try { S; } catch (E const&) { break; } _ALWAYS_TROUBLE; } while(false) 765 # undef BOOST_REQUIRE_THROW_MT_SAFE 766 # define BOOST_REQUIRE_THROW_MT_SAFE(S, E) BOOST_REQUIRE_THROW(S, E) 767 # undef NCBITEST_REQUIRE 768 # define NCBITEST_REQUIRE(P) BOOST_REQUIRE_NO_THROW(_ALWAYS_ASSERT(P)) 769 # undef NCBITEST_REQUIRE_MT_SAFE 770 # define NCBITEST_REQUIRE_MT_SAFE(P) NCBITEST_REQUIRE(P) 771 # undef NCBITEST_REQUIRE_MESSAGE 772 # define NCBITEST_REQUIRE_MESSAGE(P, M) NCBITEST_REQUIRE((FORMAT(M), (P))) 773 # undef NCBITEST_REQUIRE_MESSAGE_MT_SAFE 774 # define NCBITEST_REQUIRE_MESSAGE_MT_SAFE(P, M) NCBITEST_REQUIRE_MESSAGE(P, M) 775 # undef NCBITEST_REQUIRE_EQUAL 776 # define NCBITEST_REQUIRE_EQUAL(L, R) NCBITEST_REQUIRE((L) == (R)) 777 # undef NCBITEST_REQUIRE_EQUAL_MT_SAFE 778 # define NCBITEST_REQUIRE_EQUAL_MT_SAFE(L, R) NCBITEST_REQUIRE_EQUAL(L, R) 779 # undef NCBITEST_REQUIRE_NE 780 # define NCBITEST_REQUIRE_NE(L, R) NCBITEST_REQUIRE((L) != (R)) 781 # undef NCBITEST_REQUIRE_NE_MT_SAFE 782 # define NCBITEST_REQUIRE_NE_MT_SAFE(L, R) NCBITEST_REQUIRE_NE(L, R) 817 #define NCBITEST_INIT_CMDLINE(var_name) \ 818 NCBITEST_AUTOREG_PARAMFUNC(eTestUserFuncCmdLine, \ 819 CArgDescriptions* var_name, \ 820 NcbiTestGetArgDescrs) 839 #define NCBITEST_AUTO_INIT() NCBITEST_AUTOREG_FUNCTION(eTestUserFuncInit) 857 #define NCBITEST_AUTO_FINI() NCBITEST_AUTOREG_FUNCTION(eTestUserFuncFini) 875 #define NCBITEST_INIT_VARIABLES(var_name) \ 876 NCBITEST_AUTOREG_PARAMFUNC(eTestUserFuncVars, \ 877 CExprParser* var_name, \ 878 NcbiTestGetIniParser) 898 #define NCBITEST_INIT_TREE() NCBITEST_AUTOREG_FUNCTION(eTestUserFuncDeps) 911 #define NCBITEST_DISABLE(test_name) \ 912 NcbiTestDisable(NcbiTestGetUnit(BOOST_STRINGIZE(test_name))) 930 #define NCBITEST_DEPENDS_ON(test_name, dep_name) \ 931 NcbiTestDependsOn(NcbiTestGetUnit(BOOST_STRINGIZE(test_name)), \ 932 NcbiTestGetUnit(BOOST_STRINGIZE(dep_name))) 957 #define NCBITEST_DEPENDS_ON_N(test_name, N, dep_names_array) \ 958 BOOST_PP_REPEAT(N, NCBITEST_DEPENDS_ON_N_IMPL, \ 959 (BOOST_PP_INC(N), (test_name, \ 960 BOOST_PP_TUPLE_REM(N) dep_names_array))) \ 970 #define NCBITEST_ADD_TEST_CASE(function) \ 971 boost::unit_test::framework::master_test_suite().add( \ 972 boost::unit_test::make_test_case( \ 973 boost::bind(function), \ 974 BOOST_TEST_STRINGIZE(function) \ 976 #define NCBITEST_ADD_TEST_CASE1(function, param1) \ 977 boost::unit_test::framework::master_test_suite().add( \ 978 boost::unit_test::make_test_case( \ 979 boost::bind(function, (param1)), \ 980 BOOST_TEST_STRINGIZE(function) \ 982 #define NCBITEST_ADD_TEST_CASE2(function, param1, param2) \ 983 boost::unit_test::framework::master_test_suite().add( \ 984 boost::unit_test::make_test_case( \ 985 boost::bind(function, (param1), (param2)), \ 986 BOOST_TEST_STRINGIZE(function) \ 988 #define NCBITEST_ADD_TEST_CASE3(function, param1, param2, param3) \ 989 boost::unit_test::framework::master_test_suite().add( \ 990 boost::unit_test::make_test_case( \ 991 boost::bind(function, (param1), (param2), (param3)), \ 992 BOOST_TEST_STRINGIZE(function) \ 1038 #ifdef SYSTEM_MUTEX_INITIALIZER 1045 #define NCBITEST_DEPENDS_ON_N_IMPL(z, n, names_array) \ 1046 NCBITEST_DEPENDS_ON(BOOST_PP_ARRAY_ELEM(0, names_array), \ 1047 BOOST_PP_ARRAY_ELEM(BOOST_PP_INC(n), names_array)); 1062boost::unit_test::test_unit* dep_tu);
1116 #define NCBITEST_AUTOREG_FUNC(type) \ 1117 BOOST_JOIN(BOOST_JOIN(Ncbi_, type), __LINE__) 1118 #define NCBITEST_AUTOREG_OBJ BOOST_JOIN(NcbiTestAutoObj, __LINE__) 1119 #define NCBITEST_AUTOREG_HELPER BOOST_JOIN(NcbiTestAutoHelper, __LINE__) 1121 #define NCBITEST_AUTOREG_FUNCTION(type) \ 1122 static void NCBITEST_AUTOREG_FUNC(type)(void); \ 1123 static ::NCBI_NS_NCBI::SNcbiTestUserFuncReg \ 1124 NCBITEST_AUTOREG_OBJ(&NCBITEST_AUTOREG_FUNC(type), ::NCBI_NS_NCBI::type); \ 1125 static void NCBITEST_AUTOREG_FUNC(type)(void) 1127 #define NCBITEST_AUTOREG_PARAMFUNC(type, param_decl, param_func) \ 1128 static void NCBITEST_AUTOREG_FUNC(type)(::NCBI_NS_NCBI::param_decl); \ 1129 static void NCBITEST_AUTOREG_HELPER(void) \ 1131 NCBITEST_AUTOREG_FUNC(type)(::NCBI_NS_NCBI::param_func()); \ 1133 static ::NCBI_NS_NCBI::SNcbiTestUserFuncReg \ 1134 NCBITEST_AUTOREG_OBJ(&NCBITEST_AUTOREG_HELPER, ::NCBI_NS_NCBI::type); \ 1135 static void NCBITEST_AUTOREG_FUNC(type)(::NCBI_NS_NCBI::param_decl) 1140:
publicboost::unit_test::ut_detail::auto_test_unit_registrar
1142 typedefboost::unit_test::ut_detail::auto_test_unit_registrar
TParent;
1145boost::unit_test::counter_t exp_fail,
1146 unsigned inttimeout)
1149tc->p_timeout.set(timeout);
1152 #ifdef BOOST_FIXTURE_TEST_CASE_WITH_DECOR 1154 unsigned inttimeout,
1155boost::unit_test::decorator::collector_t& decorator)
1158tc->p_timeout.set(timeout);
1163boost::unit_test::counter_t exp_fail)
1167 #ifndef BOOST_FIXTURE_TEST_CASE_WITH_DECOR 1188 template<
typenameT>
1219 template<
typenameParamType,
typenameParamIter>
1221:
publicboost::unit_test::test_unit_generator
1224 #if BOOST_VERSION >= 105900 1225 typedefboost::function<void (ParamType)>
TTestFunc;
1231boost::unit_test::const_string name,
1232ParamIter par_begin,
1235 m_Name(
boost::unit_test::ut_detail::normalize_test_case_name(name)),
1245 virtualboost::unit_test::test_unit*
next()
const 1250 stringthis_name(
m_Name);
1252 #if BOOST_VERSION >= 105900 1253boost::unit_test::test_unit* res
1254=
newboost::unit_test::test_case
1257boost::unit_test::ut_detail::test_func_with_bound_param<ParamType>
1259boost::unit_test::test_unit* res
1260=
newboost::unit_test::test_case(this_name, bound_test_func);
1279 template<
typenameParamType,
typenameParamIter>
1282boost::unit_test::const_string name,
1283ParamIter par_begin,
1287test_func, name, par_begin, par_end);
1290 template<
typenameParamType,
typenameParamIter>
1292 typenameboost::remove_const<
1296boost::unit_test::const_string name,
1297ParamIter par_begin,
1300 typedef typenameboost::remove_const<
1302>
::typeparam_value_type;
1304test_func, name, par_begin, par_end);
1320 void Add(
void* ptr);
Help catch Boost accidental version skew.
CNcbiTestMemoryCleanupList â Define a list of pointers to free at exit.
Special generator of test cases for function accepting one parameter.
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
static char test_name[128]
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define BEGIN_SCOPE(ns)
Define a new scope.
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
CAutoInitializeStaticFastMutex g_NcbiTestMutex
virtual boost::unit_test::test_unit * next() const
CNcbiApplication * NcbiTestGetAppInstance(void)
Return current application instance.
void(* TNcbiTestUserFunction)(void)
Type of user-defined function which will be automatically registered in test framework.
boost::unit_test::ut_detail::auto_test_unit_registrar TParent
void RegisterNcbiTestUserFunc(TNcbiTestUserFunction func, ETestUserFuncType func_type)
Registrar of all user-defined functions.
CNcbiTestParamTestCaseGenerator< ParamType, ParamIter > NcbiTestGenTestCases(typename CNcbiTestParamTestCaseGenerator< ParamType, ParamIter >::TTestFunc const &test_func, boost::unit_test::const_string name, ParamIter par_begin, ParamIter par_end)
Helper functions to be used in BOOST_PARAM_TEST_CASE macro to create special test case generator.
ETestUserFuncType
Types of functions that user can define.
void NcbiTestSetGlobalDisabled(void)
Disable execution of all tests in current configuration.
SNcbiTestRegistrar(boost::unit_test::test_case *tc, boost::unit_test::counter_t exp_fail, unsigned int timeout)
SNcbiTestUserFuncReg(TNcbiTestUserFunction func, ETestUserFuncType func_type)
void NcbiTestDependsOn(boost::unit_test::test_unit *tu, boost::unit_test::test_unit *dep_tu)
Mark test case/suite as dependent on another test case/suite.
SNcbiTestTCTimeout(unsigned int v)
CNcbiRegistry & NcbiTestGetRWConfig(void)
Wrapper to get the application's configuration parameters, accessible to read-write.
SNcbiTestRegistrar(boost::unit_test::test_case *tc, boost::unit_test::counter_t exp_fail)
~CNcbiTestMemoryCleanupList()
CNcbiTestParamTestCaseGenerator(TTestFunc const &test_func, boost::unit_test::const_string name, ParamIter par_begin, ParamIter par_end)
static SNcbiTestTCTimeout *& instance()
SNcbiTestRegistrar(boost::unit_test::test_unit_generator const &tc_gen)
std::list< void * > m_List
void NcbiTestDisable(boost::unit_test::test_unit *tu)
Disable test unit.
CExprParser * NcbiTestGetIniParser(void)
Get pointer to parser which will be used for evaluating conditions written in configuration file.
virtual ~CNcbiTestParamTestCaseGenerator()
SNcbiTestRegistrar(boost::unit_test::const_string ts_name)
SNcbiTestRegistrar(int n)
boost::unit_test::callback1< ParamType > TTestFunc
void NcbiTestSetGlobalSkipped(void)
Skip execution of all tests in current configuration.
boost::unit_test::test_unit * NcbiTestGetUnit(CTempString test_name)
Get pointer to test unit by its name which can be partial, i.e.
CArgDescriptions * NcbiTestGetArgDescrs(void)
Get ArgDescriptions object which will be passed to application for parsing command line arguments.
static CNcbiTestMemoryCleanupList * GetInstance()
unsigned int value() const
Multi-threading â mutexes; rw-locks; semaphore.
Defines CRequestContext class for NCBI C++ diagnostic API.
Extension auto-registrar from Boost.Test that can automatically set the timeout for unit.
Copy of auto_tc_exp_fail from Boost.Test to store the value of timeout for each test.
Class for implementing automatic registration of user functions.
bool BOOST_CURRENT_TEST_PASSED()
Check that current boost test case passed (no exceptions or assertions) on the moment of calling this...
#define NCBI_BOOST_DECORATOR_ARG
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4