diff options
-rw-r--r-- | tests/org.eclipse.etrice.generator.c.tests/model/ChoicePointTest.room | 216 |
1 files changed, 216 insertions, 0 deletions
diff --git a/tests/org.eclipse.etrice.generator.c.tests/model/ChoicePointTest.room b/tests/org.eclipse.etrice.generator.c.tests/model/ChoicePointTest.room new file mode 100644 index 000000000..157d8eca2 --- /dev/null +++ b/tests/org.eclipse.etrice.generator.c.tests/model/ChoicePointTest.room @@ -0,0 +1,216 @@ +RoomModel ChoicePointTest { + + import room.basic.types.c.* from "CTypes.room" + + LogicalSystem System_HandlerTest { + SubSystemRef SubSystem_CPTest: SubSystem_CPTest + } + + SubSystemClass SubSystem_CPTest { + ActorRef HandlerTest_Top: CPTest_Top + } + + ActorClass CPTest_Top { + Structure { + ActorRef cp_tester: CPTester + ActorRef cp_user: CPUser + Binding cp_tester.TestPort1 and cp_user.TestPort1 + } + Behavior { } + } + + ActorClass CPUser { + Interface { + Port TestPort1: TestProtocol + } + Structure { + usercode3{ + "#include \"etUnit/etUnit.h\"" } + + external Port TestPort1 + Attribute counter: int32 + } + Behavior { + StateMachine { + Transition init: initial -> cp cp0 { + action { + "counter = 0;" + "etUnit_openAll(\"tmp/testlog\",\"ChoicePointTest\", \"ChoicePointTest\", \"ChoicePointTest\");" + "static etInt16 resultlist[] = {1,2,3,4,5,6,3,4,5,7,8,10,11,12,9,16,3,4,5,17,8,13,15,11,19,12,9,18,20};" + "EXPECT_ORDER_START(resultlist, 29);" + "EXPECT_ORDER(\"<|MODEL_LOCATION|>\\\\n\", 1);" + } + } + Transition tr4: cp cp0 -> ENTRY3_EXIT4 { + action { + "EXPECT_ORDER(\"<|MODEL_LOCATION|>\\\\n\", 0);" + } + } + Transition EXPECT2: cp cp0 -> ENTRY3_EXIT4 { + cond { + "counter == 0" + } + action { + "EXPECT_ORDER(\"<|MODEL_LOCATION|>\\\\n\", 2);" + } + } + Transition EXPECT5: ENTRY3_EXIT4 -> cp cp1 { + triggers { + <msg1: TestPort1> + } + action { + "EXPECT_ORDER(\"<|MODEL_LOCATION|>\\\\n\", 5);" + } + } + Transition EXPECT6: cp cp1 -> ENTRY3_EXIT4 { + action { + "counter=3;" + "EXPECT_ORDER(\"<|MODEL_LOCATION|>\\\\n\", 6);" + } + } + Transition EXPECT17: cp cp1 -> tp0 of ENTRY8_EXIT9 { + cond { + "counter == 4" + } + action { + "EXPECT_ORDER(\"<|MODEL_LOCATION|>\\\\n\", 17);" + } + } + Transition EXPECT7: cp cp1 -> ENTRY8_EXIT9 { + cond { + "counter == 3" + } + action { + "counter = 1;" + "EXPECT_ORDER(\"<|MODEL_LOCATION|>\\\\n\", 7);" + } + } + Transition EXPECT16: ENTRY8_EXIT9 -> ENTRY3_EXIT4 { + triggers { + <msg1: TestPort1 guard { + "counter==1" + }> + } + action { + "counter=4;" + "EXPECT_ORDER(\"<|MODEL_LOCATION|>\\\\n\", 16);" + } + } + Transition EXPEXT19: my tp0 -> my tp0 { + triggers { + <msg1: TestPort1> + } + action { + "counter = 2;" + "EXPECT_ORDER(\"<|MODEL_LOCATION|>\\\\n\", 19);" + } + } + Transition EXPECT18: ENTRY8_EXIT9 -> testOk { + triggers { + <msg1: TestPort1 guard { + "counter==2" + }> + } + action { + "EXPECT_ORDER(\"<|MODEL_LOCATION|>\\\\n\", 18);" + } + } + ChoicePoint cp0 + ChoicePoint cp1 + handler TransitionPoint tp0 + State ENTRY3_EXIT4 { + entry { + "EXPECT_ORDER(\"<|MODEL_LOCATION|>\\\\n\", 3);" + } + exit { + "EXPECT_ORDER(\"<|MODEL_LOCATION|>\\\\n\", 4);" + } + } + State ENTRY8_EXIT9 { + entry { + "EXPECT_ORDER(\"<|MODEL_LOCATION|>\\\\n\", 8);" + } + exit { + "EXPECT_ORDER(\"<|MODEL_LOCATION|>\\\\n\", 9);" + } + subgraph { + Transition EXPECT13: my tp0 -> cp cp0 { + action { + "EXPECT_ORDER(\"<|MODEL_LOCATION|>\\\\n\", 13);" + } + } + Transition EXPECT14: cp cp0 -> ENTRY11_EXIT12 { + action { + "EXPECT_ORDER(\"<|MODEL_LOCATION|>\\\\n\", 14);" + } + } + Transition EXPECT15: cp cp0 -> ENTRY11_EXIT12 { + cond { + "counter == 4" + } + action { + "EXPECT_ORDER(\"<|MODEL_LOCATION|>\\\\n\", 15);" + } + } + Transition init: initial -> ENTRY11_EXIT12 { + action { + "EXPECT_ORDER(\"<|MODEL_LOCATION|>\\\\n\", 10);" + } + } + ChoicePoint cp0 + EntryPoint tp0 + State ENTRY11_EXIT12 { + entry { + "EXPECT_ORDER(\"<|MODEL_LOCATION|>\\\\n\", 11);" + } + exit { + "EXPECT_ORDER(\"<|MODEL_LOCATION|>\\\\n\", 12);" + } + } + } + } + State testOk { + entry { + "EXPECT_ORDER_END(\"<|MODEL_LOCATION|>\\\\n\", 20);" + "etUnit_closeAll();" + } + } + } + } + } + + ActorClass CPTester { + Interface { + conjugated Port TestPort1: TestProtocol + } + Structure { + external Port TestPort1 + } + Behavior { + StateMachine { + Transition init: initial -> state0 { + action { + "TestPort1.msg1();" + "TestPort1.msg1();" + "TestPort1.msg1();" + "TestPort1.msg1();" + "TestPort1.msg1();" + "TestPort1.msg1();" + } + } + State state0 + } + } + } + + ProtocolClass TestProtocol { + incoming { + Message msg1() + Message msg2() + Message msg3() + Message msg4() + Message msg5() + } + } + +}
\ No newline at end of file |