We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Anonymous transitions in a nested state are not being executed unless on_entry event is declared in transition table.
on_entry
The following test, which is a slightly modified version of this line 112, fails if we remove on_entry action in the sub_sm
sub_sm
test subsequent_anonymous_transitions_composite = [] { using V = std::string; V calls{}; using namespace sml; struct sub_sub_sm { auto operator()() noexcept { // clang-format off return make_transition_table( *idle / [] (V& v) { v+="ss1|"; } = s1 ,s1 / [] (V& v) { v+="ss2|"; } = s2 ,s2 / [] (V& v) { v+="ss3|"; } = X ); // clang-format on } }; struct sub_sm { auto operator()() noexcept { // clang-format off return make_transition_table( *idle / [] (V& v) { v+="s1|"; } = s1 ,s1 / [] (V& v) { v+="s2|"; } = s2 ,s2 / [] (V& v) { v+="s3|"; } = state<sub_sub_sm> ,state<sub_sub_sm> / [] (V& v) { v+="s4|"; } = X // ,state<sub_sub_sm> + sml::on_entry<_>/[]{} // REMOVING THIS LINE CAUSES THE ANONYMOUS TRANSITIONS IN THE NESTED STATE MACHINE TO NOT EXECUTE ); // clang-format on } }; struct composite_sm { auto operator()() noexcept { // clang-format off return make_transition_table( *idle / [] (V& v) { v+="11|"; } = s1 ,s1 / [] (V& v) { v+="12|"; } = state<sub_sm> ,state<sub_sm> / [] (V& v) { v+="13|"; } = s2 ,s2 / [] (V& v) { v+="14|"; } = s3 ); // clang-format on } }; sml::sm<composite_sm> sm{calls}; expect(sm.is<decltype(state<sub_sm>)>(X)); expect(sm.is(s3)); std::string expected("11|12|s1|s2|s3|ss1|ss2|ss3|s4|13|14|"); expect(calls == expected); std::cout << "call order: " << calls << std::endl; };
result: call order: 11|12|
expected: call order: 11|12|s1|s2|s3|ss1|ss2|ss3|s4|13|14|
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Anonymous transitions in a nested state are not being executed unless
on_entry
event is declared in transition table.The following test, which is a slightly modified version of this line 112, fails if we remove
on_entry
action in thesub_sm
Test output:
result:
call order: 11|12|
expected:
call order: 11|12|s1|s2|s3|ss1|ss2|ss3|s4|13|14|
Specifications
The text was updated successfully, but these errors were encountered: