/*****************************************************************
 ** @author   STF 521
 ** @version  0.0.1
 ** @purpose  1:22.3.1, missing to clause in case of one-to-many connections
 ** @verdict  pass reject
 *****************************************************************/

// The following requirements are tested:
// e) A to clause shall be present in case of one-to-many connections.

module NegSem_220301_CallOperation_012 {

	signature S();

	type port P procedure {
		inout S;
	}

    type component GeneralComp {
		port P p;
	}

	function f_called() runs on GeneralComp {
		p.getcall(S:?);
		p.reply(S:{});
	}

    testcase TC_NegSem_220301_CallOperation_012() runs on GeneralComp system GeneralComp {
        var GeneralComp v_ptc1 := GeneralComp.create,
			v_ptc2 := GeneralComp.create;
		var integer v_counter := 0;
		connect(self:p, v_ptc1:p);
		connect(self:p, v_ptc2:p);
		v_ptc1.start(f_called());
		v_ptc2.start(f_called());
		p.call(S:{}) { // error expected as the to clause is missing
			[] p.getreply(S:?) {
				v_counter := v_counter + 1;
				if (v_counter < 2) {
					repeat;
				} else {
					setverdict(pass, "Both replies received"); }
				}
		}
    }

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