/*****************************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:22.3.5, unicast raise operation
 ** @verdict  pass accept, ttcn3verdict:pass
 *****************************************************************/
// The following requirements are tested:
// Exceptions to one or more call operations may be sent to one, several or all peer entities
// connected to the addressed port. This can be specified in the same manner as described in
// clause 22.2.1. This means, the argument of the to clause of a raise operation is for
// unicast exceptions the address of one receiving entity, for multicast exceptions a list of
// addresses of a set of receivers and for broadcast exceptions the all component keywords.


module Sem_220305_raise_operation_002 {
	signature S() exception(integer);

	type port P procedure {
		inout S;
	}

    type component GeneralComp
	{
		port P p;
	}

	function f(integer p_expected) runs on GeneralComp
	{
        p.call(S:{}) {
            [] p.catch(S, p_expected) { setverdict(pass); }
            [] p.catch { setverdict(fail); }
        }
	}

    testcase TC_Sem_220305_raise_operation_002() runs on GeneralComp system GeneralComp {
        var GeneralComp v_ptc1 := GeneralComp.create, v_ptc2 := GeneralComp.create;
		connect(self:p, v_ptc1:p);
        connect(self:p, v_ptc2:p);
        v_ptc1.start(f(1));
        v_ptc2.start(f(2));
        p.getcall(S:?);
        p.getcall(S:?); // call from both components expected
		p.raise(S, 1) to v_ptc1;
        p.raise(S, 2) to v_ptc2;
        all component.done;
        setverdict(pass);
    }

    control {
        execute(TC_Sem_220305_raise_operation_002(), 5.0);
    }
}