| /////////////////////////////////////////////////////////////////////////////// |
| // // |
| // 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_ILogString_Test |
| // |
| // Purpose: |
| // This module contains function definitions for testing EPTF ILogString |
| // |
| // Module Parameters: |
| // - |
| // |
| // Module depends on: |
| // <EPTF_ILogString_Definitions> |
| // <EPTF_ILogString_Functions> |
| // <EPTF_CLL_ILog_Functions> |
| // <EPTF_CLL_Base_Functions> |
| // <EPTF_CLL_Common_Definitions> |
| // |
| // Current Owner: |
| // EILDVNC |
| // |
| // Last Review Date: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| /////////////////////////////////////////////////////////// |
| |
| module EPTF_ILogString_Test { |
| |
| import from EPTF_CLL_ILogString_Definitions all; |
| import from EPTF_CLL_ILogString_Functions all; |
| import from EPTF_CLL_ILog_Functions all; |
| import from EPTF_CLL_Base_Functions all; |
| import from EPTF_CLL_Common_Definitions all; |
| |
| |
| type component EPTF_ILogString_Test_CT extends EPTF_ILogString_CT{ |
| |
| } |
| |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_ILogString_init |
| // |
| // Purpose: Test of the f_EPTF_ILogString_init_CT function of the ILogBase feature. |
| // |
| // Action: The testcase invokes the f_EPTF_ILogString_init_CT function. The verdict of the test is pass if no errors happen during the initialization. |
| // |
| // Expected Result: pass verdict. The test result is pass if the init function operates without any error. |
| // |
| /////////////////////////////////////////////////////////// |
| testcase tc_ILogString_init() runs on EPTF_ILogString_Test_CT { |
| |
| // Init |
| f_EPTF_ILogString_init_CT("ILogString_Test"); |
| |
| f_EPTF_Base_stopAll(pass); |
| |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_ILogString_createNewChain |
| // |
| // Purpose: The purpose of this testcase is to test the f_EPTF_ILogString_newChain function. The function should return the expected id for the chain that is created with it. |
| // |
| // Action: After the initialization process, the f_EPTF_ILogString_newChain function is called and the return value is checked. The test is successful, if the return value is |
| // the same as expected. |
| // |
| // Expected Result: pass verdict. The verdict of the test is set to pass if the check result is success. |
| // |
| /////////////////////////////////////////////////////////// |
| testcase tc_ILogString_createNewChain() runs on EPTF_ILogString_Test_CT { |
| |
| // Init |
| f_EPTF_ILogString_init_CT("ILogString_Test"); |
| |
| var integer vl_chain0 := f_EPTF_ILogString_newChain("Chain1"); |
| |
| if(vl_chain0 == 1 ){ |
| setverdict( pass ); |
| } else { |
| setverdict( fail, "Invalid value for event index. Should be: ",0, " but got: ",vl_chain0 ); |
| } |
| |
| f_EPTF_Base_stopAll(pass); |
| |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_ILogString_addElementToChain |
| // |
| // Purpose: The purpose of this testcase is to test the tc_ILogString_addElementToChain function. |
| // |
| // |
| // Action: After the initialization process, one chain is created and ten elements are added to the chain with the tested function. The testcase checks |
| // the return value of the function and sets the verdict of test to fail, if the return value is not 0. |
| // |
| // Expected Result: pass verdict. The test verdict is set to pass, if no error occurs and return value is the expected. |
| // |
| /////////////////////////////////////////////////////////// |
| testcase tc_ILogString_addElementToChain() runs on EPTF_ILogString_Test_CT { |
| |
| // Init |
| f_EPTF_ILogString_init_CT("ILogString_Test"); |
| |
| var integer vl_chain0 := f_EPTF_ILogString_newChain( "Chain11" ); |
| var EPTF_IntegerList vl_chainList := {vl_chain0}; |
| |
| for(var integer vl_i := 0; vl_i <10; vl_i := vl_i +1 ){ |
| |
| var charstring vl_logElement := int2str(vl_i); |
| var float vl_time := f_EPTF_Base_getAbsTimeInSecs(); |
| |
| if(f_EPTF_ILogString_addToChains(vl_chainList, vl_logElement, vl_time) == 0){ |
| setverdict(pass); |
| } else { |
| setverdict(fail, "Error occured during the opreation of the addToChains function!"); |
| } |
| } |
| |
| f_EPTF_Base_stopAll(pass); |
| |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_ILogString_addElementToChain_NegativeTest_nonExistingChainId |
| // |
| // Purpose: The purpose of this testcase is to test the tc_ILogString_addElementToChain function. |
| // |
| // |
| // Action: After the initialization process, one chain is created and ten elements are added to the chain with the tested function. The testcase checks |
| // the return value of the function and sets the verdict of test to fail, if the return value is not -1. |
| // |
| // Expected Result: pass verdict. The test verdict is set to pass, if no error occurs and return value is the expected. |
| // |
| /////////////////////////////////////////////////////////// |
| testcase tc_ILogString_addElementToChain_NegativeTest_nonExistingChainId() runs on EPTF_ILogString_Test_CT { |
| |
| // Init |
| f_EPTF_ILogString_init_CT("ILogString_Test"); |
| |
| var integer vl_chain0 := f_EPTF_ILogString_newChain( "Chain11" ); |
| var integer vl_chain1 := vl_chain0 + 1; |
| var EPTF_IntegerList vl_chainList := {vl_chain1}; |
| |
| for(var integer vl_i := 0; vl_i <10; vl_i := vl_i +1 ){ |
| |
| var charstring vl_logElement := int2str(vl_i); |
| var float vl_time := f_EPTF_Base_getAbsTimeInSecs(); |
| |
| if(f_EPTF_ILogString_addToChains(vl_chainList, vl_logElement, vl_time) == -1){ |
| setverdict(pass); |
| } else { |
| setverdict(fail, "Error occured during the opreation of the addToChains function!"); |
| } |
| |
| } |
| |
| f_EPTF_Base_stopAll(pass); |
| |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_ILogString_logChain |
| // |
| // Purpose: The purpose of this testcase is to test the f_EPTF_ILogBase_logChain function and the usage of the callback functions for logging the logheader and |
| // the content of the logged chain. |
| // |
| // Action: After the initialization process, one chain is created and ten elements are added to the chain. The testcase invokes the f_EPTF_ILogBase_logChain |
| // function at the end of the test. The test is successful, if no error occurs. |
| // |
| // Expected Result: pass verdict. The test verdict is set to pass, if no error occurs. |
| // |
| /////////////////////////////////////////////////////////// |
| testcase tc_ILogString_logChain() runs on EPTF_ILogString_Test_CT { |
| |
| // Init |
| f_EPTF_ILogString_init_CT("ILogString_Test"); |
| |
| var integer vl_chain0 := f_EPTF_ILogString_newChain( "Chain11" ); |
| var EPTF_IntegerList vl_chainList := {vl_chain0}; |
| |
| for(var integer vl_i := 0; vl_i <10; vl_i := vl_i +1 ){ |
| |
| var charstring vl_logElement := int2str(vl_i); |
| var float vl_time := f_EPTF_Base_getAbsTimeInSecs(); |
| |
| if(f_EPTF_ILogString_addToChains(vl_chainList, vl_logElement, vl_time) == 0){ |
| setverdict(pass); |
| } else { |
| setverdict(fail, "Error occured during the opreation of the addToChains function!"); |
| } |
| } |
| |
| if(f_EPTF_ILog_logChain(vl_chain0) == 0){ |
| setverdict(pass); |
| } else { |
| setverdict(fail, "Error occured during the opreation of the logChain function!"); |
| } |
| |
| f_EPTF_Base_stopAll(pass); |
| |
| } |
| |
| control{ |
| execute(tc_ILogString_init()); |
| execute(tc_ILogString_createNewChain()); |
| execute(tc_ILogString_addElementToChain()); |
| execute(tc_ILogString_addElementToChain_NegativeTest_nonExistingChainId()); |
| execute(tc_ILogString_logChain()); |
| } |
| } |