]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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 | ||
11fdf7f2 | 9 | #define BOOST_ENABLE_ASSERT_HANDLER |
7c673cae | 10 | |
11fdf7f2 | 11 | static int s_failed_assertions = 0; |
7c673cae | 12 | |
11fdf7f2 TL |
13 | namespace boost |
14 | { | |
7c673cae | 15 | |
11fdf7f2 TL |
16 | void assertion_failed( |
17 | char const *, char const *, char const *, long ) | |
18 | { | |
19 | ++s_failed_assertions; | |
20 | } | |
7c673cae | 21 | |
11fdf7f2 | 22 | } // namespace boost |
7c673cae | 23 | |
11fdf7f2 TL |
24 | |
25 | #include <boost/statechart/result.hpp> | |
26 | #include <boost/test/test_tools.hpp> | |
7c673cae FG |
27 | |
28 | ||
11fdf7f2 TL |
29 | namespace sc = boost::statechart; |
30 | ||
7c673cae FG |
31 | |
32 | void 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( sc::detail::do_discard_event ); | |
40 | } | |
41 | ||
7c673cae FG |
42 | int test_main( int, char* [] ) |
43 | { | |
11fdf7f2 TL |
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 | |
7c673cae FG |
51 | |
52 | return 0; | |
53 | } |