1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
RoomModel EnumTest {
import room.basic.types.* from "Types.room"
SubSystemClass SubSystem_EnumTest {
ActorRef actorRef1: EnumTest_Top
LogicalThread defaultThread
}
ActorClass EnumTest_Top {
Structure {
ActorRef user: EnumUser
}
Behavior { }
}
ActorClass EnumUser {
Interface {
Port prt: PC
}
Structure {
external Port prt
Attribute caseId: int32
Attribute first: FirstEnum
Attribute second: SecondEnum = "SecondEnum.two"
Attribute third: ThirdEnum
Attribute fourth: FourthEnum
Attribute fifth: FifthEnum
Attribute arrayFirst[1] : FirstEnum
Attribute arrayFourth[65] : FourthEnum = "FourthEnum.sixtyfive"
Attribute arrayFifth[2] : FifthEnum = "{ FifthEnum.f1, FifthEnum.f2}"
}
Behavior {
Operation EnumUser() {
"caseId = etUnit_openAll(\"tmp\", \"EnumTest\", \"org.eclipse.etrice.generator.common.tests.EnumTest\", \"EnumTest_case\");"
}
Operation ~EnumUser() {
"etUnit_closeAll(caseId);"
}
StateMachine {
Transition init: initial -> state0 { }
State state0 {
entry {
"EXPECT_EQUAL_INT32(caseId, \"first: initialized value\", 0, first);"
"EXPECT_EQUAL_INT32(caseId, \"second: initialized value\", 2, second);"
""
"EXPECT_EQUAL_INT32(caseId, \"arrayFirst: initialized set value\", 0, arrayFirst[0]);"
"EXPECT_EQUAL_INT32(caseId, \"arrayFouth: initialized set value\", 0x41, arrayFourth[20]);"
"EXPECT_EQUAL_INT16(caseId, \"arrayFifth: initialized set value\", (short)0x01, arrayFifth[0]);"
"EXPECT_EQUAL_INT16(caseId, \"arrayFifth: initialized set value\", (short)0x02, arrayFifth[1]);"
""
"first = FirstEnum.zero;"
"second = SecondEnum.three;"
"third = ThirdEnum.five;"
"fourth = FourthEnum.sixtyfive;"
"fifth = FifthEnum.f3;"
""
"EXPECT_EQUAL_INT32(caseId, \"first: newly set value\", 0, first);"
"EXPECT_EQUAL_INT32(caseId, \"second: newly set value\", 3, second);"
"EXPECT_EQUAL_INT32(caseId, \"third: newly set value\", 5, third);"
"EXPECT_EQUAL_INT32(caseId, \"fourth: newly set value\", 0x41, fourth);"
"EXPECT_EQUAL_INT16(caseId, \"fifth: newly set value\", (short)0x4, fifth);"
""
"etUnit_testFinished(caseId);"
}
}
}
}
}
ProtocolClass PC {
incoming {
Message m1(d: FirstEnum)
}
}
Enumeration FirstEnum {
zero, one, two, three
}
Enumeration SecondEnum {
one=1, two, three
}
Enumeration ThirdEnum {
one=1, two, five=5
}
Enumeration FourthEnum {
one=1, three=3, sixtyfive=0x41
}
Enumeration FifthEnum of int16 {
f1=0x1, f2=0x2, f3=0x4, f4=0x8
}
}
|