/***************************************************
 ** @author   STF 548
 ** @version  0.0.1
 ** @purpose  1:16.2, verify that a function used in a default parameter of an altstep cannot contain fuzzy parameters
 ** @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_049 {
    type port P message {
        inout integer;
    }

    type component GeneralComp {
        port P p;
		var @fuzzy integer v_int := f_eval();
	}

    function f_eval() return integer {
        return 10;
    }

	function f_test(@fuzzy integer p_par) return boolean {
		if (p_par > 0) {
			return true;
		} else {
			return false;
		}
	}

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

    testcase TC_NegSem_1602_toplevel_049() runs on GeneralComp system GeneralComp {
        connect(mtc:p, mtc:p);
        p.send(1);
		alt {
			[] a_rcv() {}
			[] any timer.timeout {}
		}
		setverdict(pass);
	}

	control {
		execute(TC_NegSem_1602_toplevel_049());
	}
}
