/***************************************************
 ** @author   STF 451
 ** @version  0.0.1
 ** @purpose  1:9, Ensure that the IUTs two ports are mapped correctly to system interfaces
 ** @verdict  pass accept, ttcn3verdict:pass
 ***************************************************/

//Two ports are mapped to two system interface
module Sem_0902_Communication_ports_002{

 type port loopbackPort message {
	  inout integer
		}
 type port MyMessagePortType message {
	  inout integer
		}

type component GeneralComp
{
var integer v_received1:=0;
var integer v_received2:=0;
port MyMessagePortType myPortA,myPortB
}

type component MyTestSystemInterface
	{
 	port loopbackPort messagePortA,messagePortB
	}

// MyTestSystemInterface is the test system interface
testcase TC_Sem_0902_Communication_ports_002() runs on GeneralComp system MyTestSystemInterface {
// establishing the port connections
map(mtc:myPortA, system:messagePortA);
map(mtc:myPortB, system:messagePortB);


 myPortA.send(2);  //can send also in-line template
 myPortB.send(3);

    myPortA.receive(integer:?) -> value v_received1 ;
    myPortB.receive(integer:?) -> value v_received2 ;

    if ((v_received1+v_received2)==5)
    {
        setverdict(pass);
     }
     else
     {
        setverdict(fail);
     }
}

control{
    execute(TC_Sem_0902_Communication_ports_002());
}

}
