Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/statechart/test/UnconsumedResultTest.cpp @ 30

Last change on this file since 30 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

File size: 1.2 KB
RevLine 
[29]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#include <libs/statechart/test/ThrowingBoostAssert.hpp>
10#include <boost/statechart/result.hpp>
11
12#include <boost/test/test_tools.hpp>
13
14#include <stdexcept> // std::logic_error
15
16
17
18namespace sc = boost::statechart;
19
20
21
22void make_unconsumed_result()
23{
24  // We cannot test sc::result in its natural environment here because a
25  // failing assert triggers a stack unwind, what will lead to another
26  // failing assert...
27
28  // Creates a temp sc::result value which is destroyed immediately
29  sc::detail::result_utility::make_result( sc::detail::do_discard_event );
30}
31
32// TODO: The current test setup lets an exception propagate out of a
33// destructor. Find a better way to test this.
34int test_main( int, char* [] )
35{
36  #ifdef NDEBUG
37    BOOST_REQUIRE_NO_THROW( make_unconsumed_result() );
38  #else
39    BOOST_REQUIRE_THROW( make_unconsumed_result(), std::logic_error );
40  #endif
41
42  return 0;
43}
Note: See TracBrowser for help on using the repository browser.