Skip to content

Commit

Permalink
fix: internal transition is not overwritten by parent internal transi…
Browse files Browse the repository at this point in the history
…tion (#160)
  • Loading branch information
erikzenker committed Apr 18, 2021
1 parent 8f24199 commit 1b74158
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/hsm/details/fill_dispatch_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ constexpr auto addDispatchTableEntryOfSubMachineExits(
(void)optionalDependency;

if constexpr (transition.internal()) {
static_assert(transition.internal());
return;
}

constexpr auto parentState = transition.source();
Expand Down
2 changes: 1 addition & 1 deletion include/hsm/details/flatten_internal_transition_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ constexpr auto isNotEmpty
= [](const auto& tuple) { return bh::not_(bh::equal(bh::size_c<0>, bh::size(tuple))); };

/**
* Returns a typle of internal transitions of a state if it exists.
* Returns a tuple of internal transitions of a state if it exists.
* Otherwise a empty tuple is returned. Source and target of the
* transition are set to parentstate as a placeholder and need to
* be filled with all child states of the particular state.
Expand Down
4 changes: 3 additions & 1 deletion test/integration/internal_transition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ const auto fail = [](auto /*event*/, auto /*source*/, auto /*target*/) { return
// Actions
const auto action = [](auto event, auto /*source*/, auto /*target*/) { event.called->set_value(); };

const auto error = [](auto /*event*/, auto /*source*/, auto /*target*/) { EXPECT_TRUE(false); };

using namespace ::testing;
using namespace boost::hana;

Expand Down Expand Up @@ -113,7 +115,7 @@ struct MainState {
+ (hsm::event<e2> / action),
+ (hsm::event<e5> [fail] / hsm::log),
+ (hsm::event<e4> [fail] / action),
+ (hsm::event<e8> / hsm::log),
+ (hsm::event<e8> / hsm::chain(hsm::log, error)),
+ (hsm::event<e9>)
);
// clang-format on
Expand Down

0 comments on commit 1b74158

Please sign in to comment.