Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/org.eclipse.etrice.generator.common.tests/drafts')
-rw-r--r--tests/org.eclipse.etrice.generator.common.tests/drafts/OperationInheritance.room126
-rw-r--r--tests/org.eclipse.etrice.generator.common.tests/drafts/StatemachineInterfaceTest.room126
2 files changed, 252 insertions, 0 deletions
diff --git a/tests/org.eclipse.etrice.generator.common.tests/drafts/OperationInheritance.room b/tests/org.eclipse.etrice.generator.common.tests/drafts/OperationInheritance.room
new file mode 100644
index 000000000..2ed4fe1fb
--- /dev/null
+++ b/tests/org.eclipse.etrice.generator.common.tests/drafts/OperationInheritance.room
@@ -0,0 +1,126 @@
+RoomModel OperationInheritance {
+
+ import room.basic.types.* from "../../org.eclipse.etrice.modellib.c/model/Types.room"
+
+ LogicalSystem OperationInheritanceSys {
+ SubSystemRef subSystemRef: OperationInheritanceSubSys
+ }
+
+ SubSystemClass OperationInheritanceSubSys {
+ ActorRef testActor: SubActor
+ LogicalThread defaultThread
+ }
+
+ ActorClass BaseActor {
+ Structure {
+ Attribute tcCaseId: int32
+ Attribute ctorBase: int32 = "0"
+ Attribute ctorRefine: int32 = "0"
+ Attribute valueBase: int32 = "0"
+ Attribute valueSub: int32 = "0"
+ }
+ Behavior {
+ ctor {
+ "ctorBase = 1;"
+ "ctorRefine = 1;"
+ }
+ dtor {
+ "// base dtor"
+ }
+ Operation overriddenOperation() {
+ "EXPECT_FALSE(tcCaseId, \"<|MODEL_LOCATION|>\", true);"
+ }
+ Operation baseOperation() {
+ "valueBase = 1;"
+ }
+ }
+ }
+
+ ActorClass SubActor extends BaseActor {
+ Structure {
+ Attribute testDataClass: SubDataClass
+ }
+ Behavior {
+ ctor {
+ "etUnit_open(\"log\", \"OperationInheritance\");"
+ "etUnit_openTestSuite(\"OperationInheritanceSuite\");"
+ "tcCaseId = etUnit_openTestCase(\"OperationInheritanceTestCase\");"
+ "ctorRefine = 2;"
+ }
+ dtor {
+ "// sub dtor"
+ "etUnit_closeTestSuite();"
+ "etUnit_close();"
+ }
+ override Operation overriddenOperation() {
+ "valueSub = 2;"
+ }
+ StateMachine {
+ Transition init: initial -> state0 {
+ action {
+ "baseOperation();"
+ "overriddenOperation();"
+ // c: not supported yet
+ //"testDataClass.baseOperation();"
+ //"testDataClass.overriddenOperation(tcCaseId);"
+ }
+ }
+ State state0 {
+ entry {
+ "// refine ctor, override operations"
+ "// -- ActorClass"
+ "EXPECT_EQUAL_INT32(tcCaseId, \"<|MODEL_LOCATION|>\", 1, ctorBase);"
+ "EXPECT_EQUAL_INT32(tcCaseId, \"<|MODEL_LOCATION|>\", 2, ctorRefine);"
+ "EXPECT_EQUAL_INT32(tcCaseId, \"<|MODEL_LOCATION|>\", 1, valueBase);"
+ "EXPECT_EQUAL_INT32(tcCaseId, \"<|MODEL_LOCATION|>\", 2, valueSub);"
+ ""
+ "// -- DataClass"
+ // c: not supported yet
+ //"EXPECT_EQUAL_INT32(tcCaseId, \"<|MODEL_LOCATION|>\", 1, testDataClass.ctorBase);"
+ //"EXPECT_EQUAL_INT32(tcCaseId, \"<|MODEL_LOCATION|>\", 2, testDataClass.ctorRefine);"
+ //"EXPECT_EQUAL_INT32(tcCaseId, \"<|MODEL_LOCATION|>\", 1, testDataClass.valueBase);"
+ //"EXPECT_EQUAL_INT32(tcCaseId, \"<|MODEL_LOCATION|>\", 2, testDataClass.valueSub);"
+ //"EXPECT_EQUAL_INT32(tcCaseId, \"<|MODEL_LOCATION|>\", 0, testDataClass.doNotCallOverride);"
+ ""
+ "etUnit_closeTestCase(tcCaseId);"
+ "etUnit_testFinished(tcCaseId);"
+ }
+ }
+ }
+ }
+ }
+
+ DataClass BaseDataClass {
+ Attribute ctorBase: int32 = "0"
+ Attribute ctorRefine: int32 = "0"
+ Attribute valueBase: int32 = "0"
+ Attribute valueSub: int32 = "0"
+ Attribute doNotCallOverride : int32 = "0"
+ ctor {
+ "ctorBase = 1;"
+ "ctorRefine = 1;"
+ }
+ dtor {
+ "// base dtor"
+ }
+ Operation overriddenOperation() {
+ "doNotCallOverride = 1;"
+ }
+ Operation baseOperation() {
+ "valueBase = 1;"
+ }
+ }
+
+ DataClass SubDataClass extends BaseDataClass {
+ ctor {
+ "ctorRefine = 2;"
+ }
+ dtor {
+ "// sub dtor"
+ }
+ override Operation overriddenOperation() {
+ "valueSub = 2;"
+ }
+ }
+
+} \ No newline at end of file
diff --git a/tests/org.eclipse.etrice.generator.common.tests/drafts/StatemachineInterfaceTest.room b/tests/org.eclipse.etrice.generator.common.tests/drafts/StatemachineInterfaceTest.room
new file mode 100644
index 000000000..e0c1613fa
--- /dev/null
+++ b/tests/org.eclipse.etrice.generator.common.tests/drafts/StatemachineInterfaceTest.room
@@ -0,0 +1,126 @@
+RoomModel StatemachineInterfaceTest {
+
+ import room.basic.types.* from "../../org.eclipse.etrice.modellib.c/model/Types.room"
+
+ LogicalSystem StatemachineInterfaceTest {
+ SubSystemRef main: MainSubSystem
+ }
+
+ SubSystemClass MainSubSystem {
+ ActorRef app1: AsyncApp
+ ActorRef app2: DataApp
+ ActorRef app3: EventApp
+ ActorRef app4: EmptyAsyncApp
+ ActorRef app5: EmptyDataApp
+ ActorRef app6: EmptyEventApp
+ //ActorRef app7: EmptyAsyncAppManual
+ //ActorRef app8: EmptyDataAppManual
+ ActorRef app9: EmptyEventAppManual
+
+ LogicalThread defaultThread
+ }
+
+ AnnotationType BehaviorManual {
+ target = ActorBehavior
+ }
+
+ ActorClass EmptyEventApp {
+ Structure {
+ Port p1 : EventProtocol
+ }
+ Behavior { }
+ }
+
+ ActorClass EventApp {
+ Structure {
+ Port p1 : EventProtocol
+ }
+ Behavior {
+ StateMachine {
+ Transition init: initial -> state0
+ State state0
+ }
+ }
+ }
+
+ async ActorClass EmptyAsyncApp {
+ Structure {
+ Port p0 : DataProtocol
+ Port p1 : EventProtocol
+ }
+ Behavior { }
+ }
+
+ async ActorClass AsyncApp {
+ Structure {
+ Port p0 : DataProtocol
+ Port p1 : EventProtocol
+ }
+ Behavior {
+ StateMachine {
+ Transition init: initial -> state0
+ State state0
+ }
+ }
+ }
+
+ datadriven ActorClass EmptyDataApp {
+ Structure {
+ Port p0 : DataProtocol
+ }
+ Behavior { }
+ }
+
+ datadriven ActorClass DataApp {
+ Structure {
+ Port p0 : DataProtocol
+ }
+ Behavior {
+ StateMachine {
+ Transition init: initial -> state0
+ State state0
+ }
+ }
+ }
+
+ ActorClass EmptyEventAppManual {
+ Structure {
+ Port p1 : EventProtocol
+ }
+ Behavior {
+ @BehaviorManual
+ }
+ }
+
+ async ActorClass EmptyAsyncAppManual {
+ Structure {
+ Port p0 : DataProtocol
+ Port p1 : EventProtocol
+ }
+ Behavior {
+ @BehaviorManual
+ }
+ }
+
+ datadriven ActorClass EmptyDataAppManual {
+ Structure {
+ Port p0 : DataProtocol
+ }
+ Behavior {
+ @BehaviorManual
+ }
+ }
+
+ ProtocolClass EventProtocol {
+ incoming {
+ Message in1()
+ }
+ }
+
+ datadriven ProtocolClass DataProtocol {
+ incoming {
+ Message in1(data: boolean)
+ }
+ }
+
+} \ No newline at end of file

Back to the top