/***************************************************
 ** @author   STF 548
 ** @version  0.0.1
 ** @purpose  1:20.2, verify that a function used in a parameter of an altstep invoked from an alt branch cannot contain fuzzy parameters
 ** @verdict  pass reject
 ***************************************************/

// The following requirement is tested:
// d) The evaluation of an altstep invoked from an alt branch, if none of the alternatives in the altstep is chosen, shall
// not have side effects. To avoid side effects the restrictions imposed on the contents of functions called from special
// places (clause 16.1.4) shall apply to the actual parameters of the invoked altstep.

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

    type component GeneralComp {
        port P p;
	}

    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) runs on GeneralComp {
        [p_par] p.receive(integer:?) {}
    }

    testcase TC_NegSem_2002_TheAltStatement_087() runs on GeneralComp system GeneralComp {
        var @fuzzy integer v_int := f_eval();
        connect(mtc:p, mtc:p);
        p.send(1);
		alt {
			[] a_rcv(f_test(v_int)) {}
			[] any timer.timeout {}
		}
		setverdict(pass);
	}

	control {
		execute(TC_NegSem_2002_TheAltStatement_087());
	}
}
