diff options
author | Henrik Rentz-Reichert | 2013-03-27 18:02:58 +0000 |
---|---|---|
committer | Henrik Rentz-Reichert | 2013-03-27 18:02:58 +0000 |
commit | ea13a32dabd2a75854e5f8d12debaa6143d8a789 (patch) | |
tree | 870e427fd441dba1889c98d04e39460c662ced00 | |
parent | 540dd9b89fb9aaa454d9a5db8723e95da85fd931 (diff) | |
download | org.eclipse.etrice-ea13a32dabd2a75854e5f8d12debaa6143d8a789.tar.gz org.eclipse.etrice-ea13a32dabd2a75854e5f8d12debaa6143d8a789.tar.xz org.eclipse.etrice-ea13a32dabd2a75854e5f8d12debaa6143d8a789.zip |
[generator.common.tests] added simple test for data driven system
-rw-r--r-- | tests/org.eclipse.etrice.generator.common.tests/models/DataDrivenTest.room | 115 |
1 files changed, 115 insertions, 0 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 new file mode 100644 index 000000000..200bb1193 --- /dev/null +++ b/tests/org.eclipse.etrice.generator.common.tests/models/DataDrivenTest.room @@ -0,0 +1,115 @@ +RoomModel DataDrivenTest {
+
+ import room.basic.types.* from "Types.room"
+ import room.basic.service.timing.* from "TimingService.room"
+
+ LogicalSystem LS {
+ SubSystemRef subsys: SubSystem
+ }
+
+ SubSystemClass SubSystem {
+ ActorRef appl: Appl
+ ActorRef timing: ATimingService
+ LayerConnection ref appl satisfied_by timing.timer
+ LogicalThread 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
+ }
+}
|