conformance_test/positive_tests added
[deliverable/titan.core.git] / conformance_test / positive_tests / 06_types_and_values / 0602_structured_types_and_values / 060210_component_types / 06021002_reuse_component_type / Sem_060210_ReuseofComponentTypes_002.ttcn
1 /******************************************************************************
2 * Copyright (c) 2000-2016 Ericsson Telecom AB
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Adrien Kirjak – initial implementation
10 *
11 ** @version 0.0.1
12 ** @purpose 1:6.2.10, Ensure that extending a component with several other component works properly
13 ** @verdict pass accept, ttcn3verdict:pass
14 *****************************************************************/
15
16 /* The following requirements are tested:
17 * When defining component types by extending more than one parent type,
18 * there shall be no name clash between the definitions of the different parent types,
19 * i.e. there shall not be a port, variable, constant or timer identifier that is declared
20 * in any two of the parent types (directly or by means of extension).
21 */
22
23 module Sem_060210_ReuseofComponentTypes_002 {
24
25 //MyCompA has a port pt_myPortA
26 type component MyCompA {
27 port loopbackPort pt_myPortA;
28 }
29
30 //MyComp has a port pt_myPortB
31 type component MyCompB {
32 port loopbackPort pt_myPortB;
33 }
34
35 //Component GeneralComp has a timer and inherit two ports from MyCompA and MyCompB
36 type component GeneralComp extends MyCompA, MyCompB {
37 timer t;
38 }
39
40 type port loopbackPort message {
41 inout integer;
42 inout float;
43 } with {extension "internal"}
44
45 function loopback() runs on GeneralComp {
46 var integer v_i;
47 var float v_f;
48 while (true) {
49 alt {
50 [] pt_myPortA.receive(integer:?) -> value v_i { pt_myPortA.send(v_i); }
51 [] pt_myPortA.receive(float:?) -> value v_f { pt_myPortA.send(v_f); }
52 [] pt_myPortB.receive(integer:?) -> value v_i { pt_myPortB.send(v_i); }
53 [] pt_myPortB.receive(float:?) -> value v_f { pt_myPortB.send(v_f); }
54 }
55 }
56 }
57
58 testcase TC_Sem_060210_ReuseofComponentTypes_002() runs on GeneralComp {
59
60 var GeneralComp v_server := GeneralComp.create;
61
62 connect(mtc:pt_myPortA, v_server:pt_myPortA);
63 connect(mtc:pt_myPortB, v_server:pt_myPortB);
64
65 v_server.start(loopback());
66
67 //Send an integer from pt_myPortA:
68 pt_myPortA.send(2);
69 alt {
70 [] pt_myPortA.receive(2) {
71 setverdict(pass,"Receive successful");
72 }
73 [] pt_myPortA.receive {
74 setverdict(fail,"Unexpected result");
75 }
76 }
77
78 //Send an integer from pt_myPortB:
79 pt_myPortB.send(1.0);
80 alt {
81 [] pt_myPortB.receive(1.0) {
82 setverdict(pass,"Receive successful");
83 }
84 [] pt_myPortB.receive {
85 setverdict(fail,"Unexpected result");
86 }
87 }
88
89 }
90
91 control{
92 execute(TC_Sem_060210_ReuseofComponentTypes_002());
93 }
94 }
This page took 0.033216 seconds and 5 git commands to generate.