/***************************************************
 ** @author   STF 572
 ** @version  0.0.1
 ** @purpose  1:15.0, verify that the raise operation cannot be used in a function called during evaluation of a deterministic fuzzy template
 ** @verdict  pass reject
 ***************************************************/

// The following requirement is tested:
// For a fuzzy template that is declared deterministic the template body shall fulfill the restrictions imposed
// on content of functions used in special places given in clause 16.1.4.
// The following operations shall not be used:
// b) All port operations, i.e. start (port), stop (port), halt, clear, checkstate, send, receive, trigger, call,
// getcall, reply, getreply, raise, catch, check, connect, disconnect, map and unmap (see notes 1, 2, 3, 4 and 6).

module NegSem_1500_general_025 {
    type port P message {
        inout integer;
    }

	signature S() exception (charstring);

	type port PSig procedure {
        inout S;
    }

    type component GeneralComp {
        port P p;
		port PSig psig;
	}

	function f_ptcBehaviour() runs on GeneralComp {
		psig.call(S:{}, nowait);
	}

	function f_test() runs on GeneralComp return template integer {
		psig.raise(S, "UserException");
        return ?;
	}

    testcase TC_NegSem_1500_general_025() runs on GeneralComp system GeneralComp {
        template @fuzzy @deterministic integer mw_test := f_test();
		var GeneralComp v_ptc := GeneralComp.create;
        connect(mtc:p, mtc:p);
		connect(mtc:psig, v_ptc:psig);
		v_ptc.start(f_ptcBehaviour());
		log(mw_test); // causes evaluation
		setverdict(pass);
	}

	control {
		execute(TC_NegSem_1500_general_025());
	}
}
