Skip to content

Commit d82647a

Browse files
committed
Update assert_test3.cpp
1 parent 2bd4dd4 commit d82647a

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

test/assert_test3.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
#include <boost/core/lightweight_test.hpp>
99

10+
int handler_invoked = 0;
11+
int msg_handler_invoked = 0;
12+
1013
#define BOOST_DISABLE_ASSERTS
1114

1215
// BOOST_ENABLE_ASSERT_HANDLER
@@ -17,10 +20,16 @@
1720
void test_disabled_handler()
1821
{
1922
BOOST_ASSERT( 1 );
23+
BOOST_TEST_EQ( handler_invoked, 0 );
24+
2025
BOOST_ASSERT_MSG( 1, "1" );
26+
BOOST_TEST_EQ( msg_handler_invoked, 0 );
2127

2228
BOOST_ASSERT( 0 );
29+
BOOST_TEST_EQ( handler_invoked, 0 );
30+
2331
BOOST_ASSERT_MSG( 0, "0" );
32+
BOOST_TEST_EQ( msg_handler_invoked, 0 );
2433
}
2534

2635
#undef BOOST_ENABLE_ASSERT_HANDLER
@@ -33,10 +42,16 @@ void test_disabled_handler()
3342
void test_disabled_debug_handler()
3443
{
3544
BOOST_ASSERT( 1 );
45+
BOOST_TEST_EQ( handler_invoked, 0 );
46+
3647
BOOST_ASSERT_MSG( 1, "1" );
48+
BOOST_TEST_EQ( msg_handler_invoked, 0 );
3749

3850
BOOST_ASSERT( 0 );
51+
BOOST_TEST_EQ( handler_invoked, 0 );
52+
3953
BOOST_ASSERT_MSG( 0, "0" );
54+
BOOST_TEST_EQ( msg_handler_invoked, 0 );
4055
}
4156

4257
// BOOST_ENABLE_ASSERT_DEBUG_HANDLER, BOOST_ENABLE_ASSERT_HANDLER
@@ -47,10 +62,16 @@ void test_disabled_debug_handler()
4762
void test_disabled_both()
4863
{
4964
BOOST_ASSERT( 1 );
65+
BOOST_TEST_EQ( handler_invoked, 0 );
66+
5067
BOOST_ASSERT_MSG( 1, "1" );
68+
BOOST_TEST_EQ( msg_handler_invoked, 0 );
5169

5270
BOOST_ASSERT( 0 );
71+
BOOST_TEST_EQ( handler_invoked, 0 );
72+
5373
BOOST_ASSERT_MSG( 0, "0" );
74+
BOOST_TEST_EQ( msg_handler_invoked, 0 );
5475
}
5576

5677
int main()
@@ -61,3 +82,13 @@ int main()
6182

6283
return boost::report_errors();
6384
}
85+
86+
void boost::assertion_failed( char const*, char const*, char const*, long )
87+
{
88+
++handler_invoked;
89+
}
90+
91+
void boost::assertion_failed_msg( char const*, char const*, char const*, char const*, long )
92+
{
93+
++msg_handler_invoked;
94+
}

0 commit comments

Comments
 (0)