| /////////////////////////////////////////////////////////////////////////////// |
| // // |
| // Copyright (c) 2000-2018 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 // |
| /////////////////////////////////////////////////////////////////////////////// |
| |
| /////////////////////////////////////////////////////////// |
| // |
| // Purpose: |
| // This module provides functions for testing R12 functionalities and bugfixes |
| // of LGenBase |
| // |
| // Module depends on: |
| // - |
| // |
| // Current Owner: |
| // László Skumát (ELSZSKU) |
| // |
| // Last Review Date: |
| // - |
| // |
| /////////////////////////////////////////////////////////////// |
| module EPTF_LGenBase_Test_TestcasesR12 |
| // [.objid{ itu_t(0) identified_organization(4) etsi(0) |
| // identified_organization(127) ericsson(5) testing(0) |
| // <put further nodes here if needed>}] |
| { |
| import from EPTF_LGenBase_Test_Functions all; |
| import from EPTF_LGenBase_Test_Definitions all; |
| import from EPTF_CLL_LGenBase_Functions all; |
| import from EPTF_CLL_LGenBase_TrafficFunctions all; |
| import from EPTF_CLL_LGenBase_ConfigDefinitions all; |
| import from EPTF_CLL_LGenBase_ConfigFunctions all; |
| import from EPTF_CLL_LGenBase_EventHandlingFunctions all; |
| import from EPTF_CLL_Base_Functions all; |
| import from EPTF_CLL_LGenBase_Definitions all; |
| |
| group FSMTimerTimeout_tests{ |
| |
| |
| type component EPTF_LGenBase_Test_FSMTimerTimeout_CT extends EPTF_LGenBase_Test_CT { |
| var float v_startTime; |
| var float v_endTime; |
| var float v_expectedDuration; |
| } |
| |
| |
| function f_EPTF_LGenBase_Test_registerStartTime(in EPTF_LGenBase_TestStepArgs pl_ptr) |
| runs on EPTF_LGenBase_Test_FSMTimerTimeout_CT{ |
| log(%definitionId&": called.") |
| v_startTime := f_EPTF_Base_getRelTimeInSecs(); |
| |
| } |
| |
| function f_EPTF_LGenBase_Test_registerEndTime(in EPTF_LGenBase_TestStepArgs pl_ptr) |
| runs on EPTF_LGenBase_Test_FSMTimerTimeout_CT{ |
| log(%definitionId&": called.") |
| v_endTime := f_EPTF_Base_getRelTimeInSecs(); |
| } |
| |
| function f_EPTF_LGenBase_Test_checkDuration(in EPTF_LGenBase_TestStepArgs pl_ptr) |
| runs on EPTF_LGenBase_Test_FSMTimerTimeout_CT{ |
| log(%definitionId&": called.") |
| var float vl_error := v_endTime-v_startTime-v_expectedDuration; |
| if (vl_error*vl_error<0.0001) { |
| setverdict(pass) |
| } else { |
| setverdict(fail,"FSM timer timeout duration is wrong: ",v_endTime-v_startTime, ". Expected: ", v_expectedDuration); |
| } |
| } |
| |
| |
| function f_LGenBase_Test_FSMTimerTimeout_test(in EPTF_LGenBase_FsmTableDeclarator pl_fsm) |
| runs on EPTF_LGenBase_Test_FSMTimerTimeout_CT{ |
| f_EPTF_LGenBase_init("FSMTimerTimeout"); |
| var integer v_LGenBase_VarAndStatTest_behav := f_EPTF_LGenBase_declareBehaviorType("b1", -1, null, null, null); |
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("et1", {"b1"}); |
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({"eg1", "et1", 3}) |
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","start"); |
| v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"Finished",refers( f_EPTF_LGenBase_TestFinishedNow)}); |
| v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"RegisterStartTime",refers( f_EPTF_LGenBase_Test_registerStartTime)}); |
| v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"RegisterStopTime",refers( f_EPTF_LGenBase_Test_registerEndTime)}); |
| v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"CheckDuration",refers( f_EPTF_LGenBase_Test_checkDuration)}); |
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable( pl_fsm ) |
| v_dummyInt := f_EPTF_LGenBase_declareTrafficCaseType({ |
| "TC1", |
| "FSMTimerTimeout_FSM", |
| "et1", |
| {} |
| }) |
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3( |
| { "SC1", |
| { |
| {"TC1",{ |
| {target := {cpsToReach := 1.0}} |
| } |
| } |
| }, |
| {} |
| }) |
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false); |
| timer t_wait := 0.9; |
| t_wait.start; t_wait.timeout; |
| f_EPTF_LGenBase_dispatchEvent({{v_LGenBase_VarAndStatTest_behav,0,{0,0},omit},{}}) |
| t_wait.start(v_expectedDuration); t_wait.timeout; |
| v_dummyBool := f_EPTF_LGenBase_wait4TestFinished() |
| f_EPTF_Base_cleanup_CT(); |
| |
| } |
| |
| template EPTF_LGenBase_FsmTableDeclarator t_EPTF_LGenBase_Test_FSMTimerTimeout_fsm1(in float pl_duration) := { |
| name := "FSMTimerTimeout_FSM", |
| fsmParams := { |
| {timerList := {{"time",pl_duration}}}, |
| {stateList := {"start"}}, |
| {varList := |
| { |
| } |
| }, |
| {statMeasStatList := { }} |
| }, |
| table := { |
| classicTable := { |
| {eventToListen := {"b1","start",fsm}, |
| cellRow := { |
| //state[0]==start |
| { |
| { |
| {"RegisterStartTime",omit}, |
| {c_EPTF_LGenBase_stepName_timerStart,{timerName := "time"}} |
| }, |
| omit, "start" |
| } |
| } |
| }, |
| {eventToListen := {c_EPTF_LGenBase_specialBName_timerTimeout,"time",fsm}, |
| cellRow := { |
| { |
| { |
| {"RegisterStopTime", omit}, |
| {"CheckDuration", omit}, |
| {"Finished", omit} |
| }, |
| omit, omit |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_Test_FSMTimerTimeout |
| // |
| // Purpose: Test if the FSM timer timeouts at the correct time. |
| // |
| // Action: The fsm starts a normal timer in the state "start", and stores the start time. |
| // When the timer goes timeouts, the fsm stores the end of time and compares the elapsed time with the |
| // expected duration. |
| // If the duration differs too much from the expected, the verdict is set to fail. |
| // |
| // Expected Result: pass verdict. |
| /////////////////////////////////////////////////////////// |
| testcase tc_LGenBase_Test_FSMTimerTimeout() |
| runs on EPTF_LGenBase_Test_FSMTimerTimeout_CT{ |
| |
| v_expectedDuration := 1.0; // set the expected duration |
| f_LGenBase_Test_FSMTimerTimeout_test(valueof(t_EPTF_LGenBase_Test_FSMTimerTimeout_fsm1(v_expectedDuration))); |
| } |
| |
| } |
| |
| control{ |
| execute(tc_LGenBase_Test_FSMTimerTimeout()); |
| |
| } |
| |
| } // end of module |