<?xml version="1.0" ?>
<diagram
	xmlns="msdl.uantwerpen.be/sccd"
	author="Glenn De Jonghe"
	name="TestEnterExitHierarchy">
  <description>
    Testing the enter and exit hierarchy.
  </description>
  <inport name="in" />
  <outport name="out" />
  <class name="Class1" default="true">
    <scxml initial="outside">

      <state id="outside">
        <transition port="in" event="to_composite" target="/composite"/>
        <transition port="in" event="to_inner3" target="/composite/state2/inner3"/>
        <transition port="in" event="to_inner4" target="/composite/state2/inner4"/>
      </state>

      <state id="composite" initial="state1">

        <state id="state1" initial="inner1">
          <onentry>
            <raise port="out" event="enter_state1" />
          </onentry>
          <onexit>
            <raise port="out" event="exit_state1" />
          </onexit>
          <state id="inner1">
            <onentry>
              <raise port="out" event="enter_inner1" />
            </onentry>
            <onexit>
              <raise port="out" event="exit_inner1" />
            </onexit>
            <transition port="in" event="to_inner2" target="../inner2"/>
          </state>
          <state id="inner2">
            <onentry>
              <raise port="out" event="enter_inner2" />
            </onentry>
            <onexit>
              <raise port="out" event="exit_inner2" />
            </onexit>
          </state>
        </state>

        <state id="state2" initial="inner3">
          <onentry>
            <raise port="out" event="enter_state2" />
          </onentry>
          <onexit>
            <raise port="out" event="exit_state2" />
          </onexit>
          <state id="inner3">
            <onentry>
              <raise port="out" event="enter_inner3" />
            </onentry>
            <onexit>
              <raise port="out" event="exit_inner3" />
            </onexit>
          </state>
          <state id="inner4">
            <onentry>
              <raise port="out" event="enter_inner4" />
            </onentry>
            <onexit>
              <raise port="out" event="exit_inner4" />
            </onexit>
          </state>
        </state>

        <transition port="in" event="to_outside" target="/outside"/>
      </state>

    </scxml>
  </class>
  <test>
    <input>
      <event name="to_composite" port="in" time="0"/>
      <event name="to_inner2" port="in" time="0"/>
      <event name="to_outside" port="in" time="0"/>
      <event name="to_inner3" port="in" time="0"/>
      <event name="to_outside" port="in" time="0"/>
      <event name="to_inner4" port="in" time="0"/>
    </input>
    
    <expected>
     <slot>
      <!-- big step with input 'to_composite' -->
      <event name="enter_state1" port="out"/>
      <event name="enter_inner1" port="out"/>
    </slot>
    <slot>
      <!-- big step with input 'to_inner2' -->
      <event name="exit_inner1" port="out"/>
      <event name="enter_inner2" port="out"/>
    </slot>
    <slot>
      <!-- big step with input 'to_outside' -->
      <event name="exit_inner2" port="out"/>
      <event name="exit_state1" port="out"/>
    </slot>
    <slot>
      <!-- big step with input 'to_inner3' -->
      <event name="enter_state2" port="out"/>
      <event name="enter_inner3" port="out"/>
    </slot>
    <slot>
      <!-- big step with input 'to_outside' -->
      <event name="exit_inner3" port="out"/>
      <event name="exit_state2" port="out"/>
    </slot>
    <slot>
      <!-- big step with input 'to_inner4' -->
      <event name="enter_state2" port="out"/>
      <event name="enter_inner4" port="out"/>
    </slot>
  </expected>
</test>
</diagram>
