/***************************************************
 ** @author   STF 548
 ** @version  0.0.1
 ** @purpose  1:16.1.4, verify that a function called in guards of alt statements cannot contain fuzzy parameters
 ** @verdict  pass reject
 ***************************************************/

// The following requirement is tested:
// If value returning functions are called in receiving communication operations (in templates, template fields,
// in-line templates, or as actual parameters), in guards or events of alt statements or altsteps (see clause 20.2),
// or in initializations of altstep local definitions (see clause 16.2), the following operations shall not be
// used in functions called in the cases specified above, in order to avoid side effects that cause changing the
// state of the component or the actual snapshot and to prevent different results of subsequent evaluations
// on an unchanged snapshot:
// k) Calling functions and external functions with @fuzzy formal parameters and variables (see notes 4 and 9).

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

    type component GeneralComp {
        port P p;
	}

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

    function f_eval() return integer {
        return 10;
    }

    testcase TC_NegSem_160104_invoking_functions_from_specific_places_314() runs on GeneralComp system GeneralComp {
        var @fuzzy integer v_int := f_eval();
        connect(mtc:p, mtc:p);
        p.send(1);
		alt {
            [f_test(v_int)] p.receive(integer:?) {}
        }
		setverdict(pass);
	}

	control {
		execute(TC_NegSem_160104_invoking_functions_from_specific_places_314());
	}
}
