Update of /cvsroot/boost/boost/libs/statechart/test
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26769/libs/statechart/test

Modified Files:
        HistoryTest.cpp Jamfile Jamfile.v2 
Removed Files:
        InvalidTransitionTest3.cpp InvalidTransitionTest3.vcproj 
        InvalidTransitionTest4.cpp InvalidTransitionTest4.vcproj 
Log Message:
Removed a compile-time check to enable "local" history as defined in UML2.0. 
Adapted test accordingly.

Index: HistoryTest.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/statechart/test/HistoryTest.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- HistoryTest.cpp     26 Feb 2006 16:40:25 -0000      1.7
+++ HistoryTest.cpp     5 Jun 2006 18:51:21 -0000       1.8
@@ -18,6 +18,8 @@
 
 #include <boost/test/test_tools.hpp>
 
+#include <stdexcept>
+
 
 namespace sc = boost::statechart;
 namespace mpl = boost::mpl;
@@ -29,6 +31,8 @@
 struct EvToD : sc::event< EvToD > {};
 struct EvToDShallow : sc::event< EvToDShallow > {};
 struct EvToDDeep : sc::event< EvToDDeep > {};
+struct EvToDShallowLocal : sc::event< EvToDShallowLocal > {};
+struct EvToDDeepLocal : sc::event< EvToDDeepLocal > {};
 
 struct EvToF : sc::event< EvToF > {};
 struct EvToFShallow : sc::event< EvToFShallow > {};
@@ -40,9 +44,16 @@
 struct EvToM : sc::event< EvToM > {};
 struct EvToQ : sc::event< EvToQ > {};
 
+struct EvWhatever : sc::event< EvWhatever > {};
 
 struct A;
-struct HistoryTest : sc::state_machine< HistoryTest, A > {};
+struct HistoryTest : sc::state_machine< HistoryTest, A >
+{
+  void unconsumed_event( const sc::event_base & )
+  {
+    throw std::runtime_error( "Event was not consumed!" );
+  }
+};
 
 struct B;
 struct D;
@@ -94,7 +105,13 @@
     struct E : sc::simple_state< E, C, F, sc::has_full_history > {};
 
       struct F : sc::simple_state< F, E > {};
-      struct G : sc::simple_state< G, E, H > {};
+      struct G : sc::simple_state< G, E, H >
+      {
+        typedef mpl::list<
+          sc::transition< EvToDShallowLocal, sc::shallow_history< D > >,
+          sc::transition< EvToDDeepLocal, sc::deep_history< D > >
+        > reactions;
+      };
 
         struct H : sc::simple_state< H, G > {};
         struct I : sc::simple_state< I, G > {};
@@ -283,6 +300,18 @@
   pM->process_event( EvToFDeep() );
   BOOST_REQUIRE_NO_THROW( pM->state_downcast< const F & >() );
 
+  // Test local history (new with UML 2.0)
+  pM->initiate();
+  // unconsumed_event sanity check
+  BOOST_REQUIRE_THROW( pM->process_event( EvWhatever() ), std::runtime_error );
+  pM->process_event( EvToI() );
+  BOOST_REQUIRE_NO_THROW( pM->state_downcast< const I & >() );
+  pM->process_event( EvToDShallowLocal() );
+  BOOST_REQUIRE_NO_THROW( pM->state_downcast< const F & >() );
+  pM->process_event( EvToI() );
+  pM->process_event( EvToDDeepLocal() );
+  BOOST_REQUIRE_NO_THROW( pM->state_downcast< const I & >() );
+
   // Given that history transitions and history initial states are implemented
   // with the same code we just make a few sanity checks and trust that the
   // rest will work just like we tested above.

Index: Jamfile
===================================================================
RCS file: /cvsroot/boost/boost/libs/statechart/test/Jamfile,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- Jamfile     20 May 2006 21:55:16 -0000      1.20
+++ Jamfile     5 Jun 2006 18:51:21 -0000       1.21
@@ -128,8 +128,6 @@
     [ statechart-st-run-variants TransitionTest ]
     [ statechart-compile-fail-variants InvalidTransitionTest1 ]
     [ statechart-compile-fail-variants InvalidTransitionTest2 ]
-    [ statechart-compile-fail-variants InvalidTransitionTest3 ]
-    [ statechart-compile-fail-variants InvalidTransitionTest4 ]
     [ statechart-st-run-variants InStateReactionTest ]
     [ statechart-st-run-variants TerminationTest ]
     [ statechart-st-run-variants DeferralTest ]

Index: Jamfile.v2
===================================================================
RCS file: /cvsroot/boost/boost/libs/statechart/test/Jamfile.v2,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Jamfile.v2  19 Feb 2006 19:41:48 -0000      1.5
+++ Jamfile.v2  5 Jun 2006 18:51:21 -0000       1.6
@@ -117,8 +117,6 @@
     [ statechart-st-run-variants TransitionTest ]
     [ statechart-compile-fail-variants InvalidTransitionTest1 ]
     [ statechart-compile-fail-variants InvalidTransitionTest2 ]
-    [ statechart-compile-fail-variants InvalidTransitionTest3 ]
-    [ statechart-compile-fail-variants InvalidTransitionTest4 ]
     [ statechart-st-run-variants InStateReactionTest ]
     [ statechart-st-run-variants TerminationTest ]
     [ statechart-st-run-variants DeferralTest ]

--- InvalidTransitionTest3.cpp DELETED ---

--- InvalidTransitionTest3.vcproj DELETED ---

--- InvalidTransitionTest4.cpp DELETED ---

--- InvalidTransitionTest4.vcproj DELETED ---



_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to