/***************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:5.4.1, verify that @lazy parameters containing component variable references are properly evaluated
 ** @verdict  pass accept, ttcn3verdict:pass
 ***************************************************/

// The following requirement is tested:
// Formal value or template parameters may be declared lazy using the @lazy modifier. The behaviour
// of lazy parameters is defined in clause 3.1, definition of lazy values or templates.

// Note: the test checks the situation described in NOTE 2:
// The actual values of component variables used in the delayed evaluation of a lazy or fuzzy parameter
// may differ from their values at the time, when the parameterized function or alstep was called.

module Sem_050401_top_level_021 {

	type component GeneralComp {
        var integer vc_int := 20;
	}

	function f(@lazy integer p_int) runs on GeneralComp {
        vc_int := 0;
        if (p_int == 1) { setverdict(pass); }
        else { setverdict(fail); }
	}

	testcase TC_Sem_050401_top_level_021() runs on GeneralComp {
		f(vc_int + 1);
	}

	control{
		execute(TC_Sem_050401_top_level_021());
	}
}
