Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 9f92417e7682062fe280996d0f02471f5e3ee033 (plain) (blame)
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
RoomModel ChoicePointTest {

	import etrice.api.types.int16
	import etrice.api.types.int32
	import etrice.api.annotations.TestInstance

	ActorClass CPTest_Top {
		@TestInstance
		Structure {
			ActorRef cp_tester: CPTester
			ActorRef cp_user: CPUser
			Binding cp_tester.TestPort1 and cp_user.TestPort1
		}
		Behavior {
		}
	}

	ActorClass CPUser {
		Interface {
			Port TestPort1: TestProtocol
		}
		Structure {
			external Port TestPort1
			Attribute counter: int32
			Attribute caseId: int32
			Attribute resultlist [29]: int16 = "{1,2,3,4,5,6,3,4,5,7,8,10,11,12,9,16,3,4,5,17,8,13,15,11,19,12,9,18,20}"
		}
		Behavior {
			ctor '''caseId = etUnit_openAll("log", "ChoicePointTest", "org.eclipse.etrice.generator.common.tests.ChoicePointTest", "ChoicePointTest_case");'''
			dtor '''etUnit_closeAll(caseId);'''
			StateMachine {
				Transition init: initial -> cp cp0 {
					action '''
						counter = 0;
						EXPECT_ORDER_START(caseId,resultlist,29);
						EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 1);'''
				}
				Transition tr4: cp cp0 -> ENTRY3_EXIT4 {
					action '''EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0);'''
				}
				Transition EXPECT2: cp cp0 -> ENTRY3_EXIT4 {
					cond '''counter == 0'''
					action '''EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 2);'''
				}
				Transition EXPECT5: ENTRY3_EXIT4 -> cp cp1 {
					triggers {
						<msg1: TestPort1>
					}
					action '''EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 5);'''
				}
				Transition EXPECT6: cp cp1 -> ENTRY3_EXIT4 {
					action '''
						counter=3;
						EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 6);'''
				}
				Transition EXPECT17: cp cp1 -> tp0 of ENTRY8_EXIT9 {
					cond '''counter == 4'''
					action '''EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 17);'''
				}
				Transition EXPECT7: cp cp1 -> ENTRY8_EXIT9 {
					cond '''counter == 3'''
					action '''
						counter = 1;
						EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 7);'''
				}
				Transition EXPECT16: ENTRY8_EXIT9 -> ENTRY3_EXIT4 {
					triggers {
						<msg1: TestPort1 guard '''counter==1'''>
					}
					action '''
						counter=4;
						EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 16);'''
				}
				Transition EXPEXT19: my tp0 -> my tp0 {
					triggers {
						<msg1: TestPort1>
					}
					action '''
						counter = 2;
						EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 19);'''
				}
				Transition EXPECT18: ENTRY8_EXIT9 -> testOk {
					triggers {
						<msg1: TestPort1 guard '''counter==2'''>
					}
					action '''EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 18);'''
				}
				Transition tr0: ENTRY3_EXIT4 -> cp cp1 {
					triggers {
						<msg2: TestPort1>
					}
				}
				ChoicePoint cp0
				ChoicePoint cp1
				handler TransitionPoint tp0
				State ENTRY3_EXIT4 {
					entry '''EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 3);'''
					exit '''EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 4);'''
				}
				State ENTRY8_EXIT9 {
					entry '''EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 8);'''
					exit '''EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 9);'''
					subgraph {
						Transition EXPECT13: my tp0 -> cp cp0 {
							action '''EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 13);'''
						}
						Transition EXPECT14: cp cp0 -> ENTRY11_EXIT12 {
							action '''EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 14);'''
						}
						Transition EXPECT15: cp cp0 -> ENTRY11_EXIT12 {
							cond '''counter == 4'''
							action '''EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 15);'''
						}
						Transition init: initial -> ENTRY11_EXIT12 {
							action '''EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 10);'''
						}
						ChoicePoint cp0
						EntryPoint tp0
						State ENTRY11_EXIT12 {
							entry '''EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 11);'''
							exit '''EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 12);'''
						}
					}
				}
				State testOk {
					entry '''
						EXPECT_ORDER_END(caseId,"<|MODEL_LOCATION|>", 20);
						etUnit_testFinished(caseId);'''
				}
			}
		}
	}

	ActorClass CPTester {
		Interface {
			conjugated Port TestPort1: TestProtocol
		}
		Structure {
			external Port TestPort1
		}
		Behavior {
			StateMachine {
				Transition init: initial -> state0 {
					action '''
						TestPort1.msg1(1);
						TestPort1.msg1(2);
						TestPort1.msg1(3);
						TestPort1.msg1(4);
						TestPort1.msg1(5);
						TestPort1.msg1(6);'''
				}
				State state0
			}
		}
	}

	ProtocolClass TestProtocol {
		incoming {
			Message msg1(int32)
			Message msg2(int32)
			Message msg3(int32)
			Message msg4(int32)
			Message msg5(int32)
		}
	}
}

Back to the top