<?xml version="1.0" ?>
<diagram author="Glenn De Jonghe" name="TestEnterExitHierarchy">
    <description>
        Testing the enter and exit hierarchy.
    </description>
    <inport name="test_input" />
    <outport name="test_output" />
    <class name="Class1" default="true">
        <scxml initial="outside">
            <state id="outside">
                <transition port="test_input" event="to_composite" target="/composite"/>
                <transition port="test_input" event="to_inner3" target="/composite/state2/inner3"/>
                <transition port="test_input" event="to_inner4" target="/composite/state2/inner4"/>
            </state>
            <state id="composite" initial="state1">
                
                <state id="state1" initial="inner1">
                    <onentry>
                        <raise port="test_output" event="enter_state1" />
                    </onentry>
                    <onexit>
                        <raise port="test_output" event="exit_state1" />
                    </onexit>
                    <state id="inner1">
                        <onentry>
                            <raise port="test_output" event="enter_inner1" />
                        </onentry>
                        <onexit>
                            <raise port="test_output" event="exit_inner1" />
                        </onexit>
                        <transition port="test_input" event="to_inner2" target="../inner2"/>
                    </state>
                    <state id="inner2">
                        <onentry>
                            <raise port="test_output" event="enter_inner2" />
                        </onentry>
                        <onexit>
                            <raise port="test_output" event="exit_inner2" />
                        </onexit>
                    </state>
                </state>
                

                <state id="state2" initial="inner3">
                    <onentry>
                        <raise port="test_output" event="enter_state2" />
                    </onentry>
                    <onexit>
                        <raise port="test_output" event="exit_state2" />
                    </onexit>
                    <state id="inner3">
                        <onentry>
                            <raise port="test_output" event="enter_inner3" />
                        </onentry>
                        <onexit>
                            <raise port="test_output" event="exit_inner3" />
                        </onexit>
                    </state>
                    <state id="inner4">
                        <onentry>
                            <raise port="test_output" event="enter_inner4" />
                        </onentry>
                        <onexit>
                            <raise port="test_output" event="exit_inner4" />
                        </onexit>
                    </state>
                </state>
                
                <transition port="test_input" event="to_outside" target="/outside"/>
            </state>
        </scxml>
    </class>
    <test>
        <input>
            <event name="to_composite" port="test_input" time="0.0"/>
            <event name="to_inner2" port="test_input" time="0.0"/>
            <event name="to_outside" port="test_input" time="0.0"/>
            <event name="to_inner3" port="test_input" time="0.0"/>
            <event name="to_outside" port="test_input" time="0.0"/>
            <event name="to_inner4" port="test_input" time="0.0"/>
        </input>
       <expected>
           <slot>
               <event name="enter_state1" port="test_output"/>
           </slot>
           <slot>
               <event name="enter_inner1" port="test_output"/>
           </slot>
           <slot>
               <event name="exit_inner1" port="test_output"/>
           </slot>
           <slot>
               <event name="enter_inner2" port="test_output"/>
           </slot>
           <slot>
               <event name="exit_inner2" port="test_output"/>
           </slot>
           <slot>
               <event name="exit_state1" port="test_output"/>
           </slot>
           <slot>
               <event name="enter_state2" port="test_output"/>
           </slot>
           <slot>
               <event name="enter_inner3" port="test_output"/>
           </slot>
           <slot>
               <event name="exit_inner3" port="test_output"/>
           </slot>
           <slot>
               <event name="exit_state2" port="test_output"/>
           </slot>
           <slot>
               <event name="enter_state2" port="test_output"/>
           </slot>
           <slot>
               <event name="enter_inner4" port="test_output"/>
           </slot>
        </expected>
    </test>
</diagram>
