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
9 * Adrien Kirjak – initial implementation
12 ** @purpose 1:6.2.10, Ensure that extending a component with several other component works properly
13 ** @verdict pass accept, ttcn3verdict:pass
14 *****************************************************************/
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).
23 module Sem_060210_ReuseofComponentTypes_002 {
25 //MyCompA has a port pt_myPortA
26 type component MyCompA {
27 port loopbackPort pt_myPortA;
30 //MyComp has a port pt_myPortB
31 type component MyCompB {
32 port loopbackPort pt_myPortB;
35 //Component GeneralComp has a timer and inherit two ports from MyCompA and MyCompB
36 type component GeneralComp extends MyCompA, MyCompB {
40 type port loopbackPort message {
43 } with {extension "internal"}
45 function loopback() runs on GeneralComp {
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); }
58 testcase TC_Sem_060210_ReuseofComponentTypes_002() runs on GeneralComp {
60 var GeneralComp v_server := GeneralComp.create;
62 connect(mtc:pt_myPortA, v_server:pt_myPortA);
63 connect(mtc:pt_myPortB, v_server:pt_myPortB);
65 v_server.start(loopback());
67 //Send an integer from pt_myPortA:
70 [] pt_myPortA.receive(2) {
71 setverdict(pass,"Receive successful");
73 [] pt_myPortA.receive {
74 setverdict(fail,"Unexpected result");
78 //Send an integer from pt_myPortB:
81 [] pt_myPortB.receive(1.0) {
82 setverdict(pass,"Receive successful");
84 [] pt_myPortB.receive {
85 setverdict(fail,"Unexpected result");
92 execute(TC_Sem_060210_ReuseofComponentTypes_002());