diff options
Diffstat (limited to 'tests/org.eclipse.etrice.generator.common.tests/models/DataDrivenTest.room')
-rw-r--r-- | tests/org.eclipse.etrice.generator.common.tests/models/DataDrivenTest.room | 230 |
1 files changed, 115 insertions, 115 deletions
diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/DataDrivenTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/DataDrivenTest.room index 54640f3f2..1793eec49 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/DataDrivenTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/DataDrivenTest.room @@ -1,115 +1,115 @@ -RoomModel DataDrivenTest {
-
- import room.basic.types.* from "Types.room"
- import room.basic.service.timing.* from "TimingService.room"
-
- SubSystemClass SubSystem_DataDriven {
- ActorRef appl: Appl
- ActorRef timing: ATimingService
- LayerConnection ref appl satisfied_by timing.timer
-
- // all unmapped instances are mapped to the default *physical* thread
- LogicalThread dflt_thread
- ActorInstanceMapping appl -> dflt_thread
- ActorInstanceMapping timing -> dflt_thread
- }
-
- ActorClass Appl {
- Structure {
- ActorRef srv: Tester
- ActorRef cli: Testee
- Binding srv.p0 and cli.p0
- }
- Behavior { }
- }
- async ActorClass Tester {
- Interface {
- conjugated Port p0: PC
- }
- Structure {
- external Port p0
- SAP timer: PTimer
-
- Attribute counter: int32
- }
- Behavior {
- StateMachine {
- Transition init: initial -> Idle {
- action {
- "timer.startTimer(100);"
- "counter = 0;"
- }
- }
- Transition tr0: Idle -> Idle {
- triggers {
- <timeout: timer>
- }
- }
- State Idle {
- entry {
- "p0.in1(counter++);"
- }
- }
- }
- }
- }
- async ActorClass Testee {
- Interface {
- Port p0: PC
- }
- Structure {
- external Port p0
- SAP timer: PTimer
-
- Attribute caseId: int32
- Attribute counter: int32
- Attribute resultlist[10]: int16 = "{1,2,3,4,5,6,7,8,9,10}"
- }
- Behavior {
- Operation Testee() {
- "caseId = etUnit_openAll(\"tmp\", \"DataDrivenTest\", \"org.eclipse.etrice.generator.common.tests.DataDrivenTest\", \"DataDrivenTest_case\");"
- }
- Operation ~Testee() {
- "etUnit_closeAll(caseId);"
- }
- StateMachine {
- Transition init: initial -> Idle {
- action {
- "timer.startTimer(20);"
- "counter = 0;"
- }
- }
- Transition tr0: Idle -> Idle {
- guard {
- "p0.in1==counter"
- }
- action {
- "if (p0.in1==1)"
- " EXPECT_ORDER_START(caseId, resultlist, 10);"
- "if (p0.in1<10)"
- " EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", p0.in1);"
- "else if (counter==10) {"
- " EXPECT_ORDER_END(caseId,\"<|MODEL_LOCATION|>\", 10);"
- " etUnit_testFinished(caseId);"
- "}"
- "++counter;"
- }
- }
- State Idle
- }
- }
- }
-
- datadriven ProtocolClass PC {
- incoming {
- Message in1(data: int32)
- Message in2(data: int8)
- Message in3(data: DC)
- }
- }
-
- DataClass DC {
- Attribute x: float32
- Attribute i: int32
- }
-}
+RoomModel DataDrivenTest { + + import room.basic.types.* from "Types.room" + import room.basic.service.timing.* from "TimingService.room" + + SubSystemClass SubSystem_DataDriven { + ActorRef appl: Appl + ActorRef timing: ATimingService + LayerConnection ref appl satisfied_by timing.timer + + // all unmapped instances are mapped to the default *physical* thread + LogicalThread dflt_thread + ActorInstanceMapping appl -> dflt_thread + ActorInstanceMapping timing -> dflt_thread + } + + ActorClass Appl { + Structure { + ActorRef srv: Tester + ActorRef cli: Testee + Binding srv.p0 and cli.p0 + } + Behavior { } + } + async ActorClass Tester { + Interface { + conjugated Port p0: PC + } + Structure { + external Port p0 + SAP timer: PTimer + + Attribute counter: int32 + } + Behavior { + StateMachine { + Transition init: initial -> Idle { + action { + "timer.startTimer(100);" + "counter = 0;" + } + } + Transition tr0: Idle -> Idle { + triggers { + <timeout: timer> + } + } + State Idle { + entry { + "p0.in1(counter++);" + } + } + } + } + } + async ActorClass Testee { + Interface { + Port p0: PC + } + Structure { + external Port p0 + SAP timer: PTimer + + Attribute caseId: int32 + Attribute counter: int32 + Attribute resultlist[10]: int16 = "{1,2,3,4,5,6,7,8,9,10}" + } + Behavior { + Operation Testee() { + "caseId = etUnit_openAll(\"tmp\", \"DataDrivenTest\", \"org.eclipse.etrice.generator.common.tests.DataDrivenTest\", \"DataDrivenTest_case\");" + } + Operation ~Testee() { + "etUnit_closeAll(caseId);" + } + StateMachine { + Transition init: initial -> Idle { + action { + "timer.startTimer(20);" + "counter = 0;" + } + } + Transition tr0: Idle -> Idle { + guard { + "p0.in1==counter" + } + action { + "if (p0.in1==1)" + " EXPECT_ORDER_START(caseId, resultlist, 10);" + "if (p0.in1<10)" + " EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", p0.in1);" + "else if (counter==10) {" + " EXPECT_ORDER_END(caseId,\"<|MODEL_LOCATION|>\", 10);" + " etUnit_testFinished(caseId);" + "}" + "++counter;" + } + } + State Idle + } + } + } + + datadriven ProtocolClass PC { + incoming { + Message in1(data: int32) + Message in2(data: int8) + Message in3(data: DC) + } + } + + DataClass DC { + Attribute x: float32 + Attribute i: int32 + } +} |