Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/statechart/test/InvalidResultAssignTest.cpp @ 47

Last change on this file since 47 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 1.2 KB
Line 
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 <boost/statechart/state_machine.hpp>
10#include <boost/statechart/event.hpp>
11#include <boost/statechart/simple_state.hpp>
12#include <boost/statechart/custom_reaction.hpp>
13#include <boost/statechart/result.hpp>
14
15#include <boost/static_assert.hpp>
16
17
18
19namespace sc = boost::statechart;
20
21
22
23struct E : sc::event< E > {};
24
25struct A;
26struct InvalidResultAssignTest :
27  sc::state_machine< InvalidResultAssignTest, A > {};
28
29struct A : sc::simple_state< A, InvalidResultAssignTest >
30{
31  typedef sc::custom_reaction< E > reactions;
32
33  sc::result react( const E & )
34  {
35    sc::result r( discard_event() );
36    // sc::result must not be assignmable
37    r = discard_event();
38    return r;
39  }
40};
41
42
43
44int main()
45{
46  InvalidResultAssignTest machine;
47  machine.initiate();
48
49  #ifdef NDEBUG
50    // Test only fails in DEBUG mode. Forcing failure...
51    BOOST_STATIC_ASSERT( false );
52  #endif
53
54  return 0;
55}
Note: See TracBrowser for help on using the repository browser.