| /////////////////////////////////////////////////////////////////////////////// |
| // // |
| // Copyright (c) 2000-2019 Ericsson Telecom AB // |
| // // |
| // All rights reserved. This program and the accompanying materials // |
| // are made available under the terms of the Eclipse Public License v2.0 // |
| // which accompanies this distribution, and is available at // |
| // https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html // |
| /////////////////////////////////////////////////////////////////////////////// |
| |
| /////////////////////////////////////////////////////////// |
| // Module: EPTF_SMacro_Test_Functions |
| // |
| // Purpose: |
| // This module contains functions for testing EPTF SMacro. |
| // |
| // Module Parameters: |
| // - |
| // Module depends on: |
| // <EPTF_SMacro_Test_Definitions> |
| // <EPTF_CLL_SMacro_Definitions> |
| // <EPTF_CLL_SMacro_Functions> |
| // <EPTF_CLL_Base_Functions> |
| // <EPTF_CLL_Common_Definitions> |
| // |
| // Current Owner: |
| // Balazs Barcsik (ebalbar) |
| // |
| // Last Review Date: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| /////////////////////////////////////////////////////////// |
| module EPTF_SMacro_Test_Functions { |
| |
| //========================================================================= |
| // Import Part |
| //========================================================================= |
| import from EPTF_CLL_SMacro_Definitions all; |
| import from EPTF_SMacro_Test_Definitions all; |
| import from EPTF_CLL_SMacro_Functions all; |
| import from EPTF_CLL_Base_Functions all; |
| import from EPTF_CLL_Common_Definitions all; |
| |
| //========================================================================= |
| // Functions |
| //========================================================================= |
| |
| function f_EPTF_SMacro_Test_init_CT( |
| in charstring pl_selfName |
| ) runs on SMacro_Test_CT { |
| |
| |
| f_EPTF_Base_init_CT(pl_selfName); |
| f_EPTF_SMacro_init_CT(pl_selfName); |
| |
| v_macro_name1 := "macro_name1"; |
| v_macro_name2 := "macro_name2"; |
| v_macro_name3 := "macro_name3"; |
| v_macro_name4 := "macro_name4"; |
| v_macro_name5 := "macro_name5"; |
| v_macro_name6 := "macro_name6"; |
| v_macro_value1 := "macro_value1"; |
| v_macro_value2 := "macro_value2"; |
| v_macro_value3 := "macro_function3"; |
| v_macro_value4 := "$macro_name1"; |
| v_macro_value5 := "macro_function5"; |
| v_macro_value6 := v_macro_name1; |
| |
| if(f_EPTF_SMacro_define(v_macro_name1, v_macro_value1) != 0) { |
| setverdict(fail, "Macro cannot be defined, but macro is correct"); |
| f_EPTF_Base_stop(none); |
| } |
| |
| if(f_EPTF_SMacro_define(v_macro_name2, v_macro_value2) != 0) { |
| setverdict(fail, "Macro cannot be defined, but macro is correct"); |
| f_EPTF_Base_stop(none); |
| } |
| |
| if(f_EPTF_SMacro_define(v_macro_name3, v_macro_value3) != 0) { |
| setverdict(fail, "Macro cannot be defined, but macro is correct"); |
| f_EPTF_Base_stop(none); |
| } |
| f_EPTF_SMacro_registerCalcFn( |
| pl_functionName := "macro_function3", |
| pl_macro_function := refers(f_EPTF_SMacro_Test_macro_concatPars) |
| ); |
| |
| if(f_EPTF_SMacro_define(v_macro_name4, v_macro_value4) != 0) { |
| setverdict(fail, "Macro cannot be defined, but macro is correct"); |
| f_EPTF_Base_stop(none); |
| } |
| |
| if(f_EPTF_SMacro_define(v_macro_name5, v_macro_value5) != 0) { |
| setverdict(fail, "Macro cannot be defined, but macro is correct"); |
| f_EPTF_Base_stop(none); |
| } |
| |
| f_EPTF_SMacro_registerCalcFn( |
| pl_functionName := "macro_function5", |
| pl_macro_function := refers(f_EPTF_SMacro_Test_macro_concatPars), |
| pl_userArgs := {0,0} |
| ); |
| |
| if(f_EPTF_SMacro_define(v_macro_name6, v_macro_value6) != 0) { |
| setverdict(fail, "Macro cannot be defined, but macro is correct"); |
| f_EPTF_Base_stop(none); |
| } |
| } |
| |
| |
| function f_EPTF_SMacro_Test_macro_concatPars( |
| in EPTF_CharstringList pl_macroArgs, |
| in EPTF_IntegerList pl_userArgs := {} |
| ) runs on SMacro_Test_CT return charstring { |
| |
| var charstring vl_concatChar := "-"; |
| var charstring vl_concatMacro := "$macro_name4"; |
| |
| var boolean vl_useConcatChar := (sizeof(pl_userArgs)>0 and pl_userArgs[0] != 0) or sizeof(pl_userArgs)<1; |
| if (not vl_useConcatChar) { |
| vl_concatChar := ""; |
| } |
| var boolean vl_useConcatMacro := (sizeof(pl_userArgs)>1 and pl_userArgs[1] != 0) or sizeof(pl_userArgs)<2; |
| if (not vl_useConcatMacro) { |
| vl_concatMacro := ""; |
| } |
| |
| var charstring vl_value := "macro_concatPars_Value="; |
| for(var integer i:=0; i<sizeof(pl_macroArgs); i:=i+1) { |
| vl_value := vl_value&vl_concatChar&pl_macroArgs[i]; |
| } |
| vl_value := vl_value&vl_concatChar&vl_concatMacro&vl_concatChar; |
| return vl_value; |
| } |
| |
| |
| function f_EPTF_SMacro_Test_invalidMacroNameWithLoggingInitialized_preamble_FT(in charstring pl_message) runs on SMacro_Test_InvalidMacroNameWithLoggingInitialized_CT { |
| if (match(pl_message, pattern "*f_EPTF_SMacro_define: Warning: macro name * is invalid, should contain only characters 'a..z', 'A..Z', '_', '0..9'. Macro definition ignored.*")) { |
| v_warningLogged := true; |
| } |
| } |
| |
| } //module |