mirror of
https://github.com/boostorg/assert.git
synced 2026-08-27 15:46:34 +02:00
Update assert_test3.cpp
This commit is contained in:
@@ -7,6 +7,9 @@
|
||||
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
int handler_invoked = 0;
|
||||
int msg_handler_invoked = 0;
|
||||
|
||||
#define BOOST_DISABLE_ASSERTS
|
||||
|
||||
// BOOST_ENABLE_ASSERT_HANDLER
|
||||
@@ -17,10 +20,16 @@
|
||||
void test_disabled_handler()
|
||||
{
|
||||
BOOST_ASSERT( 1 );
|
||||
BOOST_TEST_EQ( handler_invoked, 0 );
|
||||
|
||||
BOOST_ASSERT_MSG( 1, "1" );
|
||||
BOOST_TEST_EQ( msg_handler_invoked, 0 );
|
||||
|
||||
BOOST_ASSERT( 0 );
|
||||
BOOST_TEST_EQ( handler_invoked, 0 );
|
||||
|
||||
BOOST_ASSERT_MSG( 0, "0" );
|
||||
BOOST_TEST_EQ( msg_handler_invoked, 0 );
|
||||
}
|
||||
|
||||
#undef BOOST_ENABLE_ASSERT_HANDLER
|
||||
@@ -33,10 +42,16 @@ void test_disabled_handler()
|
||||
void test_disabled_debug_handler()
|
||||
{
|
||||
BOOST_ASSERT( 1 );
|
||||
BOOST_TEST_EQ( handler_invoked, 0 );
|
||||
|
||||
BOOST_ASSERT_MSG( 1, "1" );
|
||||
BOOST_TEST_EQ( msg_handler_invoked, 0 );
|
||||
|
||||
BOOST_ASSERT( 0 );
|
||||
BOOST_TEST_EQ( handler_invoked, 0 );
|
||||
|
||||
BOOST_ASSERT_MSG( 0, "0" );
|
||||
BOOST_TEST_EQ( msg_handler_invoked, 0 );
|
||||
}
|
||||
|
||||
// BOOST_ENABLE_ASSERT_DEBUG_HANDLER, BOOST_ENABLE_ASSERT_HANDLER
|
||||
@@ -47,10 +62,16 @@ void test_disabled_debug_handler()
|
||||
void test_disabled_both()
|
||||
{
|
||||
BOOST_ASSERT( 1 );
|
||||
BOOST_TEST_EQ( handler_invoked, 0 );
|
||||
|
||||
BOOST_ASSERT_MSG( 1, "1" );
|
||||
BOOST_TEST_EQ( msg_handler_invoked, 0 );
|
||||
|
||||
BOOST_ASSERT( 0 );
|
||||
BOOST_TEST_EQ( handler_invoked, 0 );
|
||||
|
||||
BOOST_ASSERT_MSG( 0, "0" );
|
||||
BOOST_TEST_EQ( msg_handler_invoked, 0 );
|
||||
}
|
||||
|
||||
int main()
|
||||
@@ -61,3 +82,13 @@ int main()
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
void boost::assertion_failed( char const*, char const*, char const*, long )
|
||||
{
|
||||
++handler_invoked;
|
||||
}
|
||||
|
||||
void boost::assertion_failed_msg( char const*, char const*, char const*, char const*, long )
|
||||
{
|
||||
++msg_handler_invoked;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user