/***************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:6.2.12, Ensure that address type cannot be used in a sender part of receive operation with connected ports
 ** @verdict  pass reject
 ***************************************************/

/* The following requirements are tested:
 * Restrictions c)	The address data type shall not be used in the to,
 * from and sender parts of receive and send operations of connected ports,
 * i.e, ports used for the communication among test components.*/


module NegSem_060212_AddressingEntitiesInsideSut_003 {

    type integer MyAddress;
    type integer MyMessType;
    type integer address;


    type port PortType message {
        address MyAddress;
        inout MyMessType;
    }

    type component TestCaseComp {
        port PortType p;
    }

		function Sendmessage() runs on TestCaseComp
	{
		if(p.checkstate("Connected")) {
			 p.send(MyMessType: 1) to mtc;
        } else {
			setverdict(fail,"Not connected");
		}
	}



    testcase TC_NegSem_060212_AddressingEntitiesInsideSut_003() runs on TestCaseComp system TestCaseComp {

        var TestCaseComp v_ptcA := TestCaseComp.create alive;

        var address MyAddr := 1;

        connect(mtc:p, v_ptcA:p);

       	v_ptcA.start(Sendmessage());


         p.receive(MyMessType:1) -> sender MyAddr;    //error: address type is allowed in sender part receive operation

        setverdict(pass);
    }

    control {
        execute(TC_NegSem_060212_AddressingEntitiesInsideSut_003());
    }
}