1//////////////////////////////////////////////////////////////////////////////
2// Copyright 2005-2006 Andreas Huber Doenni
3// Distributed under the Boost Software License, Version 1.0. (See accompany-
4// ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5//////////////////////////////////////////////////////////////////////////////
6
7
8
9#define BOOST_ENABLE_ASSERT_HANDLER
10
11static int s_failed_assertions = 0;
12
13namespace boost
14{
15
16void assertion_failed(
17 char const *, char const *, char const *, long )
18{
19 ++s_failed_assertions;
20}
21
22} // namespace boost
23
24
25#include <boost/statechart/result.hpp>
26#include <boost/test/test_tools.hpp>
27
28
29namespace sc = boost::statechart;
30
31
32void make_unconsumed_result()
33{
34 // We cannot test sc::result in its natural environment here because a
35 // failing assert triggers a stack unwind, what will lead to another
36 // failing assert...
37
38 // Creates a temp sc::result value which is destroyed immediately
39 sc::detail::result_utility::make_result( value: sc::detail::do_discard_event );
40}
41
42int test_main( int, char* [] )
43{
44 make_unconsumed_result();
45
46#ifdef NDEBUG
47 BOOST_TEST( s_failed_assertions == 0 );
48#else
49 BOOST_TEST( s_failed_assertions == 1 );
50#endif
51
52 return 0;
53}
54

source code of boost/libs/statechart/test/UnconsumedResultTest.cpp