Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: e0176bf1ae16dc26d47b4c280546c41efdb74afd (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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
RoomModel SendingDataTestC {

	import room.basic.types.* from "Types.room"
	import room.basic.language.* from "Language.room"

	SubSystemClass SubSystem_SendingData {
		ActorRef top: SendingDataTop
	
		LogicalThread dflt_thread
	}

	ActorClass SendingDataTop {
		Structure {
			ActorRef mrPing: MrPing
			ActorRef mrPong: MrPong
			Binding mrPong.PingPongPort and mrPing.PingPongPort
		}
		Behavior { }
	}

	ActorClass MrPong {
		Interface {
			Port PingPongPort: PingPongProtocol
		}
		Structure {
			external Port PingPongPort
		}
		Behavior {
			StateMachine {
				Transition tr0: reply -> reply {
					triggers {
						<pingInt16: PingPongPort>
					}
					action {
						"PingPongPort.pongInt16(d);"
					}
				}
				Transition tr1: reply -> reply {
					triggers {
						<pingInt8: PingPongPort>
					}
					action {
						"PingPongPort.pongInt8(d);"
					}
				}
				Transition init: initial -> reply { }
				Transition tr2: reply -> reply {
					triggers {
						<pingInt32: PingPongPort>
					}
					action {
						"PingPongPort.pongInt32(d);"
					}
				}
				Transition tr3: reply -> reply {
					triggers {
						<pingFloat32: PingPongPort>
					}
					action {
						"PingPongPort.pongFloat32(d);"
					}
				}
				Transition tr4: reply -> reply {
					triggers {
						<pingFloat64: PingPongPort>
					}
					action {
						"PingPongPort.pongFloat64(d);"
					}
				}
				Transition tr7: reply -> cp cp0 {
					triggers {
						<pingInt32Ref: PingPongPort guard {
							"(*d)!=0"
						}>
					}
				}
				Transition tr8: cp cp0 -> reply {
					action {
						"PingPongPort.pongInt32((*d)+10);"
					}
				}
				Transition tr6: cp cp0 -> reply {
					cond {
						"(*d)!=5"
					}
					action {
						"PingPongPort.pongInt32(*d);"
					}
				}
				Transition tr9: reply -> reply {
					triggers {
						<pingComplex: PingPongPort>
					}
					action {
						"PingPongPort.pongComplex(d);"
					}
				}
				Transition tr11: reply -> reply {
					triggers {
						<pingComplexRef: PingPongPort>
					}
					action {
						"PingPongPort.pongComplex(d);"
					}
				}
				Transition tr5: reply -> reply {
					triggers {
						<pingInt64: PingPongPort>
					}
					action {
						"PingPongPort.pongInt64(d);"
					}
				}
				Transition tr10: reply -> reply {
					triggers {
						<pingInt16Ref: PingPongPort>
					}
					action {
						"PingPongPort.pongInt16(*d);"
					}
				}
				Transition tr12: reply -> cp cp1 {
					triggers {
						<pingComplexRef: PingPongPort guard {
							"d->i8ValPPD == 5"
						}>
					}
					action {
						"PingPongPort.pongComplex(d);"
					}
				}
				Transition tr13: cp cp1 -> reply {
					action {
						"PingPongPort.pongComplex(d);"
					}
				}
				Transition tr14: cp cp1 -> reply {
					cond {
						"d->i8ValPPD==7"
					}
					action {
						"PingPongPort.pongComplex(d);"
					}
				}
				Transition tr15: reply -> reply {
					triggers {
						<pingComplexDerived: PingPongPort>
					}
					action {
						"PingPongPort.pongComplexDerived(d);"
					}
				}
				ChoicePoint cp0
				ChoicePoint cp1
				State reply
			}
		}
	}

	ActorClass MrPing {
		Interface {
			conjugated Port PingPongPort: PingPongProtocol
		}
		Structure {
			external Port PingPongPort
			Attribute i8Val: int8="5"
			Attribute i16Val:int16="19"
			Attribute i32Val: int32 = "4711"
			Attribute i64Val: int64 = "11470815"
			Attribute i32Array [ 10 ]: int32="{0,1,2,3,4,5,6,7,8,9}"
			Attribute f32Val: float32="3.14f"
			Attribute f64Val: float64="7.987654321"
			Attribute data: PingPongData
			Attribute dataD: PingPongDataDerived
			Attribute counter:int32
			Attribute caseId: int32
			Attribute lang: languageIndicator
			Attribute resultlist [ 23 ]: int16 = "{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23}"
		}
		Behavior {
			StateMachine {
				Transition init: initial -> tp0 of state0 {
					action {
						"caseId = etUnit_openAll(\"tmp\", \"SendingDataTestC\", \"org.eclipse.etrice.generator.common.tests.SendingDataTest\", \"SendingDataTest_case\");"
						"EXPECT_ORDER_START(caseId,resultlist,23);"
						"EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 1);"
						"/* send the default values */"
						""
						"PingPongPort.pingInt8(i8Val);"
						"PingPongPort.pingInt16(i16Val);"
						"PingPongPort.pingInt32(i32Val);"
						"PingPongPort.pingInt64(i64Val);"
						"PingPongPort.pingFloat32(f32Val);"
						"PingPongPort.pingFloat64(f64Val);"
						"PingPongPort.pingInt16Ref(&i16Val);"
						"PingPongPort.pingInt32Ref(&i32Val);"
						"i8Val++;"
						"i16Val++;"
						"i32Val++;"
						"i64Val++;"
						"f32Val+=10.1;"
						"f64Val+=20.2;"
						"PingPongPort.pingInt8(i8Val);"
						"PingPongPort.pingInt16(i16Val);"
						"PingPongPort.pingInt32(i32Val);"
						"PingPongPort.pingInt64(i64Val);"
						"PingPongPort.pingFloat32(f32Val);"
						"PingPongPort.pingFloat64(f64Val);"
						"PingPongPort.pingInt16Ref(&i16Val);"
						"PingPongPort.pingInt32Ref(&i32Val);"
					}
				}
				Transition tr0: tp1 of state0 -> tp0 of state1
				Transition tr1: tp1 of state1 -> test_finished
				State state0 {
					subgraph {
						Transition tr0: my tp0 -> receiveFirst7 {
							action {
								"counter=0;"
							}
						}
						Transition tr1: receiveFirst7 -> receiveFirst7 {
							triggers {
								<pongInt8: PingPongPort>
							}
							action {
								"counter++;"
								"if (d==5){"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 2);"
								"}else{"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);"
								"}"
							}
						}
						Transition tr2: receiveFirst7 -> receiveFirst7 {
							triggers {
								<pongInt16: PingPongPort>
							}
							action {
								"counter++;"
								"if (d==19){"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 3);"
								"}else{"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);"
								"}"
							}
						}
						Transition tr3: receiveFirst7 -> receiveFirst7 {
							triggers {
								<pongInt32: PingPongPort>
							}
							action {
								"counter++;"
								"if (d==4711){"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 4);"
								"}else{"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);"
								"}"
							}
						}						
						Transition tr4: receiveFirst7 -> receiveSecond7 {
							triggers {
								<pongInt32: PingPongPort guard {
									"counter==7"
								}>
							}
							action {
								"counter=0;"
								"if (lang == 1){"
								"/* Java cannot send references of primitive types */"
								"\tif (d==4711){\t"
								"\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 9);"
								"\t}else{"
								"\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);"
								"\t}"
								"} "
								"if (lang == 2){"
								"/* C */"
								"\tif (d==4712){\t"
								"\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 9);"
								"\t}else{"
								"\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);"
								"\t}"
								"}"
							}
						}
						Transition tr6: receiveFirst7 -> receiveFirst7 {
							triggers {
								<pongInt64: PingPongPort>
							}
							action {
								"counter++;"
								"if (d==11470815){"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 5);"
								"}else{"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);"
								"}"
							}
						}
						Transition tr5: receiveFirst7 -> receiveFirst7 {
							triggers {
								<pongFloat32: PingPongPort>
							}
							action {
								"counter++;"
								"if ((d>3)&&(d<4)){"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 6);"
								"}else{"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);"
								"}"
							}
						}
						Transition tr7: receiveFirst7 -> receiveFirst7 {
							triggers {
								<pongFloat64: PingPongPort>
							}
							action {
								"counter++;"
								"if ((d>7)&&(d<8)){"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 7);"
								"}else{"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);"
								"}"
							}
						}
						Transition tr8: receiveSecond7 -> receiveSecond7 {
							triggers {
								<pongInt8: PingPongPort>
							}
							action {
								"counter++;"
								"if (d==6){"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 10);"
								"}else{"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);"
								"}"
							}
						}
						Transition tr9: receiveSecond7 -> receiveSecond7 {
							triggers {
								<pongInt16: PingPongPort>
							}
							action {
								"counter++;"
								"if (d==20){"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 11);"
								"}else{"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);"
								"}"
							}
						}
						Transition tr10: receiveSecond7 -> receiveSecond7 {
							triggers {
								<pongInt32: PingPongPort>
							}
							action {
								"counter++;"
								"if (d==4712){"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 12);"
								"}else{"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);"
								"}"
							}
						}
						Transition tr11: receiveSecond7 -> receiveSecond7 {
							triggers {
								<pongInt64: PingPongPort>
							}
							action {
								"counter++;"
								"if (d==11470816){"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 13);"
								"}else{"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);"
								"}"
							}
						}
						Transition tr12: receiveSecond7 -> receiveSecond7 {
							triggers {
								<pongFloat32: PingPongPort>
							}
							action {
								"counter++;"
								"if ((d>13)&&(d<14)){"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 14);"
								"}else{"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);"
								"}"
							}
						}
						Transition tr13: receiveSecond7 -> receiveSecond7 {
							triggers {
								<pongFloat64: PingPongPort>
							}
							action {
								"counter++;"
								"if ((d>28)&&(d<29)){"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 15);"
								"}else{"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);"
								"}"
							}
						}
						Transition tr14: receiveSecond7 -> my tp1 {
							triggers {
								<pongInt32: PingPongPort guard {
									"counter==7"
								}>
							}
							action {
								"if (d==4712){\t"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 17);"
								"}else{"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);"
								"}"
							}
						}
						Transition tr15: receiveFirst7 -> receiveFirst7 {
							triggers {
								<pongInt16: PingPongPort guard {
									"counter==6"
								}>
							}
							action {
								"counter++;"
								"if (lang == 1){"
								"/* Java cannot send references of primitive types */"
								"\tif (d==19){\t"
								"\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 8);"
								"\t}else{"
								"\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);"
								"\t}"
								"} "
								"if (lang == 2){"
								"/* C */"
								"\tif (d==20){\t"
								"\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 8);"
								"\t}else{"
								"\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);"
								"\t}"
								"}"
							}
						}
						Transition tr16: receiveSecond7 -> receiveSecond7 {
							triggers {
								<pongInt16: PingPongPort guard {
									"counter==6"
								}>
							}
							action {
								"counter++;"
								"if (d==20){\t"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 16);"
								"}else{"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);"
								"}"
							}
						}
						EntryPoint tp0
						ExitPoint tp1
						State receiveFirst7
						State receiveSecond7
					}
				}
				State test_finished {
					entry {
						"EXPECT_ORDER_END(caseId,\"<|MODEL_LOCATION|>\", 23);"
						"etUnit_closeAll(caseId);"
						"etUnit_testFinished(caseId);"
					}
				}
				State state1 {
					subgraph {
						Transition tr0: my tp0 -> state0 {
							action {
								"counter=0;"
								"/* send default values */"
								"PingPongPort.pingComplex(&(data));"
								"PingPongPort.pingComplexRef(&(data));"
							}
						}
						Transition tr1: state0 -> state1 {
							triggers {
								<pongComplex: PingPongPort guard {
									"counter==1"
								}>
							}
							action {
								"counter=0;"
								"if (d->i8ValPPD==10){"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 19);"
								"}else{"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);"
								"}"
								""
								"if (d->complexVal.i32Val2PPDD==80){"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 20);"
								"}else{"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);"
								"}"
								""
								"dataD.i8ValPPD=11;"
								"PingPongPort.pingComplexDerived(&(dataD));"
							}
						}
						Transition tr2: state0 -> state0 {
							triggers {
								<pongComplex: PingPongPort>
							}
							action {
								"counter++;"
								"if (d->i8ValPPD==10){"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 18);"
								"}else{"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);"
								"}"
							}
						}
						Transition tr3: state1 -> my tp1 {
							triggers {
								<pongComplexDerived: PingPongPort>
							}
							action {
								"if (d->i8ValPPD==11){"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 21);"
								"}else{"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);"
								"}"
								""
								"if (d->i32Val3PPDe==150){"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 22);"
								"}else{"
								"\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);"
								"}"
							}
						}
						EntryPoint tp0
						ExitPoint tp1
						State state0
						State state1
					}
				}
			}
		}
	}

	ProtocolClass PingPongProtocol {
		incoming {
			Message pingInt8(d: int8)
			Message pingInt16(d: int16)
			Message pingInt32(d: int32)
			Message pingInt64(d: int64)
			Message pingFloat32(d: float32)
			Message pingFloat64(d: float64)
			Message pingInt16Ref(d: int16 ref)
			Message pingInt32Ref(d: int32 ref)
			Message pingComplex(d: PingPongData)
			Message pingComplexRef(d: PingPongData ref)
			Message pingComplexDerived(d:PingPongDataDerived)
		}
		outgoing {
			Message pongInt8(d: int8)
			Message pongInt16(d: int16)
			Message pongInt32(d: int32)
			Message pongInt64(d:int64)
			Message pongFloat32(d: float32)
			Message pongFloat64(d: float64)
			Message pongComplex(d: PingPongData)
			Message pongComplexDerived(d: PingPongDataDerived)
		}
	}

	DataClass PingPongData {
		Attribute i8ValPPD: int8 = "10"
		Attribute i8ValRefPPD: int8 ref
		Attribute i32ArrayPPD [ 3 ]: int32 = "{200,300,400}"
		Attribute i8ArrayRefPPD [ 2 ]: int8 ref
		Attribute complexVal: PingPongDataDeep
	}

	DataClass PingPongDataDeep {
		Attribute i32Val1PPDD: int32
		Attribute i32Val2PPDD: int32 = "80"
	}

	DataClass PingPongDataDerived extends PingPongData {
		Attribute i32Val3PPDe: int32 = "150"
	}
}

Back to the top