summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuergen Haug2012-12-02 10:51:46 (EST)
committer Juergen Haug2012-12-02 10:51:46 (EST)
commit6a8e70e44eb919b4fd328a7113357ae7999e3558 (patch)
treedca2de43c12447da31cc87afc96d810fc0fa4cc8
parent221cfc29f137c157786e59fcb3682dff4d5cdf89 (diff)
downloadorg.eclipse.etrice-6a8e70e44eb919b4fd328a7113357ae7999e3558.zip
org.eclipse.etrice-6a8e70e44eb919b4fd328a7113357ae7999e3558.tar.gz
org.eclipse.etrice-6a8e70e44eb919b4fd328a7113357ae7999e3558.tar.bz2
[CQ][common.tests] StaticConfigTest addedrefs/changes/94/8994/1
-rw-r--r--tests/org.eclipse.etrice.generator.common.tests/models/ConfigTest.config107
-rw-r--r--tests/org.eclipse.etrice.generator.common.tests/models/ConfigTest.room269
-rw-r--r--tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest.config137
-rw-r--r--tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest_C.room394
-rw-r--r--tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest_Java.room374
5 files changed, 905 insertions, 376 deletions
diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/ConfigTest.config b/tests/org.eclipse.etrice.generator.common.tests/models/ConfigTest.config
deleted file mode 100644
index 0acd8e2..0000000
--- a/tests/org.eclipse.etrice.generator.common.tests/models/ConfigTest.config
+++ /dev/null
@@ -1,107 +0,0 @@
-import ConfigTest.* from "ConfigTest.room"
-
-SubSystemConfig SubSystemConfigTest {
- dynamic configuration {
- file path "models/subSystemConfigTest.rt-config"
- //user import "import org.eclipse.etrice.runtime.java.config.ConfigSourceFile"
- //user constructor "new ConfigSourceFile(\"test\")"
- polling timer [ms] 4000
- }
-}
-
-/*
- * Class Config
- */
-
-// Actors
-ActorClassConfig Testee_ac {
- Attr bool_c = false
- Attr int_c = 210
- Attr float_c = 16777215
- Attr char_c = "A"
- Attr charArray_c = "ROOM-Coon"
- Attr string_c = ":-)"
- Attr string_i = ":-]"
- Attr bool_i = false
- Attr int_i = 310
- Attr float_i = 0.0
- Attr char_i = "B"
- Attr charArray_i = "ROOM Gloom"
- Attr array1_c = 99
- Attr array1_i = 99
- Attr array2_c = false, false
- Attr array2_i = false, false
-}
-
-// Protocols
-ProtocolClassConfig PortProtocol {
- regular Port {
- Attr float_c = 3
- Attr float_i = 9
- }
- conjugate Port {
- Attr array1_c = 1
- Attr array1_i = 2
- Attr array2_c = 16, 32
- Attr array2_i = 16, 32
- }
-}
-
-/*
- * Instance Config
- */
-
- ActorInstanceConfig SubSystemConfigTest / top / testee {
- Attr bool_i = true
- Attr int_i = 301
- Attr float_i = 1.0E-5
- Attr char_i = "C"
- Attr charArray_i = "ROOM 2 Moon"
- Attr string_i = ":^]"
- Attr array1_i = 4
- Attr array2_i = false, true
- InterfaceItem Reg_port {
- Attr float_i = 25
- }
-}
-
-ActorInstanceConfig SubSystemConfigTest / top / testee / AR1 {
- InterfaceItem Conj_port {
- Attr array1_i = 256
- Attr array2_i = 1, 2
- }
-}
-
-ActorInstanceConfig SubSystemConfigTest / top / testee2 {
- Attr int_i = 301 {
- dynamic configuration read
- }
- Attr dc_i {
- dynamic configuration read Attr int_i = 302
- Attr long_array_i = 303
- Attr dc_i {
- Attr char_i = "instance3"
- Attr double_i = 0.304
- }
- }
- Attr blockMe = 0 {
- dynamic configuration read
- }
- Attr blocker = false {
- dynamic configuration read
- }
- Attr dc_dump{
- dynamic configuration write
- Attr dc_i {
- Attr char_i = "dummy"
- Attr double_i = 0.0e-100
- }
- Attr long_array_i = 1000
- Attr int_i = 123
- }
- Attr int_dump = 3 {
- dynamic configuration write
- }
-}
-
-
diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/ConfigTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/ConfigTest.room
deleted file mode 100644
index 9817cb7..0000000
--- a/tests/org.eclipse.etrice.generator.common.tests/models/ConfigTest.room
+++ /dev/null
@@ -1,269 +0,0 @@
-RoomModel ConfigTest {
-
- import room.basic.types.* from "Types.room"
-
- /* if this is included the paths start with the LogicalSystem's name and the configuration mappings don't work
- LogicalSystem System_ConfigTest {
- SubSystemRef SubSystem_ConfigTest: SubSystemConfigTest
- }
- */
-
- SubSystemClass SubSystemConfigTest {
- ActorRef top: ConfigTest_Top_ac
- }
-
- ActorClass ConfigTest_Top_ac {
- Structure {
- ActorRef testee: Testee_ac
- ActorRef testee2: DynTestee_ac
- Binding testee2.Conj_DynConfigPort and testee.Reg_dynConfigPort
- }
- Behavior {
- Operation ConfigTest_Top_ac() {
- "etUnit_open(\"tmp\", \"ConfigTest\");"
- "etUnit_openTestSuite(\"org.eclipse.etrice.generator.common.tests.ConfigTest\");"
- }
- Operation ~ConfigTest_Top_ac() {
- "etUnit_closeTestSuite();"
- "etUnit_close();"
- }
- }
- }
-
- ActorClass DynTestee_ac {
- Interface {
- conjugated Port Conj_DynConfigPort: TestCommProtocol
- }
- Structure {
- external Port Conj_DynConfigPort
- Attribute caseId: int32
- Attribute int_i : int32
- Attribute dc_i : Dyn_DC1
- // manual test
- Attribute blockMe : int32
- Attribute blocker : boolean
- // not explicit test
- Attribute dc_dump : Dyn_DC1
- Attribute int_dump : int32
- }
- Behavior {
- Operation DynTestee_ac() {
- "caseId = etUnit_openTestCase(\"ConfigTest_case_DynTestee_ac\");"
- }
- Operation ~DynTestee_ac() {
- "etUnit_closeTestCase(caseId);"
- }
- StateMachine {
- Transition init: initial -> First { }
- Transition tr0: First -> Done {
- triggers {
- <test : Conj_DynConfigPort>
- }
- action {
- // write without test
- "Dyn_DC1 tmp = new Dyn_DC1(123, new long[]{1000}, new Dyn_DC2(0.0e-100, \"dummy out\".toCharArray()));"
- "setAndWriteDc_dump(tmp);"
- "setAndWriteInt_dump(888);"
- // read test
- "if(blocker)getBlockMeLock().forbidUpdate(); else getBlockMeLock().allowUpdate();"
- "EXPECT_TRUE(caseId,\"<|MODEL_LOCATION|>\", int_i == 401 && getDc_i().getLong_array_i()[0] == 403);"
- "EXPECT_TRUE(caseId,\"<|MODEL_LOCATION|>\", getDc_i().getDc_i().getDouble_i() == 0.404);"
- "EXPECT_TRUE(caseId,\"<|MODEL_LOCATION|>\", String.valueOf(getDc_i().getDc_i().getChar_i()).equals(\"instance4\"));"
- "System.out.println(\"blockMe: \"+getBlockMe()+\", blocker: \"+getBlocker());"
- "if(!etUnit_isSuccess(caseId))"
- "\tetUnit_testFinished(caseId);"
- "else"
- "\tConj_DynConfigPort.ok();"
- }
- }
- State First {}
- State Done{}
- }
- }
- }
-
- DataClass Dyn_DC1 {
- Attribute int_i: int32
- Attribute long_array_i[1]: int64 = "0"
- Attribute dc_i : Dyn_DC2
- }
-
- DataClass Dyn_DC2 {
- Attribute double_i: float64
- Attribute char_i[10] : char
- }
-
- ActorClass AC1_ac {
- Interface {
- conjugated Port Conj_port: PortProtocol
- }
- Structure {
- external Port Conj_port
- }
- Behavior {
- StateMachine {
- Transition init: initial -> Done { }
- State Done {
- entry{
- "if(Conj_port.varCheck())"
- "\tConj_port.portTestSucc();"
- }
- }
- }
- }
- }
-
- ActorClass Testee_ac {
- Interface{
- Port Reg_dynConfigPort: TestCommProtocol
- }
- Structure {
- usercode1 {
- "import org.eclipse.etrice.runtime.java.messaging.RTServices;"
- }
- external Port Reg_dynConfigPort
- Port Reg_port: PortProtocol
- Attribute caseId: int32
- Attribute bool_r: boolean = "true"
- Attribute bool_c: boolean = "true"
- Attribute bool_i: boolean = "true"
- Attribute int_r: int32 = "100"
- Attribute int_c: int32 = "200"
- Attribute int_i: int32 = "300"
- Attribute float_r: float64 = "11.11"
- Attribute float_c: float64 = "22.22"
- Attribute float_i: float64 = "33.33"
-
- Attribute char_r: char = "R"
- Attribute char_c: char = "C"
- Attribute char_i: char = "I"
-
- Attribute charArray_r[20] : char = "ROOM will bloom"
- Attribute charArray_c [ 20 ]: char = "ROOM Zoom"
- Attribute charArray_i [ 20 ]: char = "ROOM Boom"
- Attribute string_r : string = ":/"
- Attribute string_c : string = ":)"
- Attribute string_i : string = ":]"
- Attribute array1_r [ 1 ]: int32 = "0"
- Attribute array1_c [ 1 ]: int32 = "0"
- Attribute array1_i [ 1 ]: int32 = "0"
- Attribute array2_r [ 2 ]: boolean = "{true, true}"
- Attribute array2_c [ 2 ]: boolean = "{true, false}"
- Attribute array2_i [ 2 ]: boolean = "{true, false}"
-
- ActorRef AR1: AC1_ac
- Binding Reg_port and AR1.Conj_port
- }
- Behavior {
- Operation Testee_ac() {
- "caseId = etUnit_openTestCase(\"ConfigTest_case_Testee_ac\");"
- }
- Operation ~Testee_ac() {
- "etUnit_closeTestCase(caseId);"
- }
- StateMachine {
- Transition init: initial -> Testing1 { }
- Transition tr1: Testing1 -> Testing2{
- triggers{
- <portTestSucc : Reg_port>
- }
- }
- Transition tr2: Testing2 -> Done{
- triggers{
- <ok : Reg_dynConfigPort>
- }
- }
-
- State Testing1 {
- entry {
- "if(Reg_port.varCheck())"
- "\tReg_port.conjCheck();"
- }
- }
- State Testing2{
- entry{
- "Reg_dynConfigPort.test();"
- }
- }
- State Done {
- entry {
- "EXPECT_TRUE(caseId,\"<|MODEL_LOCATION|>\", bool_r == true && bool_c == false && bool_i == true);"
- "EXPECT_TRUE(caseId,\"<|MODEL_LOCATION|>\", int_r == 100 && int_c == 210 && int_i == 301);"
- "EXPECT_TRUE(caseId,\"<|MODEL_LOCATION|>\", float_r == 11.11 && float_c ==0xFFFFFF && float_i == 0.00001);"
- "EXPECT_TRUE(caseId,\"<|MODEL_LOCATION|>\", char_r == \'R\' && char_c == \'A\' && char_i == \'C\');"
- "// string_r.equals(\"ROOM will bloom\")"
- "EXPECT_TRUE(caseId,\"<|MODEL_LOCATION|>\", !charArray_r.equals(\"ROOM will bloom\") && !charArray_c.equals(\"ROOM-Coon\") && !charArray_i.equals(\"ROOM 2 Moon\"));"
- "EXPECT_TRUE(caseId,\"<|MODEL_LOCATION|>\", string_r.equals(\":/\") && string_c.equals(\":-)\") && string_i.equals(\":^]\"));"
- "EXPECT_TRUE(caseId,\"<|MODEL_LOCATION|>\", array1_r[0] == 0 && array1_c[0] == 99 && array1_i[0] == 4);"
- "EXPECT_TRUE(caseId,\"<|MODEL_LOCATION|>\", array2_r[0] == true && array2_r[1] == true);"
- "EXPECT_TRUE(caseId,\"<|MODEL_LOCATION|>\", array2_c[0] == false && array2_c[1] == false);"
- "EXPECT_TRUE(caseId,\"<|MODEL_LOCATION|>\", array2_i[0] == false && array2_i[1] == true);"
- "etUnit_testFinished(caseId);"
- }
- }
- }
- }
- }
-
-
- ProtocolClass PortProtocol {
- usercode1 {
- "import org.eclipse.etrice.runtime.java.messaging.RTServices;"
- }
- incoming {
- Message portTestSucc()
- }
- outgoing {
- Message conjCheck()
- }
- regular PortClass
- {
- Attribute float_r: float32 = "4"
- Attribute float_c: float32 = "16"
- Attribute float_i: float32 = "256"
- Operation varCheck():boolean {
- "int caseId = etUnit_openTestCase(\"ConfigTest_case_PortProtocol_regular\");"
- "EXPECT_EQUAL_FLOAT32(caseId,\"float_r: <|MODEL_LOCATION|>\", 4.f, float_r, 0.1f);"
- "EXPECT_EQUAL_FLOAT32(caseId,\"float_c: <|MODEL_LOCATION|>\", 3.f, float_c, 0.1f);"
- "EXPECT_EQUAL_FLOAT32(caseId,\"float_i: <|MODEL_LOCATION|>\", 25.f, float_i, 0.1f);"
- "etUnit_testFinished(caseId);"
- "return etUnit_isSuccess(caseId);"
- }
- }
- conjugate PortClass
- {
- Attribute array1_r [ 1 ]: float32 = "1000"
- Attribute array1_c [ 1 ]: float32 = "1001"
- Attribute array1_i [ 1 ]: float32 = "1002"
- Attribute array2_r [ 2 ]: int64 = "{11,22}"
- Attribute array2_c [ 2 ]: int64 = "{0,0}"
- Attribute array2_i [ 2 ]: int64 = "{0,0}"
- Operation varCheck():boolean {
- "int caseId = etUnit_openTestCase(\"ConfigTest_case_PortProtocol_conjugated\");"
- "EXPECT_EQUAL_FLOAT32(caseId,\"array1_r[0]: <|MODEL_LOCATION|>\", 1000.f, array1_r[0], 0.1f);"
- "EXPECT_EQUAL_FLOAT32(caseId,\"array1_c[0]: <|MODEL_LOCATION|>\", 1.f, array1_c[0], 0.1f);"
- "EXPECT_EQUAL_FLOAT32(caseId,\"array1_i[0]: <|MODEL_LOCATION|>\", 256.f, array1_i[0], 0.1f);"
- "EXPECT_TRUE(caseId,\"array2_r[0]: <|MODEL_LOCATION|>\", array2_r[0] == 11);"
- "EXPECT_TRUE(caseId,\"array2_r[1]: <|MODEL_LOCATION|>\", array2_r[1] == 22);"
- "EXPECT_TRUE(caseId,\"array2_c[0]: <|MODEL_LOCATION|>\", array2_c[0] == 16);"
- "EXPECT_TRUE(caseId,\"array2_c[1]: <|MODEL_LOCATION|>\", array2_c[1] == 32);"
- "EXPECT_TRUE(caseId,\"array2_i[0]: <|MODEL_LOCATION|>\", array2_i[0] == 1);"
- "EXPECT_TRUE(caseId,\"array2_i[1]: <|MODEL_LOCATION|>\", array2_i[1] == 2);"
- "etUnit_testFinished(caseId);"
- "return etUnit_isSuccess(caseId);"
- }
- }
- }
-
- ProtocolClass TestCommProtocol {
- incoming {
- Message ok()
-
- }
- outgoing {
- Message test()
- }
- }
-
-
-}
diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest.config b/tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest.config
new file mode 100644
index 0000000..8aa41d3
--- /dev/null
+++ b/tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest.config
@@ -0,0 +1,137 @@
+ConfigModel AttrTestConfig {
+ import StaticConfigTest.* from "StaticConfigTest.room"
+
+ ActorClassConfig Tester_ac {
+ // nothing
+ }
+
+ ActorClassConfig Testee_1_ac {
+ Attr data_1 {
+ Attr bool_c = false
+ Attr bool_i = false
+ Attr int8_c = 24
+ Attr int8_i = 24
+ Attr int16_c = 48
+ Attr int16_i = 48
+ Attr int32_c = 96
+ Attr int32_i = 96
+ Attr int64_c = 192
+ Attr int64_i = 192
+ Attr float32_c = 9.6
+ Attr float32_i = 9.6
+ Attr float64_c = 19.2
+ Attr float64_i = 19.2
+ Attr char_c = "C"
+ Attr char_i = "C"
+ Attr string_c = ":)"
+ Attr string_i = ":)"
+
+ Attr bool_array_c = true, false
+ Attr bool_array_i = true, false
+ Attr int8_array_c = 24, 48
+ Attr int8_array_i = 24, 48
+ Attr int16_array_c = 48, 96
+ Attr int16_array_i = 48, 96
+ Attr int32_array_c = 96, 192
+ Attr int32_array_i = 96, 192
+ Attr int64_array_c = 192, 384
+ Attr int64_array_i = 192, 384
+ Attr float32_array_c = 9.6, 19.2
+ Attr float32_array_i = 9.6, 19.2
+ Attr float64_array_c = 19.2, 38.4
+ Attr char_array_c = "Claz"
+ Attr char_array_i = "Claz"
+
+ Attr data_2 {
+ Attr int32_c = 42
+ Attr int32_i = 42
+ }
+ }
+ }
+
+ ActorClassConfig Testee_Super2_ac {
+ Attr float64_super_c = 2.2
+ Attr float64_super_i = 2.2
+ }
+
+ ActorClassConfig Testee_2_ac {
+ Attr int32_own_c = 12
+ Attr int32_own_i = 12
+ }
+
+ ProtocolClassConfig TestProtocol {
+ regular Port{
+ Attr float_c = 3.0
+ Attr float_i = 3.0
+ }
+ conjugate Port {
+ Attr array2_c = 16, 32
+ Attr array2_i = 16, 32
+ }
+ }
+
+ ProtocolClassConfig TestProtocolWithDataClass {
+ conjugate Port {
+ Attr sap_data_2{
+ Attr int32_c = 2
+ Attr int32_i = 2
+ }
+ }
+ }
+
+ ActorInstanceConfig System_StaticConfigTest/subSystem/top/tester {
+ // nothing
+ }
+
+ ActorInstanceConfig System_StaticConfigTest/subSystem/top/testee_1 {
+ Attr data_1 {
+ Attr bool_i = true
+ Attr int8_i = 2
+ Attr int16_i = 4
+ Attr int32_i = 8
+ Attr int64_i = 16
+ Attr float32_i = 1.6
+ Attr float64_i = 3.2
+ Attr char_i = "I"
+ Attr string_i = ":]"
+
+ Attr bool_array_i = true, true
+ Attr int8_array_i = 2, 6
+ Attr int16_array_i = 4, 12
+ Attr int32_array_i = 8, 24
+ Attr int64_array_i = 16, 48
+ Attr float32_array_i = 1.6, 4.8
+ Attr float64_array_i = 5, 15
+ Attr char_array_i = "Inst"
+
+ Attr data_2 {
+ Attr int32_i = 43
+ }
+ }
+ InterfaceItem conj_port {
+ Attr array2_i = 1, 2
+ }
+ }
+
+
+ ActorInstanceConfig System_StaticConfigTest/subSystem/top/tester/testee_super2{
+ Attr float64_super_i = 3.3
+ InterfaceItem reg_port {
+ Attr float_i = 25.0
+ }
+ }
+
+ ActorInstanceConfig System_StaticConfigTest/subSystem/top/testee_1/testee_2 {
+ Attr float64_super_i = 4.4
+ Attr int32_own_i = 13
+ InterfaceItem reg_port {
+ Attr float_i = 50.0
+ }
+ InterfaceItem sap {
+ Attr sap_data_2 {
+ Attr int32_i = 3
+ }
+ }
+ }
+
+} \ No newline at end of file
diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest_C.room b/tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest_C.room
new file mode 100644
index 0000000..3bbbd8d
--- /dev/null
+++ b/tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest_C.room
@@ -0,0 +1,394 @@
+RoomModel StaticConfigTest {
+
+ import room.basic.types.* from "Types.room"
+
+ LogicalSystem System_StaticConfigTest {
+ SubSystemRef subSystem: SubSystem_StaticConfigTest
+ }
+
+ SubSystemClass SubSystem_StaticConfigTest {
+ ActorRef top: Top_ac
+ LogicalThread dflt_thread
+ }
+
+ ActorClass Top_ac {
+ Structure {
+ ActorRef testee_1: Testee_1_ac
+ ActorRef tester: Tester_ac
+ LayerConnection ref testee_1 satisfied_by tester.spp
+ }
+ Behavior {
+ Operation Top_ac() {
+ "etUnit_open(\"tmp\", \"StaticConfigTest\");"
+ "etUnit_openTestSuite(\"org.eclipse.etrice.generator.common.tests.StaticConfigTest\");"
+ }
+ Operation ~Top_ac() {
+ "etUnit_closeTestSuite();"
+ "etUnit_close();"
+ }
+ }
+ }
+
+ ActorClass Tester_ac {
+ Interface {
+ SPP spp: TestProtocolWithDataClass
+ }
+ Structure {
+ ServiceImplementation of spp
+ Attribute caseId: int32
+
+ // none config test
+ Attribute data_3: Data_3_dc
+ ActorRef testee_super2: Testee_Super2_ac
+ }
+ Behavior {
+ Operation Tester_ac() {
+ "caseId = etUnit_openTestCase(\"AttrConfigTest_case_Tester_ac\");"
+ "etUnit_testFinished(caseId);"
+ }
+ Operation ~Tester_ac() {
+ "etUnit_closeTestCase(caseId);"
+ }
+ StateMachine {
+ Transition init: initial -> s1 { }
+ State s1 {
+ entry {
+ "Data_3_dc_varCheck3(&(data_3), caseId);"
+ }
+ }
+ }
+ }
+ }
+
+ ActorClass Testee_1_ac {
+ Interface {
+ conjugated Port conj_port: TestProtocol
+ }
+ Structure {
+ usercode1 {
+ "#include \"etUnit/etUnit.h\""
+ }
+ external Port conj_port
+ Attribute caseId: int32
+ Attribute data_1: Data_1_dc
+ ActorRef testee_2: Testee_2_ac
+ }
+ Behavior {
+ Operation Testee_1_ac() {
+ "caseId = etUnit_openTestCase(\"AttrConfigTest_case_Testee_1_ac\");"
+ "etUnit_testFinished(caseId);"
+ }
+ Operation ~Testee_1_ac() {
+ "etUnit_closeTestCase(caseId);"
+ }
+ StateMachine {
+ Transition init: initial -> s1 { }
+ State s1 {
+ entry {
+ "Data_1_dc_varCheck1(&(data_1), caseId);"
+ "EXPECT_FALSE(caseId,\"testee_1:data_1:1\", data_1.bool_c);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:2\", data_1.int8_c == 24);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:3\", data_1.int16_c == 48);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:4\", data_1.int32_c == 96);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:5\", data_1.int64_c == 192);"
+ "EXPECT_EQUAL_FLOAT32(caseId,\"testee_1:data_1:6\", 9.6f, data_1.float32_c, 0.1f);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:7\", data_1.float64_c == 19.2);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:8\", data_1.char_c == \'C\');"
+ "EXPECT_TRUE(caseId,\"testee_1:varCheck:8.1\", strcmp(data_1.string_c, \":)\") == 0 );"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:10\", data_1.bool_i);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:11\", data_1.int8_i == 2);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:12\", data_1.int16_i == 4);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:13\", data_1.int32_i == 8);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:14\", data_1.int64_i == 16);"
+ "EXPECT_EQUAL_FLOAT32(caseId,\"testee_1:data_1:15\", 1.6f, data_1.float32_i, 0.1f);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:16\", data_1.float64_i == 3.2);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:17\", data_1.char_i == \'I\');"
+ "EXPECT_TRUE(caseId,\"testee_1:varCheck:18\", strcmp(data_1.string_i, \":]\") == 0 );"
+
+ // Array
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:19\", data_1.bool_array_c[0] == TRUE && data_1.bool_array_c[1] == FALSE);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:20\", data_1.int8_array_c[0] == 24 && data_1.int8_array_c[1] == 48);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:21\", data_1.int16_array_c[0] == 48 && data_1.int16_array_c[1] == 96);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:22\", data_1.int32_array_c[0] == 96 && data_1.int32_array_c[1] == 192);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:23\", data_1.int64_array_c[0] == 192 && data_1.int64_array_c[1] == 384);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:24\", data_1.float32_array_c[0] == 9.6f && data_1.float32_array_c[1] == 19.2f);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:25\", data_1.float64_array_c[0] == 19.2 && data_1.float64_array_c[1] == 38.4);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:26\", strcmp(data_1.char_array_c, \"Claz\") == 0);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:27\", data_1.bool_array_i[0] == TRUE && data_1.bool_array_i[1] == TRUE);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:28\", data_1.int8_array_i[0] == 2 && data_1.int8_array_i[1] == 6);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:29\", data_1.int16_array_i[0] == 4 && data_1.int16_array_i[1] == 12);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:30\", data_1.int32_array_i[0] == 8 && data_1.int32_array_i[1] == 24);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:31\", data_1.int64_array_i[0] == 16 && data_1.int64_array_i[1] == 48);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:32\", data_1.float32_array_i[0] == 1.6f && data_1.float32_array_i[1] == 4.8f);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:33\", data_1.float64_array_i[0] == 5 && data_1.float64_array_i[1] == 15);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:34\", strcmp(data_1.char_array_i, \"Inst\") == 0);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:35\", data_1.data_2.int32_c == 42);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:36\", data_1.data_2.int32_i == 43);"
+
+ // conj_port
+ "EXPECT_TRUE(caseId,\"testee_1:conj_port:36\", ((TestProtocolConjPort_var*)self->constData->conj_port.varData)->array2_r[0] == 11);"
+ "EXPECT_TRUE(caseId,\"testee_1:conj_port:37\", ((TestProtocolConjPort_var*)self->constData->conj_port.varData)->array2_r[1] == 22);"
+ "EXPECT_TRUE(caseId,\"testee_1:conj_port:38\", ((TestProtocolConjPort_var*)self->constData->conj_port.varData)->array2_c[0] == 16);"
+ "EXPECT_TRUE(caseId,\"testee_1:conj_port:39\", ((TestProtocolConjPort_var*)self->constData->conj_port.varData)->array2_c[1] == 32);"
+ "EXPECT_TRUE(caseId,\"testee_1:conj_port:40\", ((TestProtocolConjPort_var*)self->constData->conj_port.varData)->array2_i[0] == 1);"
+ "EXPECT_TRUE(caseId,\"testee_1:conj_port:41\", ((TestProtocolConjPort_var*)self->constData->conj_port.varData)->array2_i[1] == 2);"
+ "etUnit_testFinished(caseId);"
+ }
+ }
+ }
+ }
+ }
+
+ ActorClass Testee_Super2_ac {
+ Interface {
+ Port reg_port: TestProtocol
+ }
+ Structure {
+ usercode1 {
+ "#include \"etUnit/etUnit.h\""
+ }
+ external Port reg_port
+ Attribute caseId: int32
+
+ // test
+ Attribute data_2: Data_2_dc
+ Attribute float64_super_r: float64 = "1.1"
+ Attribute float64_super_c: float64 = "1.1"
+ Attribute float64_super_i: float64 = "1.1"
+ }
+ Behavior {
+ Operation Testee_Super2_ac() {
+ "caseId = etUnit_openTestCase(\"AttrConfigTest_case_Testee_Super2_ac\");"
+ "EXPECT_TRUE(caseId, \"Testee_Super2_ac:1\", float64_super_r == 1.1);"
+ "EXPECT_TRUE(caseId, \"Testee_Super2_ac:2\", float64_super_c == 2.2);"
+ "EXPECT_TRUE(caseId, \"Testee_Super2_ac:3\", float64_super_i == 3.3);"
+
+ // reg_port
+ "EXPECT_EQUAL_FLOAT32(caseId, \"Testee_Super2_ac:5\", 4.0f, ((TestProtocolPort_var*) self->constData->reg_port.varData)->float_r, 0.1f);"
+ "EXPECT_EQUAL_FLOAT32(caseId, \"Testee_Super2_ac:6\", 3.0f, ((TestProtocolPort_var*) self->constData->reg_port.varData)->float_c, 0.1f);"
+ "EXPECT_EQUAL_FLOAT32(caseId, \"Testee_Super2_ac:7\", 25.0f, ((TestProtocolPort_var*) self->constData->reg_port.varData)->float_i, 0.1f);"
+ }
+ Operation ~Testee_Super2_ac() {
+ "etUnit_closeTestCase(caseId);"
+ }
+ }
+ }
+
+ ActorClass Testee_2_ac extends Testee_Super2_ac {
+ Structure {
+ SAP sap: TestProtocolWithDataClass
+ Attribute int32_own_r: int32 = "11"
+ Attribute int32_own_c: int32 = "11"
+ Attribute int32_own_i: int32 = "11"
+ }
+ Behavior {
+ Operation Testee_2_ac() {
+ "caseId = etUnit_openTestCase(\"AttrConfigTest_case_Testee_2_ac\");"
+ "etUnit_testFinished(caseId);"
+ }
+ Operation ~Testee_2_ac() {
+ "etUnit_closeTestCase(caseId);"
+ }
+ StateMachine {
+ Transition init: initial -> s1 { }
+ State s1 {
+ entry {
+
+ "EXPECT_TRUE(caseId, \"Testee_2_ac:1\", float64_super_c == 2.2);"
+ "EXPECT_TRUE(caseId, \"Testee_2_ac:2\", float64_super_i == 4.4);"
+ "EXPECT_TRUE(caseId, \"Testee_2_ac:3\", int32_own_r == 11);"
+ "EXPECT_TRUE(caseId, \"Testee_2_ac:4\", int32_own_c == 12);"
+ "EXPECT_TRUE(caseId, \"Testee_2_ac:5\", int32_own_i == 13);"
+
+ // reg_port
+ "EXPECT_EQUAL_FLOAT32(caseId, \"Testee_2_ac:6\", 4.0f, ((TestProtocolPort_var*) self->constData->reg_port.varData)->float_r, 0.1f);"
+ "EXPECT_EQUAL_FLOAT32(caseId, \"Testee_2_ac:7\", 3.0f, ((TestProtocolPort_var*) self->constData->reg_port.varData)->float_c, 0.1f);"
+ "EXPECT_EQUAL_FLOAT32(caseId, \"Testee_2_ac:9\", 50.0f, ((TestProtocolPort_var*) self->constData->reg_port.varData)->float_i, 0.1f);"
+
+ // sap
+ "Data_3_dc_varCheck3(&(((TestProtocolWithDataClassConjPort_var*)self->constData->sap.varData)->sap_data_3), caseId);"
+ "EXPECT_TRUE(caseId, \"Testee_2_ac:sap:10\", ((TestProtocolWithDataClassConjPort_var*)self->constData->sap.varData)->sap_data_2.int32_r == 1);"
+ "EXPECT_TRUE(caseId, \"Testee_2_ac:sap:11\", ((TestProtocolWithDataClassConjPort_var*)self->constData->sap.varData)->sap_data_2.int32_c == 2);"
+ "EXPECT_TRUE(caseId, \"Testee_2_ac:sap:12\", ((TestProtocolWithDataClassConjPort_var*)self->constData->sap.varData)->sap_data_2.int32_i == 3);"
+ "etUnit_testFinished(caseId);"
+ }
+ }
+ }
+ }
+ }
+
+ ProtocolClass TestProtocol {
+ incoming {
+ Message dummy()
+ }
+ regular PortClass
+ {
+ Attribute float_r: float32 = "4"
+ Attribute float_c: float32 = "16"
+ Attribute float_i: float32 = "256"
+ }
+ conjugate PortClass
+ {
+ Attribute array2_r [ 2 ]: int64 = "{11,22}"
+ Attribute array2_c [ 2 ]: int64 = "{0,0}"
+ Attribute array2_i [ 2 ]: int64 = "{0,0}"
+ }
+ }
+
+ ProtocolClass TestProtocolWithDataClass {
+ usercode1 {
+ "#include \"Data_2_dc.h\""
+ "#include \"Data_3_dc.h\""
+ }
+ incoming {
+ Message dummy()
+ }
+
+ //SAP
+ conjugate PortClass
+ {
+ Attribute sap_data_2: Data_2_dc
+
+ // none config test
+ Attribute sap_data_3: Data_3_dc
+ }
+ }
+
+ ExternalType extType -> int default "999"
+
+ DataClass Data_Super1_dc {
+ // PrimitiveType
+ Attribute bool_r: boolean = "falSe"
+ Attribute bool_c: boolean = "false"
+ Attribute bool_i: boolean = "false"
+ // Array
+ Attribute bool_array_r [ 2 ]: boolean = "{ FALSE, false }"
+ Attribute bool_array_c [ 2 ]: boolean = "{ false, false }"
+ Attribute bool_array_i [ 2 ]: boolean = "{ false, false }"
+ }
+
+ DataClass Data_1_dc extends Data_Super1_dc{
+ usercode1 {
+ "#include \"etUnit/etUnit.h\""
+ }
+
+ Attribute int8_r: int8 = "8"
+ Attribute int8_c: int8 = "8"
+ Attribute int8_i: int8 = "8"
+ Attribute int16_r: int16 = "16"
+ Attribute int16_c: int16 = "16"
+ Attribute int16_i: int16 = "16"
+ Attribute int32_r: int32 = "32"
+ Attribute int32_c: int32 = "32"
+ Attribute int32_i: int32 = "32"
+ Attribute int64_r: int64 = "64"
+ Attribute int64_c: int64 = "64"
+ Attribute int64_i: int64 = "64"
+ Attribute float32_r: float32 = "3.2"
+ Attribute float32_c: float32 = "3.2"
+ Attribute float32_i: float32 = "3.2"
+ Attribute float64_r: float64 = "6.4"
+ Attribute float64_c: float64 = "6.4"
+ Attribute float64_i: float64 = "6.4"
+ Attribute char_r: char = "R"
+ Attribute char_c: char = 'R'
+ Attribute char_i: char = "R"
+ Attribute string_r: string = ":/"
+ Attribute string_c: string = ":/"
+ Attribute string_i: string = ":/"
+
+ // Array
+ Attribute int8_array_r [ 2 ]: int8 = "{ 8, 16 }"
+ Attribute int8_array_c [ 2 ]: int8 = "{ 8, 16 }"
+ Attribute int8_array_i [ 2 ]: int8 = "{ 8, 16 }"
+ Attribute int16_array_r [ 2 ]: int16 = "{ 16, 32 }"
+ Attribute int16_array_c [ 2 ]: int16 = "{ 16, 32 }"
+ Attribute int16_array_i [ 2 ]: int16 = "{ 16, 32 }"
+ Attribute int32_array_r [ 2 ]: int32 = "{ 32, 64 }"
+ Attribute int32_array_c [ 2 ]: int32 = "{ 32, 64 }"
+ Attribute int32_array_i [ 2 ]: int32 = "{ 32, 64 }"
+ Attribute int64_array_r [ 2 ]: int64 = "{ 64, 128 }"
+ Attribute int64_array_c [ 2 ]: int64 = "{ 64, 128 }"
+ Attribute int64_array_i [ 2 ]: int64 = "{ 64, 128 }"
+ Attribute float32_array_r [ 2 ]: float32 = "{ 3.2, 6.4 }"
+ Attribute float32_array_c [ 2 ]: float32 = "{ 3.2, 6.4 }"
+ Attribute float32_array_i [ 2 ]: float32 = "{ 3.2, 6.4 }"
+ Attribute float64_array_r [ 2 ]: float64 = "{ 6.4, 12.8 }"
+ Attribute float64_array_c [ 2 ]: float64 = "{ 6.4, 12.8 }"
+ Attribute float64_array_i [ 2 ]: float64 = "{ 6.4, 12.8 }"
+ Attribute char_array_r [ 5 ]: char = "ROOM"
+ Attribute char_array_c [ 5 ]: char = "ROOM"
+ Attribute char_array_i [ 5 ]: char = "ROOM"
+
+ // ComplexType
+ Attribute data_2: Data_2_dc
+
+ Operation varCheck1(caseId: int32) {
+ "Data_2_dc_varCheck2(&(data_2), caseId);"
+
+ // PrimitiveType
+ "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:1\", bool_r == FALSE);"
+ "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:2\", int8_r == 8);"
+ "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:3\", int16_r == 16);"
+ "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:4\", int32_r == 32);"
+ "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:5\", int64_r == 64);"
+ "EXPECT_EQUAL_FLOAT32(caseId,\"Data_1_dc:varCheck:6\", 3.2f, float32_r, 0.1f);"
+ "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:7\", float64_r == 6.4);"
+ "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:8\", char_r == \'R\');"
+ "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:8\", strcmp(string_r, \":/\") == 0 );"
+
+ // Array
+ "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:10\", bool_array_r[0] == FALSE && bool_array_r[1] == FALSE);"
+ "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:11\", int8_array_r[0] == 8 && int8_array_r[1] == 16);"
+ "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:12\", int16_array_r[0] == 16 && int16_array_r[1] == 32);"
+ "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:13\", int32_array_r[0] == 32 && int32_array_r[1] == 64);"
+ "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:24\", int64_array_r[0] == 64 && int64_array_r[1] == 128);"
+ "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:25\", float32_array_r[0] == 3.2f && float32_array_r[1] == 6.4f);"
+ "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:26\", float64_array_r[0] == 6.4 && float64_array_r[1] == 12.8);"
+ "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:27\", strcmp(char_array_r, \"ROOM\")==0);"
+ }
+ }
+
+ DataClass Data_2_dc {
+ usercode1 {
+ "#include \"etUnit/etUnit.h\""
+ }
+ Attribute int32_r: int32 = "1"
+ Attribute int32_c: int32 = "1"
+ Attribute int32_i: int32 = "1"
+ Operation varCheck2(caseId: int32): void {
+ "EXPECT_TRUE(caseId, \"Data_2_dc:1\", int32_r == 1);"
+ }
+ }
+
+ DataClass Data_3_dc {
+ usercode1 {
+ "#include \"etUnit/etUnit.h\""
+ }
+
+ // none config test
+ Attribute primitive_ref: int32 ref
+ Attribute primitive_ref_array [ 2 ]: int32 ref
+ Attribute dataClass_array [ 2 ]: Data_2_dc
+ Attribute dataClass_ref: Data_2_dc ref
+ Attribute dataClass_ref_array [ 2 ]: Data_2_dc ref
+ Attribute ext_type: extType
+ Attribute ext_type_array [ 2 ]: extType
+ Attribute ext_type_ref: extType ref
+ Attribute ext_type_ref_array [ 2 ]: extType ref
+ Operation varCheck3(caseId: int32): void {
+ "EXPECT_TRUE(caseId, \"Data_3_dc:1\", primitive_ref == NULL);"
+ "EXPECT_TRUE(caseId, \"Data_3_dc:2\", primitive_ref_array[0] == NULL && primitive_ref_array[1] == NULL);"
+ "EXPECT_TRUE(caseId, \"Data_3_dc:3\", dataClass_ref == NULL);"
+ "EXPECT_TRUE(caseId, \"Data_3_dc:4\", dataClass_array[0].int32_r == 1 && dataClass_array[0].int32_c == 1 && dataClass_array[0].int32_i == 1);"
+ "EXPECT_TRUE(caseId, \"Data_3_dc:4\", dataClass_array[1].int32_r == 1 && dataClass_array[1].int32_c == 1 && dataClass_array[1].int32_i == 1);"
+ "EXPECT_TRUE(caseId, \"Data_3_dc:5\", dataClass_ref == NULL);"
+ "EXPECT_TRUE(caseId, \"Data_3_dc:6\", dataClass_ref_array[0] == NULL && dataClass_ref_array[1] == NULL);"
+ "EXPECT_TRUE(caseId, \"Data_3_dc:7\", ext_type == 999);"
+ "EXPECT_TRUE(caseId, \"Data_3_dc:8\", ext_type_array[0] == 999 && ext_type_array[1] == 999);"
+ "EXPECT_TRUE(caseId, \"Data_3_dc:9\", ext_type_ref == NULL);"
+ "EXPECT_TRUE(caseId, \"Data_3_dc:10\", ext_type_ref_array[0] == NULL && dataClass_ref_array[1] == NULL);"
+ }
+ }
+
+} \ No newline at end of file
diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest_Java.room b/tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest_Java.room
new file mode 100644
index 0000000..28e0ac4
--- /dev/null
+++ b/tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest_Java.room
@@ -0,0 +1,374 @@
+RoomModel StaticConfigTest {
+
+ import room.basic.types.* from "Types.room"
+
+ LogicalSystem System_StaticConfigTest {
+ SubSystemRef subSystem: SubSystem_StaticConfigTest
+ }
+
+ SubSystemClass SubSystem_StaticConfigTest {
+ ActorRef top: Top_ac
+ LogicalThread dflt_thread
+ }
+
+ ActorClass Top_ac {
+ Structure {
+ ActorRef testee_1: Testee_1_ac
+ ActorRef tester: Tester_ac
+ LayerConnection ref testee_1 satisfied_by tester.spp
+ }
+ Behavior {
+ Operation Top_ac() {
+ "etUnit_open(\"tmp\", \"StaticConfigTest\");"
+ "etUnit_openTestSuite(\"org.eclipse.etrice.generator.common.tests.StaticConfigTest\");"
+ }
+ Operation ~Top_ac() {
+ "etUnit_closeTestSuite();"
+ "etUnit_close();"
+ }
+ }
+ }
+
+ ActorClass Tester_ac {
+ Interface {
+ SPP spp: TestProtocolWithDataClass
+ }
+ Structure {
+ ServiceImplementation of spp
+ Attribute caseId: int32
+
+ // none config test
+ Attribute data_3: Data_3_dc
+ ActorRef testee_super2: Testee_Super2_ac
+ }
+ Behavior {
+ Operation Tester_ac() {
+ "caseId = etUnit_openTestCase(\"AttrConfigTest_case_Tester_ac\");"
+ "etUnit_testFinished(caseId);"
+ }
+ Operation ~Tester_ac() {
+ "etUnit_closeTestCase(caseId);"
+ }
+ StateMachine {
+ Transition init: initial -> s1 { }
+ State s1 {
+ entry {
+ "data_3.varCheck3(caseId);"
+ "SubSystemClassBase subSystem = (SubSystemClassBase) ((ActorClassBase)getParent()).getParent();"
+ "Testee_Super2_ac testee_super2 = (Testee_Super2_ac) subSystem.getInstance(\"/subSystem/top/tester/testee_super2\");"
+ "int caseId_2 = testee_super2.getCaseId();"
+ "testee_super2.getReg_port().varCheck(caseId_2);"
+ "EXPECT_TRUE(caseId_2, \"Tester_ac:1\", testee_super2.getFloat64_super_r() == 1.1);"
+ "EXPECT_TRUE(caseId_2, \"Tester_ac:2\", testee_super2.getFloat64_super_c() == 2.2);"
+ "EXPECT_TRUE(caseId_2, \"Tester_ac:3\", testee_super2.getFloat64_super_i() == 3.3);"
+ "EXPECT_EQUAL_FLOAT32(caseId,\"Tester_ac:4\", 25.f, testee_super2.getReg_port().getFloat_i(), 0.1f);"
+ }
+ }
+ }
+ }
+ }
+
+ ActorClass Testee_1_ac {
+ Interface {
+ conjugated Port conj_port: TestProtocol
+ }
+ Structure {
+ external Port conj_port
+ Attribute caseId: int32
+ Attribute data_1: Data_1_dc
+ ActorRef testee_2: Testee_2_ac
+ }
+ Behavior {
+ Operation Testee_1_ac() {
+ "caseId = etUnit_openTestCase(\"AttrConfigTest_case_Testee_1_ac\");"
+ "etUnit_testFinished(caseId);"
+ }
+ Operation ~Testee_1_ac() {
+ "etUnit_closeTestCase(caseId);"
+ }
+ StateMachine {
+ Transition init: initial -> s1 { }
+ State s1 {
+ entry {
+ "conj_port.varCheck();"
+ "data_1.varCheck1(caseId);"
+ "EXPECT_FALSE(caseId,\"testee_1:data_1:1\", getData_1().getBool_c());"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:2\", getData_1().getInt8_c() == 24);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:3\", getData_1().getInt16_c() == 48);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:4\", getData_1().getInt32_c() == 96);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:5\", getData_1().getInt64_c() == 192);"
+ "EXPECT_EQUAL_FLOAT32(caseId,\"testee_1:data_1:6\", 9.6f, getData_1().getFloat32_c(), 0.1f);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:7\", getData_1().getFloat64_c() == 19.2);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:8\", getData_1().getChar_c() == \'C\');"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:9\", getData_1().getString_c().equals(\":)\"));"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:10\", getData_1().getBool_i());"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:11\", getData_1().getInt8_i() == 2);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:12\", getData_1().getInt16_i() == 4);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:13\", getData_1().getInt32_i() == 8);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:14\", getData_1().getInt64_i() == 16);"
+ "EXPECT_EQUAL_FLOAT32(caseId,\"testee_1:data_1:15\", 1.6f, getData_1().getFloat32_i(), 0.1f);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:16\", getData_1().getFloat64_i() == 3.2);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:17\", getData_1().getChar_i() == \'I\');"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:18\", getData_1().getString_i().equals(\":]\"));"
+
+ // Array
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:19\", getData_1().getBool_array_c()[0] == true && getData_1().getBool_array_c()[1] == false);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:20\", getData_1().getInt8_array_c()[0] == 24 && getData_1().getInt8_array_c()[1] == 48);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:21\", getData_1().getInt16_array_c()[0] == 48 && getData_1().getInt16_array_c()[1] == 96);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:22\", getData_1().getInt32_array_c()[0] == 96 && getData_1().getInt32_array_c()[1] == 192);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:23\", getData_1().getInt64_array_c()[0] == 192 && getData_1().getInt64_array_c()[1] == 384);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:24\", getData_1().getFloat32_array_c()[0] == 9.6f && getData_1().getFloat32_array_c()[1] == 19.2f);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:25\", getData_1().getFloat64_array_c()[0] == 19.2 && getData_1().getFloat64_array_c()[1] == 38.4);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:26\", String.valueOf(getData_1().getChar_array_c()).equals(\"Claz\"));"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:27\", getData_1().getBool_array_i()[0] == true && getData_1().getBool_array_i()[1] == true);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:28\", getData_1().getInt8_array_i()[0] == 2 && getData_1().getInt8_array_i()[1] == 6);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:29\", getData_1().getInt16_array_i()[0] == 4 && getData_1().getInt16_array_i()[1] == 12);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:30\", getData_1().getInt32_array_i()[0] == 8 && getData_1().getInt32_array_i()[1] == 24);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:31\", getData_1().getInt64_array_i()[0] == 16 && getData_1().getInt64_array_i()[1] == 48);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:32\", getData_1().getFloat32_array_i()[0] == 1.6f && getData_1().getFloat32_array_i()[1] == 4.8f);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:33\", getData_1().getFloat64_array_i()[0] == 5 && getData_1().getFloat64_array_i()[1] == 15);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:34\", String.valueOf(getData_1().getChar_array_i()).equals(\"Inst\"));"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:35\", getData_1().getData_2().getInt32_c() == 42);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:36\", getData_1().getData_2().getInt32_i() == 43);"
+ "etUnit_testFinished(caseId);"
+ }
+ }
+ }
+ }
+ }
+
+ ActorClass Testee_Super2_ac {
+ Interface {
+ Port reg_port: TestProtocol
+ }
+ Structure {
+ external Port reg_port
+ Attribute caseId: int32
+
+ // test
+ Attribute data_2: Data_2_dc
+ Attribute float64_super_r: float64 = "1.1"
+ Attribute float64_super_c: float64 = "1.1"
+ Attribute float64_super_i: float64 = "1.1"
+ }
+ Behavior {
+ Operation Testee_Super2_ac() {
+ "caseId = etUnit_openTestCase(\"AttrConfigTest_case_Testee_Super2_ac\");"
+ }
+ Operation ~Testee_Super2_ac() {
+ "etUnit_closeTestCase(caseId);"
+ }
+ }
+ }
+
+ ActorClass Testee_2_ac extends Testee_Super2_ac {
+ Structure {
+ SAP sap: TestProtocolWithDataClass
+ Attribute int32_own_r: int32 = "11"
+ Attribute int32_own_c: int32 = "11"
+ Attribute int32_own_i: int32 = "11"
+ }
+ Behavior {
+ Operation Testee_2_ac() {
+ "caseId = etUnit_openTestCase(\"AttrConfigTest_case_Testee_2_ac\");"
+ "etUnit_testFinished(caseId);"
+ }
+ Operation ~Testee_2_ac() {
+ "etUnit_closeTestCase(caseId);"
+ }
+ StateMachine {
+ Transition init: initial -> s1 { }
+ State s1 {
+ entry {
+ "sap.varCheck(caseId);"
+ "reg_port.varCheck(caseId);"
+
+ "EXPECT_TRUE(caseId, \"Testee_2_ac:1\", float64_super_c == 2.2);"
+ "EXPECT_TRUE(caseId, \"Testee_2_ac:2\", float64_super_i == 4.4);"
+ "EXPECT_TRUE(caseId, \"Testee_2_ac:3\", int32_own_r == 11);"
+ "EXPECT_TRUE(caseId, \"Testee_2_ac:4\", int32_own_c == 12);"
+ "EXPECT_TRUE(caseId, \"Testee_2_ac:5\", int32_own_i == 13);"
+ "EXPECT_EQUAL_FLOAT32(caseId,\"Testee_2_ac:reg_port:6\", 50.f, reg_port.getFloat_i(), 0.1f);"
+ "etUnit_testFinished(caseId);"
+ }
+ }
+ }
+ }
+ }
+
+ ProtocolClass TestProtocol {
+ incoming {
+ Message dummy()
+ }
+ regular PortClass
+ {
+ Attribute float_r: float32 = "4"
+ Attribute float_c: float32 = "16"
+ Attribute float_i: float32 = "256"
+ Operation varCheck(caseId: int32): void {
+ "EXPECT_EQUAL_FLOAT32(caseId,\"TestProtocol:1\", 4.f, float_r, 0.1f);"
+ "EXPECT_EQUAL_FLOAT32(caseId,\"TestProtocol:2\", 3.f, float_c, 0.1f);"
+ }
+ }
+ conjugate PortClass
+ {
+ Attribute array2_r [ 2 ]: int64 = "{11,22}"
+ Attribute array2_c [ 2 ]: int64 = "{0,0}"
+ Attribute array2_i [ 2 ]: int64 = "{0,0}"
+ Operation varCheck(): void {
+ "int caseId = etUnit_openTestCase(\"ConfigTest_case_PortProtocol_conjugated\");"
+ "EXPECT_TRUE(caseId,\"array2_r[0]: <|MODEL_LOCATION|>\", array2_r[0] == 11);"
+ "EXPECT_TRUE(caseId,\"array2_r[1]: <|MODEL_LOCATION|>\", array2_r[1] == 22);"
+ "EXPECT_TRUE(caseId,\"array2_c[0]: <|MODEL_LOCATION|>\", array2_c[0] == 16);"
+ "EXPECT_TRUE(caseId,\"array2_c[1]: <|MODEL_LOCATION|>\", array2_c[1] == 32);"
+ "EXPECT_TRUE(caseId,\"array2_i[0]: <|MODEL_LOCATION|>\", array2_i[0] == 1);"
+ "EXPECT_TRUE(caseId,\"array2_i[1]: <|MODEL_LOCATION|>\", array2_i[1] == 2);"
+ "etUnit_testFinished(caseId);"
+ }
+ }
+ }
+
+ ProtocolClass TestProtocolWithDataClass {
+ incoming {
+ Message dummy()
+ }
+
+ //SAP
+ conjugate PortClass
+ {
+ Attribute sap_data_2: Data_2_dc
+
+ // none config test
+ Attribute sap_data_3: Data_3_dc
+ Operation varCheck(caseId: int32): void {
+ "sap_data_2.varCheck2(caseId);"
+ "sap_data_3.varCheck3(caseId);"
+ "EXPECT_TRUE(caseId, \"TestProtocolWithDataClass:1\", getSap_data_2().getInt32_c() == 2);"
+ "EXPECT_TRUE(caseId, \"TestProtocolWithDataClass:1\", getSap_data_2().getInt32_i() == 3);"
+ }
+ }
+ }
+
+ ExternalType extType -> External_Type_Test
+
+ DataClass Data_Super1_dc {
+
+ // PrimitiveType
+ Attribute bool_r: boolean = "falSe"
+ Attribute bool_c: boolean = "false"
+ Attribute bool_i: boolean = "false"
+ Attribute int8_r: int8 = "8"
+ Attribute int8_c: int8 = "8"
+ Attribute int8_i: int8 = "8"
+
+ // Array
+ Attribute bool_array_r [ 2 ]: boolean = "{ FALSE, false }"
+ Attribute bool_array_c [ 2 ]: boolean = "{ false, false }"
+ Attribute bool_array_i [ 2 ]: boolean = "{ false, false }"
+ Attribute int8_array_r [ 2 ]: int8 = "{ 8, 16 }"
+ Attribute int8_array_c [ 2 ]: int8 = "{ 8, 16 }"
+ Attribute int8_array_i [ 2 ]: int8 = "{ 8, 16 }"
+ }
+
+ DataClass Data_1_dc extends Data_Super1_dc {
+
+ Attribute int16_r: int16 = "16"
+ Attribute int16_c: int16 = "16"
+ Attribute int16_i: int16 = "16"
+ Attribute int32_r: int32 = "32"
+ Attribute int32_c: int32 = "32"
+ Attribute int32_i: int32 = "32"
+ Attribute int64_r: int64 = "64"
+ Attribute int64_c: int64 = "64"
+ Attribute int64_i: int64 = "64"
+ Attribute float32_r: float32 = "3.2"
+ Attribute float32_c: float32 = "3.2"
+ Attribute float32_i: float32 = "3.2"
+ Attribute float64_r: float64 = "6.4"
+ Attribute float64_c: float64 = "6.4"
+ Attribute float64_i: float64 = "6.4"
+ Attribute char_r: char = "R"
+ Attribute char_c: char = 'R'
+ Attribute char_i: char = "R"
+ Attribute string_r: string = ":/"
+ Attribute string_c: string = ":/"
+ Attribute string_i: string = ":/"
+
+ // Array
+ Attribute int16_array_r [ 2 ]: int16 = "{ 16, 32 }"
+ Attribute int16_array_c [ 2 ]: int16 = "{ 16, 32 }"
+ Attribute int16_array_i [ 2 ]: int16 = "{ 16, 32 }"
+ Attribute int32_array_r [ 2 ]: int32 = "{ 32, 64 }"
+ Attribute int32_array_c [ 2 ]: int32 = "{ 32, 64 }"
+ Attribute int32_array_i [ 2 ]: int32 = "{ 32, 64 }"
+ Attribute int64_array_r [ 2 ]: int64 = "{ 64, 128 }"
+ Attribute int64_array_c [ 2 ]: int64 = "{ 64, 128 }"
+ Attribute int64_array_i [ 2 ]: int64 = "{ 64, 128 }"
+ Attribute float32_array_r [ 2 ]: float32 = "{ 3.2, 6.4 }"
+ Attribute float32_array_c [ 2 ]: float32 = "{ 3.2, 6.4 }"
+ Attribute float32_array_i [ 2 ]: float32 = "{ 3.2, 6.4 }"
+ Attribute float64_array_r [ 2 ]: float64 = "{ 6.4, 12.8 }"
+ Attribute float64_array_c [ 2 ]: float64 = "{ 6.4, 12.8 }"
+ Attribute float64_array_i [ 2 ]: float64 = "{ 6.4, 12.8 }"
+ Attribute char_array_r [ 5 ]: char = "ROOM"
+ Attribute char_array_c [ 5 ]: char = "ROOM"
+ Attribute char_array_i [ 5 ]: char = "ROOM"
+
+ // ComplexType
+ Attribute data_2: Data_2_dc
+ Operation varCheck1(caseId: int32) {
+ "data_2.varCheck2(caseId);"
+
+ // PrimitiveType
+ "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:1\", bool_r == false);"
+ "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:2\", int8_r == 8);"
+ "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:3\", int16_r == 16);"
+ "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:4\", int32_r == 32);"
+ "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:5\", int64_r == 64);"
+ "EXPECT_EQUAL_FLOAT32(caseId,\"Data_1_dc:varCheck:6\", 3.2f, float32_r, 0.1f);"
+ "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:7\", float64_r == 6.4);"
+ "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:8\", char_r == \'R\');"
+ "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:9\", string_r.equals(\":/\"));"
+
+ // Array
+ "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:10\", bool_array_r[0] == false && bool_array_r[1] == false);"
+ "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:11\", int8_array_r[0] == 8 && int8_array_r[1] == 16);"
+ "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:12\", int16_array_r[0] == 16 && int16_array_r[1] == 32);"
+ "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:13\", int32_array_r[0] == 32 && int32_array_r[1] == 64);"
+ "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:24\", int64_array_r[0] == 64 && int64_array_r[1] == 128);"
+ "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:25\", float32_array_r[0] == 3.2f && float32_array_r[1] == 6.4f);"
+ "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:26\", float64_array_r[0] == 6.4 && float64_array_r[1] == 12.8);"
+ "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:27\", String.valueOf(char_array_r).equals(\"ROOM\"));"
+ }
+ }
+
+ DataClass Data_2_dc {
+ Attribute int32_r: int32 = "1"
+ Attribute int32_c: int32 = "1"
+ Attribute int32_i: int32 = "1"
+ Operation varCheck2(caseId: int32): void {
+ "EXPECT_TRUE(caseId, \"Data_2_dc:1\", int32_r == 1);"
+ }
+ }
+
+ DataClass Data_3_dc {
+
+ // none config test
+ Attribute dataClass_array [ 2 ]: Data_2_dc
+ Attribute dataClass_ref: Data_2_dc ref
+ Attribute dataClass_ref_array [ 2 ]: Data_2_dc ref
+ Attribute ext_type: extType
+ Attribute ext_type_array [ 2 ]: extType
+ Attribute ext_type_ref: extType ref
+ Attribute ext_type_ref_array [ 2 ]: extType ref
+ Operation varCheck3(caseId: int32): void {
+ //TODO dataClass_array
+ "EXPECT_TRUE(caseId, \"Data_3_dc:1\", dataClass_ref == null);"
+ "EXPECT_TRUE(caseId, \"Data_3_dc:1\", dataClass_ref_array[0] == null && dataClass_ref_array[1] == null);"
+ "EXPECT_TRUE(caseId, \"Data_3_dc:1\", ext_type instanceof External_Type_Test);"
+ "EXPECT_TRUE(caseId, \"Data_3_dc:1\", ext_type_array[0] instanceof External_Type_Test && ext_type_array[1] instanceof External_Type_Test);"
+ "EXPECT_TRUE(caseId, \"Data_3_dc:1\", ext_type_ref_array[0] == null && ext_type_ref_array[1] == null);"
+ }
+ }
+
+} \ No newline at end of file