/******************************************************************************
 * 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.2, verify that actual parameters are evaluated in order of their appearance (list notation)
 ** @verdict  pass accept, ttcn3verdict:pass
 ***************************************************/

// The following requirement is tested:
// The actual parameters are evaluated in the order of their appearance.

module Sem_050402_actual_parameters_166 { 

    type component GeneralComp {
        var integer vc_counter := 0;
	}

    function f_eval1() runs on GeneralComp return integer {
		log("f_eval1: " & int2str(vc_counter)); 
        if (vc_counter == 0) 
        { 
            setverdict(pass); 
            vc_counter := vc_counter + 1;
        }
        else { setverdict(fail); }
        return vc_counter;
    }
    
    function f_eval2() runs on GeneralComp return integer {
		log("f_eval2: " & int2str(vc_counter));        
		if (vc_counter == 1) 
        { 
            setverdict(pass); 
            vc_counter := vc_counter + 1;
        }
        else { setverdict(fail); }
        return vc_counter;
    }
    
    function f_test(integer p_par1, integer p_par2) 
	{        
    }

    testcase TC_Sem_050402_actual_parameters_166() runs on GeneralComp {

		  f_test( f_eval1(), f_eval2()); // tested feature: f_eval1 shall be called before f_eval2
		  // f_test( f_eval2(), f_eval1()); <-- good 
	}

	control {
		execute(TC_Sem_050402_actual_parameters_166());
	}
}
