/***************************************************
 ** @author   STF 470
 ** @version  0.0.1
 ** @purpose  1:21.1.2, Ensure that disconnect operation with one parameter works correctly
 ** @verdict  pass accept, ttcn3verdict:pass
 ***************************************************/

// The following requirements are tested:
// To ease disconnect ... operations related to all connections ... of ... a port, it is
// allowed to use disconnect ... operations with one argument only. This one argument
// specifies one side of the connections to be disconnected...

module Sem_210102_disconnect_and_unmap_operations_002{

    type port P message {
        inout integer
    }

    type component GeneralComp
    {
        port P p;
    }

	function checkDisconnected() runs on GeneralComp
	{
		if(not p.checkstate("Connected")) {
			setverdict(pass);
		} else {
			setverdict(fail);
		}
	}

    testcase TC_Sem_210102_disconnect_and_unmap_operations_002() runs on GeneralComp system GeneralComp {
        // components are created alive so that their connections are not destroyed when behaviour stops
		var GeneralComp v_ptc1 := GeneralComp.create alive,
			v_ptc2 := GeneralComp.create alive,
			v_ptc3 := GeneralComp.create alive;

		connect(v_ptc1:p, v_ptc2:p);
		connect(v_ptc1:p, v_ptc3:p);

		disconnect(v_ptc1:p);

		// verity that ports are really disconnected
        v_ptc2.start(checkDisconnected());
        v_ptc3.start(checkDisconnected());
		all component.done;
    }
    control{
        execute(TC_Sem_210102_disconnect_and_unmap_operations_002());
    }
}

