/***************************************************
 ** @author   STF 548
 ** @version  0.0.1
 ** @purpose  1:16.2, verify that the call operation cannot be used in default parameters of altsteps
 ** @verdict  pass reject
 ***************************************************/

// The following requirement is tested:
// Restriction b)
// The evaluation of formal parameters' default values and initialization of local definitions by calling value returning
// functions may have side effects. To avoid side effects that cause an inconsistency between the actual snapshot and the
// state of the component, and to prevent different results of subsequent evaluations on an unchanged snapshot,
// restrictions given in clause 16.1.4 shall apply to the formal parameters' default values and the initialization of local
// definitions.

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

	signature S();

	type port PSig procedure {
        inout S;
    }

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

	function f_test() runs on GeneralComp return boolean {
		psig.call(S:{}, nowait);
        return true;
	}

    altstep a_rcv(boolean p_par := f_test()) runs on GeneralComp {
        [] p.receive(integer:?) {}
    }

    testcase TC_NegSem_1602_toplevel_024() runs on GeneralComp system GeneralComp {
		var GeneralComp v_ptc := GeneralComp.create;
        connect(mtc:p, mtc:p);
		connect(mtc:psig, v_ptc:psig);
        p.send(1);
        alt {
	        [] a_rcv();
            [] any timer.timeout {}
        }
		setverdict(pass);
	}

	control {
		execute(TC_NegSem_1602_toplevel_024());
	}
}
