Commit 20cfa02c authored by Eyrak Paen-Rochlitz's avatar Eyrak Paen-Rochlitz
Browse files

Merge branch 'fix/unreachable-warnings-for-group-transitions' into 'master'

Resolve "Unreachable state/point of graph warnings for group transitions"

Closes #33

See merge request !4
parents 09194800 1c85535f
Pipeline #3430 passed with stage
in 0 seconds
......@@ -23,6 +23,7 @@ import org.eclipse.etrice.core.fsm.fSM.EntryPoint;
import org.eclipse.etrice.core.fsm.fSM.GuardedTransition;
import org.eclipse.etrice.core.fsm.fSM.InitialTransition;
import org.eclipse.etrice.core.fsm.fSM.State;
import org.eclipse.etrice.core.fsm.fSM.TransitionPoint;
import org.eclipse.etrice.core.genmodel.fsm.FsmGenExtensions;
import org.eclipse.etrice.core.genmodel.fsm.fsmgen.CommonTrigger;
import org.eclipse.etrice.core.genmodel.fsm.fsmgen.Graph;
......@@ -104,10 +105,15 @@ public class ReachabilityCheck {
}
private void visit(Link link){
Node source = link.getSource();
if (source.getStateGraphNode() instanceof TransitionPoint) {
visited.add(source);
}
visited.add(link);
Node target = link.getTarget();
if (!visited.contains(target))
if (!visited.contains(target)) {
queue.add(target);
}
}
}
RoomModel Reachability {
/**
* StateGraphItems that are suffixed with "_1" are expected to be reachable.
* StateGraphItems suffixed with "_0" are expected to be UNreachable.
*/
LogicalSystem System_Reachability {
SubSystemRef subSystem: SubSystem
}
......@@ -7,6 +10,7 @@ RoomModel Reachability {
SubSystemClass SubSystem {
ActorRef testee1: Testee_Super_ac
ActorRef testee2: Testee_ac
ActorRef testee3: Testee_TransitionPoints_ac
LogicalThread dflt_thread
}
ActorClass Testee_Super_ac {
......@@ -280,6 +284,84 @@ RoomModel Reachability {
}
}
}
ActorClass Testee_TransitionPoints_Basic_ac {
Structure {
Port p: ReachabilityProtocol
}
Behavior {
StateMachine {
State default_1
State container_1 {
subgraph {
State reachable_1
State nested_1
TransitionPoint tp2_1
TransitionPoint tpUnreachable_0
Transition init: initial -> nested_1
Transition toReachable_1: my tp2_1 -> reachable_1 {
triggers { <in2: p> }
}
}
}
State reachable_1
TransitionPoint tp1_1
TransitionPoint tpUnreachable_0
Transition init: initial -> default_1
Transition toReachable_1: my tp1_1 -> reachable_1 {
triggers { <in1: p> }
}
Transition toContainer_1: default_1 -> container_1 {
triggers { <in3: p>
}
}
}
}
ActorClass Testee_TransitionPoints_ToCompositeStateWithHistory_ac {
Structure {
Port p: ReachabilityProtocol
}
Behavior {
StateMachine {
State default_1
State container_1 {
subgraph {
State nested_1
Transition init: initial -> nested_1
}
}
TransitionPoint tp1_1
Transition init: initial -> default_1
Transition toReachable_1: my tp1_1 -> container_1 {
triggers { <in1: p> }
}
}
}
}
ActorClass Testee_TransitionPoints_Chained_ac {
Structure {
Port p: ReachabilityProtocol
}
Behavior {
StateMachine {
State default_1
State container_1 {
subgraph {
State nested_1
EntryPoint ep1_1
Transition toNestedChained_1: my ep1_1 -> nested_1
}
}
TransitionPoint tp1_1
Transition init: initial -> default_1
Transition toContainerTriggered_1: my tp1_1 -> ep1_1 of container_1 {
triggers { <in1: p> }
}
}
}
}
ProtocolClass ReachabilityProtocol {
incoming {
......
......@@ -71,11 +71,11 @@ public class TestReachability extends TestBase {
continue;
State container = (State) item.eContainer().eContainer();
Assert.assertTrue(
item + " is NOT marked Unreachable (or name doesn't end with '_1' ?)",
item + " is NOT marked Unreachable (or name doesn't end with '_1' ?) :: " + item.eResource().getURIFragment(item),
container.getName().endsWith("_1"));
} else
Assert.assertTrue(
item + " is NOT marked Unreachable (or name doesn't end with '_1' ?)",
item + " is NOT marked Unreachable (or name doesn't end with '_1' ?) :: " + item.eResource().getURIFragment(item),
item.getName().endsWith("_1"));
}
}
......@@ -86,7 +86,7 @@ public class TestReachability extends TestBase {
name = ((RefinedTransition) item).getTarget().getName();
}
Assert.assertTrue(
name + " is incorrectly marked UNreachable (or name doesn't end with '_0' ?)",
name + " is incorrectly marked UNreachable (or name doesn't end with '_0' ?) :: " + item.eResource().getURIFragment(item),
name.endsWith("_0"));
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment