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

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

module Sem_210102_disconnect_and_unmap_operations_005 {

    type port P message {
        inout integer
    }

    type component GeneralComp
    {
        port P p;
    }

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

    testcase TC_Sem_210102_disconnect_and_unmap_operations_005() runs on GeneralComp system GeneralComp {
		var GeneralComp v_ptc1 := GeneralComp.create;

		map(self:p, system:p);
		map(v_ptc1:p, system:p);

		unmap(system:p);

		// verity that ports are really unmapped
        checkUnmapped();
        v_ptc1.start(checkUnmapped());
		all component.done;
    }
    control{
        execute(TC_Sem_210102_disconnect_and_unmap_operations_005());
    }
}

