/******************************************************************************
 * Copyright (c) ETSI 2017.
 *
 * This file is subject to copyrights owned by ETSI. Non-exclusive permission
 * is hereby granted, free of charge, to copy, reproduce and amend this file
 * under the following conditions: It is provided "as is", without warranty of any
 * kind, expressed or implied.
 * 
 * ETSI shall never be liable for any claim, damages, or other liability arising
 * from its use or inability of use.This permission does not apply to any documentation
 * associated with this file for which ETSI keeps all rights reserved. The present
 * copyright notice shall be included in all copies of whole or part of this
 * file and shall not imply any sub-license right.
 *
 * Modified by: Adrien Kirjak
 *
 ** @version  0.0.1
 ** @purpose  1:5.4.1, verify that default values of @fuzzy parameters are properly evaluated
 ** @verdict  pass accept, ttcn3verdict:pass
 ***************************************************/

// The following requirement is tested:
// Assigning default values for lazy and fuzzy formal parameters does not change the parameters' semantics: 
// when the default values are used as actual values for the parameters, they shall be evaluated the same 
// way (i.e. delayed) as if an actual parameter was provided.

module Sem_050401_top_level_026 { 

	type component GeneralComp {
	}

	function f(@fuzzy float p_int := rnd()) runs on GeneralComp {
        var float v_float;
		var float tmp;
        // rnd function is used for checking:
        // 1. first rnd with a seed is called to initiate the generator with a fixed value
        // 2. the next call is without a seed (to continue the sequence); this value is saved
        // 3. the third call re-uses the seed to restart the sequence
        // 4. the rnd call used in evaluation of the default value shall produce the same result now as in the 2nd step
        tmp := rnd(1.0);
        v_float := rnd();
        tmp := rnd(1.0);
        if (p_int == v_float) { setverdict(pass); }
        else { setverdict(fail); }
	}
	
	testcase TC_Sem_050401_top_level_026() runs on GeneralComp {
		f();
	}

	control{
		execute(TC_Sem_050401_top_level_026());
	}
}
