| /////////////////////////////////////////////////////////////////////////////// |
| // // |
| // 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 // |
| /////////////////////////////////////////////////////////////////////////////// |
| |
| /////////////////////////////////////////////////////////// |
| // Module: EPTF_LGenBase_Test_TestcasesR4 |
| // |
| // Purpose: |
| // This module provides functions for testing new R4 functionalities of LGenBase |
| // |
| // Module depends on: |
| // - |
| // |
| // Current Owner: |
| // László Skumát (ELSZSKU) |
| // |
| // Last Review Date: |
| // - |
| // |
| /////////////////////////////////////////////////////////////// |
| module EPTF_LGenBase_Test_TestcasesR4 |
| { |
| import from EPTF_LGenBase_Test_Functions all; |
| import from EPTF_LGenBase_Test_TestcasesR3 all; |
| import from EPTF_CLL_StatMeasure_Functions all; |
| import from EPTF_CLL_LGenBase_ConfigDefinitions all; |
| import from EPTF_CLL_LGenBase_EventHandlingFunctions all; |
| import from EPTF_LGenBase_Test_Definitions all; |
| //import from EPTF_LGenBase_Test_Functions all; |
| import from EPTF_CLL_Common_Definitions all; |
| //import from EPTF_CLL_Base_Definitions all; |
| import from EPTF_CLL_LGenBase_Definitions all; |
| import from EPTF_CLL_LGenBase_Functions all; |
| import from EPTF_CLL_LGenBaseStats_Definitions all; |
| //import from EPTF_CLL_LGenBaseStats_Functions all; |
| //import from EPTF_CLL_LGenBase_ConfigDefinitions all; |
| import from EPTF_CLL_LGenBase_ConfigFunctions all; |
| import from EPTF_CLL_LGenBase_TrafficFunctions all; |
| //import from EPTF_CLL_LGenBase_StepFunctions all; |
| //import from EPTF_CLL_LGenBase_EventHandlingFunctions all; |
| //import from EPTF_CLL_LGenBase_LoggingFunctions all; |
| import from EPTF_CLL_Logging_Functions all; |
| //import from EPTF_CLL_FBQ_Functions all; |
| import from EPTF_CLL_Base_Functions all; |
| import from EPTF_CLL_Variable_Functions all; |
| import from EPTF_CLL_Variable_Definitions all; |
| //import from EPTF_CLL_StatHandlerClient_Definitions all; |
| //import from EPTF_CLL_StatMeasure_Definitions all |
| //import from EPTF_CLL_StatMeasure_Functions all |
| //import from EPTF_CLL_RBTScheduler_Functions all; |
| //import from EPTF_CLL_StatHandlerClient_Functions all; |
| //import from EPTF_CLL_Scheduler_Definitions all |
| import from PIPEasp_PortType all |
| import from PIPEasp_Types all |
| import from TCCConversion_Functions all |
| |
| group lastCPS{ |
| testcase tc_lastCPSIs0() |
| runs on EPTF_LGenBase_CT{ |
| const charstring c_eGrpName := "eg0" |
| const charstring c_scName := "Scenario_Simple" |
| const charstring c_scNameWeighted :="Scenario_Weighted" |
| const charstring c_tcName := "testTC" |
| f_EPTF_LGenBase_init("") |
| var integer |
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable( |
| { |
| name := "statFSM", |
| fsmParams := { |
| {stateList := {"idle"}} |
| ,{varList := { |
| {name := "vf_callCounter", initValue := {intVal := 0}, scope := TC} |
| } |
| } |
| }, |
| table := { |
| classicTable := { |
| {eventToListen := { bName := "EPTF_CLL_LGenBase", iName := "LGenBase: Start_the_traffic_case!", eventType := fsm }, |
| cellRow := { |
| //state==idle |
| {actionList := { |
| {stepOrFunctionName := c_EPTF_LGenBase_stepName_trafficSuccess, contextArgs := omit} |
| ,{stepOrFunctionName := c_EPTF_LGenBase_stepName_fsmVarInc, contextArgs :={varParams := {"vf_callCounter",{intVal := 1}}}} |
| }, |
| nextStateCalculation := omit, |
| nextState := omit |
| } |
| } |
| } |
| } |
| }//table |
| }//fsm //XCAPget_DOT:} |
| ) |
| v_dummyInt := f_EPTF_LGenBase_declareBehaviorType("b1", -1, null, null, null); |
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("Entity_Tc_A", {"b1"}); |
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({name := "eg_base", eType := "Entity_Tc_A", eCount := 125}) |
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({name := "eg_base2", eType := "Entity_Tc_A", eCount := 57}) |
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({name := c_eGrpName, eType := "Entity_Tc_A", eCount := 5}) |
| v_dummyInt := f_EPTF_LGenBase_declareTcType2({ |
| name := "statTC", |
| fsmName := "statFSM", |
| entityType := "Entity_Tc_A", |
| customEntitySucc := "" |
| }) |
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3( |
| { |
| name := c_scName, |
| tcList := { |
| { tcName := "statTC0", |
| tcParamsList := { |
| {tcTypeName := "statTC"}, |
| {enableEntitiesAtStart := true}, |
| {enabledAtStart := false}, |
| {target := {cpsToReach := 1111.0}} |
| } |
| }, |
| { tcName := c_tcName, |
| tcParamsList := { |
| {tcTypeName := "statTC"}, |
| {enableEntitiesAtStart := true}, |
| {enabledAtStart := true}, |
| {target := {cpsToReach := 1111.0}} |
| } |
| } |
| }, |
| scParamsList := { |
| {enabled := true} |
| } |
| }) |
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3( |
| { |
| name := c_scNameWeighted, |
| tcList := { |
| { tcName := "statTC0", |
| tcParamsList := { |
| {tcTypeName := "statTC"}, |
| {enableEntitiesAtStart := true}, |
| {enabledAtStart := true}, |
| {target := {trafficWeight := 0.5}} |
| } |
| }, |
| { tcName := c_tcName, |
| tcParamsList := { |
| {tcTypeName := "statTC"}, |
| {enableEntitiesAtStart := true}, |
| {enabledAtStart := true}, |
| {target := {trafficWeight := 0.5}} |
| } |
| } |
| }, |
| scParamsList := { |
| {weightedScData := { |
| cpsToReach := 1111.0, |
| lockCPS := false, |
| deterministicMix := false, |
| scheduler := omit |
| } |
| }, |
| {enabled := true} |
| } |
| }) |
| |
| //Simple scenario |
| f_EPTF_LGenBase_createScenario2EntityGroup({c_eGrpName, c_scName},true) |
| timer t_wait |
| t_wait.start( 3.4 ) |
| t_wait.timeout |
| var float vl_cps := f_EPTF_LGenBase_getCPSByNames(c_eGrpName, c_scName, c_tcName) |
| if(tsp_EPTF_LGenBaseTestDebug){ |
| log(%definitionId,vl_cps) |
| } |
| if(0.0 == vl_cps){ |
| setverdict ( fail,"The CPS is 0.0"); |
| } |
| vl_cps := f_EPTF_LGenBase_getMeasuredCPSByNames(c_eGrpName, c_scName, c_tcName) |
| if(0.0 == vl_cps){ |
| setverdict ( fail, "The measured CPS is 0.0" ); |
| } |
| var charstring vl_pre := f_EPTF_LGenBase_getNamePrefix(c_eGrpName, c_scName, c_tcName) |
| vl_pre := vl_pre & c_EPTF_LGenBaseStats_nameOfTcCpsToReach |
| var integer vl_varId := f_EPTF_Var_getId(vl_pre) |
| var EPTF_Var_DirectContent vl_content |
| vl_content.floatVal := 0.0 |
| f_EPTF_Var_adjustContent(vl_varId, vl_content) |
| //f_EPTF_LGenBase_setCPSByNames(c_eGrpName, c_scName, c_tcName, 0.0) |
| vl_cps := f_EPTF_LGenBase_getTcCpsToReachByName(c_eGrpName, c_scName, c_tcName) |
| if(0.0 != vl_cps){ |
| setverdict ( fail, "The target CPS is ",vl_cps," instead of 0.0" ); |
| } |
| t_wait.start( 2.2 ) |
| t_wait.timeout |
| vl_cps := f_EPTF_LGenBase_getCPSByNames(c_eGrpName, c_scName, c_tcName) |
| if(0.0 == vl_cps){ |
| setverdict ( fail, "The CPS is 0.0. It should be the las non-0 value" ); |
| } |
| var integer vl_tcIdx := f_EPTF_LGenBase_trafficCaseId(c_eGrpName, c_scName, c_tcName) |
| vl_cps := f_EPTF_LGenBase_getMeasuredCPSByIdx(vl_tcIdx) |
| if(0.0 != vl_cps){ |
| setverdict ( fail, "The measured CPS is",vl_cps," instead of 0.0" ); |
| } |
| var integer vl_scIdx := f_EPTF_LGenBase_scenarioAbsIdxByName(c_eGrpName, c_scName) |
| var integer vl_eGrpIdx, vl_scRelIdx |
| f_EPTF_LGenBase_scenarioRelIdx(vl_scIdx, vl_eGrpIdx, vl_scRelIdx) |
| f_EPTF_LGenBase_stopScenarioByIdx(vl_eGrpIdx, vl_scRelIdx) |
| if(tsp_EPTF_LGenBaseTestDebug){ |
| log(%definitionId,vl_cps) |
| } |
| //Weighted scenario |
| f_EPTF_LGenBase_createScenario2EntityGroup({c_eGrpName, c_scNameWeighted},true) |
| t_wait.start( 3.4 ) |
| t_wait.timeout |
| var charstring vl_varName := f_EPTF_LGenBase_varNameOfTCVar( |
| f_EPTF_LGenBase_trafficCaseId(c_eGrpName, c_scNameWeighted, c_tcName), |
| "vf_callCounter") |
| var integer vl_tcVarIdx := f_EPTF_Var_getId(vl_varName) |
| f_EPTF_Var_getContent(vl_tcVarIdx, vl_content) |
| if(0 == vl_content.intVal){ |
| setverdict ( fail ); |
| } |
| f_EPTF_LGenBase_setScenarioCPS(c_eGrpName, c_scNameWeighted, 0.0) |
| vl_content.intVal := 0 |
| f_EPTF_Var_adjustContent(vl_tcVarIdx, vl_content) |
| t_wait.start( 1.2 ) |
| t_wait.timeout |
| f_EPTF_Var_getContent(vl_tcVarIdx, vl_content) |
| if(0 != vl_content.intVal){ |
| setverdict ( fail, "The counter is ",vl_content.intVal," instead of 0" ) |
| }else{ |
| setverdict( pass) |
| } |
| f_EPTF_Base_cleanup_CT() |
| } |
| } |
| |
| testcase tc_dispatcEntityEvent() |
| runs on EPTF_LGenBase_CT{ |
| f_EPTF_LGenBase_init("") |
| var integer |
| v_bIdx := f_EPTF_LGenBase_declareBehaviorType("b1", -1, null, null, null); |
| var integer |
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1", "i1") |
| var integer |
| v_iIdx := f_EPTF_LGenBase_declareFsmEvent("b1", "i2") |
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("Entity_Tc_A", {"b1"}); |
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({name := "eg_base", eType := "Entity_Tc_A", eCount := 125}) |
| var integer |
| v_FSM := f_EPTF_LGenBase_declareFSMTable( |
| { |
| name := "statFSM", |
| fsmParams := { |
| {stateList := {"idle"}} |
| ,{varList := { |
| {name := "vf_callCounter", initValue := {intVal := 0}, scope := FSM} |
| } |
| } |
| }, |
| table := { |
| classicTable := { |
| {eventToListen := { bName := "b1", iName := "i1", eventType := entity }, |
| cellRow := { |
| //state==idle |
| {actionList := { |
| {stepOrFunctionName := c_EPTF_LGenBase_stepName_fsmVarInc, contextArgs :={varParams := {"vf_callCounter",{intVal := 1}}}} |
| }, |
| nextStateCalculation := omit, |
| nextState := omit |
| } |
| } |
| } |
| ,{eventToListen := { bName := "b1", iName := "i2", eventType := entity }, |
| cellRow := { |
| //state==idle |
| {actionList := { |
| {stepOrFunctionName := c_EPTF_LGenBase_stepName_fsmVarInc, contextArgs :={varParams := {"vf_callCounter",{intVal := 1}}}} |
| }, |
| nextStateCalculation := omit, |
| nextState := omit |
| } |
| } |
| } |
| } |
| }//table |
| }//fsm //XCAPget_DOT:} |
| ) |
| v_dummyInt := f_EPTF_LGenBase_activateFsm(1, v_FSM, 0, -1) |
| //Out of range of v_LGenBase_entities |
| f_EPTF_LGenBase_dispatchEvent({{v_bIdx, v_iIdx, {1000, omit}, omit},{}}); |
| //Out of range of v_LGenBase_entities |
| f_EPTF_LGenBase_dispatchEvent({{v_bIdx, v_iIdx, {348, omit}, omit},{}}); |
| //Entity with activated FSM |
| f_EPTF_LGenBase_dispatchEvent({{v_bIdx, v_iIdx, {1, omit}, omit},{}}); |
| //Entity with inactive FSM |
| f_EPTF_LGenBase_dispatchEvent({{v_bIdx, v_iIdx, {60, omit}, omit},{}}); |
| //Out of range of v_LGenBase_entities |
| f_EPTF_LGenBase_dispatchEvent({{v_bIdx, v_iIdx, {260, omit}, omit},{}}); |
| var charstring vl_varName := f_EPTF_LGenBase_varNameOfFSMVar(1, 0, "vf_callCounter") |
| var integer vl_tcVarIdx := f_EPTF_Var_getId(vl_varName) |
| var EPTF_Var_DirectContent vl_content |
| f_EPTF_Var_getContent(vl_tcVarIdx, vl_content) |
| if(1 != vl_content.intVal){ |
| log(vl_content) |
| setverdict ( fail ); |
| }else{ |
| setverdict(pass) |
| } |
| f_EPTF_Base_cleanup_CT() |
| } |
| |
| testcase tc_dispatcEntityEvent4TC() |
| runs on EPTF_LGenBase_CT{ |
| f_EPTF_LGenBase_init("") |
| var integer |
| v_bIdx := f_EPTF_LGenBase_declareBehaviorType("b1", -1, null, null, null); |
| var integer |
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1", "i1") |
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1", "i3") |
| var integer |
| v_iIdx := f_EPTF_LGenBase_declareFsmEvent("b1", "i2") |
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("Entity_Tc_A", {"b1"}); |
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({name := "eg0", eType := "Entity_Tc_A", eCount := 25}) |
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({name := "eg1", eType := "Entity_Tc_A", eCount := 125}) |
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({name := "eg2", eType := "Entity_Tc_A", eCount := 200}) |
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable( |
| { |
| name := "statFSM", |
| fsmParams := { |
| {stateList := {"idle"}} |
| ,{varList := { |
| {name := "vf_callCounter", initValue := {intVal := 0}, scope := TC} |
| } |
| } |
| }, |
| table := { |
| classicTable := { |
| {eventToListen := { bName := "b1", iName := "i1", eventType := entity }, |
| cellRow := { |
| //state==idle |
| {actionList := { |
| {stepOrFunctionName := c_EPTF_LGenBase_stepName_fsmVarInc, contextArgs :={varParams := {"vf_callCounter",{intVal := 1}}}} |
| }, |
| nextStateCalculation := omit, |
| nextState := omit |
| } |
| } |
| } |
| ,{eventToListen := { bName := "b1", iName := "i2", eventType := entity }, |
| cellRow := { |
| //state==idle |
| {actionList := { |
| {stepOrFunctionName := c_EPTF_LGenBase_stepName_fsmVarInc, contextArgs :={varParams := {"vf_callCounter",{intVal := 1}}}} |
| }, |
| nextStateCalculation := omit, |
| nextState := omit |
| } |
| } |
| } |
| } |
| }//table |
| }//fsm //XCAPget_DOT:} |
| ) |
| v_dummyInt := f_EPTF_LGenBase_declareTcType2({ |
| name := "statTC", |
| fsmName := "statFSM", |
| entityType := "Entity_Tc_A", |
| customEntitySucc := "" |
| }) |
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3( |
| { |
| name := "sc1", |
| tcList := { |
| { tcName := "statTC0", |
| tcParamsList := { |
| {tcTypeName := "statTC"}, |
| {enableEntitiesAtStart := true}, |
| {enabledAtStart := false}, |
| {target := {cpsToReach := 1111.0}} |
| } |
| }, |
| { tcName := "tc1", |
| tcParamsList := { |
| {tcTypeName := "statTC"}, |
| {enableEntitiesAtStart := true}, |
| {enabledAtStart := true}, |
| {target := {cpsToReach := 1111.0}} |
| } |
| } |
| }, |
| scParamsList := { |
| {enabled := true} |
| } |
| }) |
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","sc1"}, false) |
| //Out of range of v_LGenBase_entities |
| f_EPTF_LGenBase_dispatchEvent({{v_bIdx, v_iIdx, {1000, omit}, omit},{}}); |
| //Entity in the 3rd entity group, rel idx> sizeof(entityGroup[1]) |
| f_EPTF_LGenBase_dispatchEvent({{v_bIdx, v_iIdx, {348, omit}, omit},{}}); |
| //Entity in the 1st entity group |
| f_EPTF_LGenBase_dispatchEvent({{v_bIdx, v_iIdx, {1, omit}, omit},{}}); |
| //Entity in the tc |
| f_EPTF_LGenBase_dispatchEvent({{v_bIdx, v_iIdx, {60, omit}, omit},{}}); |
| //Entity in the 3rd entity group, rel idx< sizeof(entityGroup[1]) |
| f_EPTF_LGenBase_dispatchEvent({{v_bIdx, v_iIdx, {260, omit}, omit},{}}); |
| var charstring vl_varName := f_EPTF_LGenBase_varNameOfTCVar(1, "vf_callCounter") |
| var integer vl_tcVarIdx := f_EPTF_Var_getId(vl_varName) |
| var EPTF_Var_DirectContent vl_content |
| f_EPTF_Var_getContent(vl_tcVarIdx, vl_content) |
| if(1 != vl_content.intVal){ |
| action(vl_content) |
| log(vl_content) |
| setverdict ( fail ); |
| }else{ |
| setverdict(pass) |
| } |
| f_EPTF_Base_cleanup_CT() |
| } |
| |
| group fsms{ |
| template EPTF_LGenBase_InternalFsmTable t_EPTF_LGenBaseTest_fsmCompare( |
| in charstring pl_name, |
| in EPTF_LGenBase_InternalFsmTable pl_table2Compare |
| ) := { |
| name := pl_name, |
| stateList := pl_table2Compare.stateList, |
| timerList := pl_table2Compare.timerList, |
| varListArray := pl_table2Compare.varListArray, |
| statisticListArray := pl_table2Compare.statisticListArray, |
| statMeasStatListArray := pl_table2Compare.statMeasStatListArray, |
| eventXref := pl_table2Compare.eventXref, |
| rows := pl_table2Compare.rows, |
| varCounts := pl_table2Compare.varCounts, |
| statisticCounts := pl_table2Compare.statisticCounts, |
| statMeasCounts := pl_table2Compare.statMeasCounts, |
| varNamesHash := ?, |
| stateNamesHash := ?, |
| statisticNamesHash := ?, |
| statMeasNamesHash := ?, |
| timerNamesHash := ?, |
| |
| varXRefs := pl_table2Compare.varXRefs, |
| statisticXRefs := pl_table2Compare.statisticXRefs, |
| statMeasXRefs := pl_table2Compare.statMeasXRefs, |
| paramValues := pl_table2Compare.paramValues, |
| |
| catchAllRowIdxList := pl_table2Compare.catchAllRowIdxList, |
| unhandledEventRowIdxList := pl_table2Compare.unhandledEventRowIdxList, |
| debugLight := ?, |
| referredFsmList := ?, |
| siblingListenerRowList := ?, |
| referredTCList := ? |
| } |
| |
| testcase tc_compareFSMs() |
| runs on EPTF_LGenBase_CT{ |
| const charstring c_fsmName := "CompareFSMs_paramed" |
| var EPTF_LGenBase_CompactFsmTableDeclarator vl_table := { |
| name := c_fsmName, |
| stateList := {"idle", "busy"}, |
| timerList := {{"timer",1.3}}, |
| table := { |
| {eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm}, |
| cellRow := { |
| {{{c_EPTF_LGenBase_stepName_timerStart, {timerName := "timer"}}}, omit, "busy"}, |
| {omit, omit, omit} |
| } |
| }, |
| {eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_stopTC,fsm}, |
| cellRow := { |
| {{{c_EPTF_LGenBase_stepName_entityStopped, omit}}, omit, omit}, |
| {{ |
| {c_EPTF_LGenBase_stepName_timerCancel, {timerName := "timer"}}, |
| {c_EPTF_LGenBase_stepName_entityStopped, omit}, |
| {c_EPTF_LGenBase_stepName_trafficSuccess, omit} |
| }, omit, "idle"} |
| } |
| }, |
| {eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_abortTC,fsm}, |
| cellRow := { |
| {{{c_EPTF_LGenBase_stepName_entityAborted, omit}}, omit, omit}, |
| {{ |
| {c_EPTF_LGenBase_stepName_timerCancel, {timerName := "timer"}}, |
| {c_EPTF_LGenBase_stepName_entityAborted, omit}, |
| {c_EPTF_LGenBase_stepName_trafficSuccess, omit} |
| }, omit, "idle"} |
| } |
| }, |
| {eventToListen := {c_EPTF_LGenBase_specialBName_timerTimeout,"timer",fsm}, |
| cellRow := { |
| {omit, omit, omit}, |
| {{{c_EPTF_LGenBase_stepName_trafficSuccess, omit}}, omit, "idle"} |
| } |
| } |
| } |
| } |
| var EPTF_LGenBase_FsmTableDeclarator vl_flexFsm1 := { |
| name := c_fsmName, |
| fsmParams := |
| { |
| {stateList := {"idle", "busy"}}, |
| {timerList := {{"timer",1.3}} |
| } |
| }, |
| table := { |
| classicTable := { |
| {eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm}, |
| cellRow := { |
| {{{c_EPTF_LGenBase_stepName_timerStart, {timerName := "timer"}}}, omit, "busy"}, |
| {omit, omit, omit} |
| } |
| }, |
| {eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_stopTC,fsm}, |
| cellRow := { |
| {{{c_EPTF_LGenBase_stepName_entityStopped, omit}}, omit, omit}, |
| {{ |
| {c_EPTF_LGenBase_stepName_timerCancel, {timerName := "timer"}}, |
| {c_EPTF_LGenBase_stepName_entityStopped, omit}, |
| {c_EPTF_LGenBase_stepName_trafficSuccess, omit} |
| }, omit, "idle"} |
| } |
| }, |
| {eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_abortTC,fsm}, |
| cellRow := { |
| {{{c_EPTF_LGenBase_stepName_entityAborted, omit}}, omit, omit}, |
| {{ |
| {c_EPTF_LGenBase_stepName_timerCancel, {timerName := "timer"}}, |
| {c_EPTF_LGenBase_stepName_entityAborted, omit}, |
| {c_EPTF_LGenBase_stepName_trafficSuccess, omit} |
| }, omit, "idle"} |
| } |
| }, |
| {eventToListen := {c_EPTF_LGenBase_specialBName_timerTimeout,"timer",fsm}, |
| cellRow := { |
| {omit, omit, omit}, |
| {{{c_EPTF_LGenBase_stepName_trafficSuccess, omit}}, omit, "idle"} |
| } |
| } |
| } |
| } |
| } |
| |
| var EPTF_LGenBase_FsmTableDeclarator vl_flexFsm2 := { |
| name := "FlexFsm2", |
| fsmParams := |
| { |
| {stateList := {"idle", "busy"}}, |
| {timerList := {{"timer",1.3}} |
| } |
| }, |
| table := { |
| extendedTable := { |
| { |
| events2Listen := {events := { {singleEvent := { |
| c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm |
| }}}}, |
| cellRow := { statedCellRow := { |
| { |
| inState := {state := "idle"}, |
| cell := {{{c_EPTF_LGenBase_stepName_timerStart, {timerName := "timer"}}}, omit, "busy"} |
| }, |
| { |
| inState := {state := "busy"}, |
| cell := {omit, omit, omit} |
| } |
| } |
| } |
| }, |
| { |
| events2Listen := {events := { {singleEvent := { |
| c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_stopTC,fsm} |
| }}}, |
| cellRow := { statedCellRow := { |
| { |
| inState := {state := "idle"}, |
| cell := {{{c_EPTF_LGenBase_stepName_entityStopped, omit}}, omit, omit} |
| }, |
| { |
| inState := {state := "busy"}, |
| cell := {{ |
| {c_EPTF_LGenBase_stepName_timerCancel, {timerName := "timer"}}, |
| {c_EPTF_LGenBase_stepName_entityStopped, omit}, |
| {c_EPTF_LGenBase_stepName_trafficSuccess, omit}} |
| , omit, "idle"} |
| } |
| } |
| } |
| }, |
| { |
| events2Listen := {events := { {singleEvent := { |
| c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_abortTC,fsm} |
| }}}, |
| cellRow := { statedCellRow := { |
| { |
| inState := {state := "idle"}, |
| cell := {{ |
| {c_EPTF_LGenBase_stepName_entityAborted, omit}}, omit, omit} |
| }, |
| { |
| inState := {state := "busy"}, |
| cell := {{ |
| {c_EPTF_LGenBase_stepName_timerCancel, {timerName := "timer"}}, |
| {c_EPTF_LGenBase_stepName_entityAborted, omit}, |
| {c_EPTF_LGenBase_stepName_trafficSuccess, omit} |
| }, omit, "idle"} |
| } |
| } |
| } |
| }, |
| { |
| events2Listen := {events := { {singleEvent := { |
| c_EPTF_LGenBase_specialBName_timerTimeout,"timer",fsm} |
| }}}, |
| cellRow := { statedCellRow := { |
| { |
| inState := {state := "idle"}, |
| cell := {omit, omit, omit} |
| }, |
| { |
| inState := {state := "busy"}, |
| cell := {{ |
| {c_EPTF_LGenBase_stepName_trafficSuccess, omit}}, omit, "idle"} |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| f_EPTF_LGenBase_init("compareFSMs") |
| var integer vl_fsmOrig := f_EPTF_LGenBase_declareParamedFsmTable(vl_table) |
| vl_flexFsm1.name := c_fsmName&"2" |
| var integer vl_fsmNew := f_EPTF_LGenBase_declareFSMTable(vl_flexFsm1) |
| if(match(f_EPTF_LGenBase_getFSMTable(vl_fsmOrig),t_EPTF_LGenBaseTest_fsmCompare(c_fsmName, f_EPTF_LGenBase_getFSMTable(vl_fsmNew)))){ |
| setverdict(pass) |
| }else{ |
| setverdict(fail) |
| log(match(f_EPTF_LGenBase_getFSMTable(vl_fsmOrig),t_EPTF_LGenBaseTest_fsmCompare(c_fsmName, f_EPTF_LGenBase_getFSMTable(vl_fsmNew)))) |
| } |
| vl_flexFsm1.name := c_fsmName&"3" |
| vl_fsmNew := f_EPTF_LGenBase_declareFSMTable(vl_flexFsm2) |
| if(match(f_EPTF_LGenBase_getFSMTable(vl_fsmOrig),t_EPTF_LGenBaseTest_fsmCompare(c_fsmName, f_EPTF_LGenBase_getFSMTable(vl_fsmNew)))){ |
| setverdict(pass) |
| }else{ |
| setverdict(fail) |
| log(match(f_EPTF_LGenBase_getFSMTable(vl_fsmOrig),t_EPTF_LGenBaseTest_fsmCompare(c_fsmName, f_EPTF_LGenBase_getFSMTable(vl_fsmNew)))) |
| } |
| f_EPTF_Base_cleanup_CT() |
| } |
| |
| const EPTF_IntegerList c_dummyArgs := {5,7,4,8} |
| |
| function f_EPTF_LGenBase_testFSMs_checkAddThreeInAnyStateMoveIdle( |
| in EPTF_LGenBase_TestStepArgs pl_ptr) |
| runs on testFSMs_CT |
| { |
| var EPTF_LGenBase_ReportedEventDescriptor vl_evetExpected := c_EPTF_LGenBase_emptyReportedEventDescriptor |
| vl_evetExpected.event.bIdx := v_testFSMs_behav |
| vl_evetExpected.event.iIdx := v_addThreeInAnyStateMoveIdle |
| vl_evetExpected.event.target.eIdx := pl_ptr.eIdx |
| vl_evetExpected.event.target.fsmCtxIdx := pl_ptr.refContext.fCtxIdx |
| vl_evetExpected.event.source := omit |
| vl_evetExpected.reportedArgs := c_dummyArgs |
| if(not match(pl_ptr.reportedEvent, vl_evetExpected)){ |
| setverdict(fail, log2str(match(pl_ptr.reportedEvent, vl_evetExpected))) |
| } |
| } |
| |
| type component testFSMs_CT extends EPTF_LGenBase_CT{ |
| var integer v_testFSMs_behav |
| var integer v_addTwoInBusy |
| var integer v_noListen |
| var integer v_addTwo2 |
| var integer v_addTwo3 |
| var integer v_addTwoOverlapped |
| var integer v_addTwoInBusyNineInIdle |
| var integer v_addThreeInAnyStateMoveIdle |
| var integer v_moveToThird |
| var integer v_moveToBusy |
| var integer v_addSevenInAnyFiveInBusy |
| var integer v_twoRowsAddSevenInThird |
| } |
| testcase tc_testFSMs() |
| runs on testFSMs_CT{ |
| f_EPTF_LGenBase_init("testFSMs") |
| v_testFSMs_behav := f_EPTF_LGenBase_declareBehaviorType("b1", -1, null, null, null); |
| v_addTwoInBusy := f_EPTF_LGenBase_declareFsmEvent("b1","addTwoInBusy"); |
| v_noListen := f_EPTF_LGenBase_declareFsmEvent("b1","noListen"); |
| v_addTwo2 := f_EPTF_LGenBase_declareFsmEvent("b1","addTwo2"); |
| v_addTwo3 := f_EPTF_LGenBase_declareFsmEvent("b1","addTwo3"); |
| v_addTwoOverlapped := f_EPTF_LGenBase_declareFsmEvent("b1","addTwoOverlapped"); |
| v_addTwoInBusyNineInIdle := f_EPTF_LGenBase_declareFsmEvent("b1","addTwoInBusyNineInIdle"); |
| v_addThreeInAnyStateMoveIdle := f_EPTF_LGenBase_declareFsmEvent("b1","addThreeInAnyStateMoveIdle"); |
| v_moveToThird := f_EPTF_LGenBase_declareFsmEvent("b1","moveToThird"); |
| v_moveToBusy := f_EPTF_LGenBase_declareFsmEvent("b1","moveToBusy"); |
| v_addSevenInAnyFiveInBusy := f_EPTF_LGenBase_declareFsmEvent("b1","addSevenInAnyFiveInBusy"); |
| v_twoRowsAddSevenInThird := f_EPTF_LGenBase_declareFsmEvent("b1","twoRowsAddSevenInThird"); |
| var integer |
| v_dummyInt := f_EPTF_LGenBase_declareStep("b1", {"checkAddThreeInAnyStateMoveIdle",refers(f_EPTF_LGenBase_testFSMs_checkAddThreeInAnyStateMoveIdle)}) |
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("et1", {"b1"}); |
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({"eg1", "et1", 1}) |
| var EPTF_LGenBase_FsmTableDeclarator vl_flexFsm1 := { |
| name := "FlexFsm1", |
| fsmParams := |
| { |
| {varList := { |
| { |
| name := "var1", |
| initValue := {intVal := 0}, |
| scope := FSM |
| } |
| }}, |
| {stateList := {"idle", "busy","third"}}, |
| {timerList := {{"timer",1.3}} |
| } |
| }, |
| table := { |
| extendedTable := { |
| { |
| events2Listen := {events := { |
| { singleEvent := {"b1","moveToBusy", fsm} } |
| }}, |
| cellRow := { statedCellRow := { |
| { |
| inState := {anyUndefinedState := {} }, |
| cell := { |
| omit, omit, "busy"} |
| } |
| } |
| } |
| }, |
| { |
| events2Listen := { |
| events := { |
| { singleEvent := {"b1","addTwoInBusy", fsm} }, |
| { eventRange := {"b1","addTwo2", "addTwoInBusyNineInIdle", fsm} }, // event range |
| { eventRange := {"b1","addTwo3", "addTwoOverlapped", fsm} }, // overlapped range |
| { eventList := {"b1", { "addTwo3", "addTwoOverlapped", "addTwoInBusyNineInIdle" }, fsm} }, // event list |
| { eventList := {"b1", {}, fsm} } // empty list |
| } |
| }, |
| cellRow := { statedCellRow := { |
| { |
| inState := {state := "busy"}, |
| cell := { |
| {{"LGenBase: Increment variable",{varParams := {"var1",{intVal := 2}}}}}, omit, omit} |
| } |
| } // classicCellRow |
| } // cellRow |
| }, |
| { |
| events2Listen := {events := { |
| { singleEvent := {"b1","addTwoInBusyNineInIdle", fsm} } |
| }}, |
| cellRow := { statedCellRow := { |
| { |
| inState := {state := "idle"}, |
| cell := { |
| {{"LGenBase: Increment variable",{varParams := {"var1",{intVal := 9}}}}} |
| , omit, omit} |
| } |
| } |
| } |
| }, |
| { |
| events2Listen := {events := { |
| { singleEvent := {"b1","twoRowsAddSevenInThird", fsm} } |
| }}, |
| cellRow := { statedCellRow := { |
| { |
| inState := {state := "third"}, |
| cell := { |
| {{"LGenBase: Increment variable",{varParams := {"var1",{intVal := 3}}}}} |
| , omit, omit} |
| } |
| } |
| } |
| }, |
| { |
| events2Listen := {events := { |
| { singleEvent := {"b1","twoRowsAddSevenInThird", fsm} } |
| }}, |
| cellRow := { statedCellRow := { |
| { |
| inState := {state := "third"}, |
| cell := { |
| {{"LGenBase: Increment variable",{varParams := {"var1",{intVal := 4}}}}} |
| , omit, omit} |
| } |
| } |
| } |
| }, |
| { |
| events2Listen := {events := { |
| { singleEvent := {"b1","addThreeInAnyStateMoveIdle", fsm} } |
| }}, |
| cellRow := { statedCellRow := { |
| { |
| inState := {anyUndefinedState := {} }, |
| cell := { |
| { |
| {"LGenBase: Increment variable",{varParams := {"var1",{intVal := 3}}}}, |
| {"checkAddThreeInAnyStateMoveIdle",omit} |
| } |
| , omit, "idle"} |
| } |
| } |
| } |
| }, |
| { |
| events2Listen := {events := { |
| { singleEvent := {"b1","moveToThird", fsm} } |
| }}, |
| cellRow := { statedCellRow := { |
| { |
| inState := {stateList := {"busy","idle"}}, |
| cell := { |
| omit |
| , omit, "third"} |
| } |
| } |
| } |
| }, |
| { |
| events2Listen := {events := { |
| { singleEvent := {"b1","addSevenInAnyFiveInBusy", fsm} } |
| }}, |
| cellRow := { statedCellRow := { |
| { |
| inState := {state := "busy"}, |
| cell := { |
| {{"LGenBase: Increment variable",{varParams := {"var1",{intVal := 5}}}}} |
| , omit, omit} |
| }, |
| { |
| inState := {anyUndefinedState := {} }, |
| cell := { |
| {{"LGenBase: Increment variable",{varParams := {"var1",{intVal := 7}}}}} |
| , omit, omit} |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| //twoRowsAddSevenInThird |
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable(vl_flexFsm1) |
| v_dummyInt := f_EPTF_LGenBase_declareTcType2({ |
| "TC1", |
| "FlexFsm1", |
| "et1", |
| "" |
| }) |
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3( |
| { "SC1", |
| { |
| {"TC1",{{target := {cpsToReach := 0.0}}}} |
| }, |
| {} |
| }) |
| var integer vl_expected := 0 |
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false) |
| var EPTF_Var_DirectContent vl_content; |
| var integer vl_var1 := f_EPTF_Var_getId(f_EPTF_LGenBase_varNameOfFSMVar(0,0,"var1")) |
| if(vl_var1 < 0){ |
| setverdict(fail,"The variable can't be reached.") |
| } |
| f_checkContent(vl_var1,vl_expected) |
| //-------sate idle |
| if(tsp_EPTF_LGenBaseTestDebug){ |
| log("Check no listener") |
| } |
| f_EPTF_LGenBase_dispatchEvent({ { v_testFSMs_behav, v_noListen, {0,0}, omit}, {} }); |
| f_checkContent(vl_var1,vl_expected) |
| |
| if(tsp_EPTF_LGenBaseTestDebug){ |
| log("Check anyState when there is no defined state") |
| } |
| vl_expected := vl_expected +7 |
| f_EPTF_LGenBase_dispatchEvent({ { v_testFSMs_behav, v_addSevenInAnyFiveInBusy, {0,0}, omit}, {} }); |
| f_checkContent(vl_var1,vl_expected) |
| |
| if(tsp_EPTF_LGenBaseTestDebug){ |
| log("Check different listeners in idle state") |
| } |
| vl_expected := vl_expected +9 |
| f_EPTF_LGenBase_dispatchEvent({ { v_testFSMs_behav, v_addTwoInBusyNineInIdle, {0,0}, omit}, {} }); |
| f_checkContent(vl_var1,vl_expected) |
| |
| // |
| if(tsp_EPTF_LGenBaseTestDebug){ |
| log("Check anyState in idle") |
| } |
| vl_expected := vl_expected +3 |
| f_EPTF_LGenBase_dispatchEvent({ { v_testFSMs_behav, v_addThreeInAnyStateMoveIdle, {0,0}, omit}, c_dummyArgs }); |
| f_checkContent(vl_var1,vl_expected) |
| |
| if(tsp_EPTF_LGenBaseTestDebug){ |
| log("Check no action in the state") |
| } |
| //vl_expected := vl_expected +0 |
| f_EPTF_LGenBase_dispatchEvent({ { v_testFSMs_behav, v_addTwoOverlapped, {0,0}, omit}, {} }); |
| f_checkContent(vl_var1,vl_expected) |
| |
| // |
| if(tsp_EPTF_LGenBaseTestDebug){ |
| log("Check anyState when there is a defined state") |
| } |
| f_EPTF_LGenBase_dispatchEvent({ { v_testFSMs_behav, v_moveToBusy, {0,0}, omit}, {} }); |
| //-------sate busy |
| vl_expected := vl_expected +5 |
| f_EPTF_LGenBase_dispatchEvent({ { v_testFSMs_behav, v_addSevenInAnyFiveInBusy, {0,0}, omit}, {} }); |
| f_checkContent(vl_var1,vl_expected) |
| |
| vl_expected := vl_expected +2 |
| f_EPTF_LGenBase_dispatchEvent({ { v_testFSMs_behav, v_addTwoOverlapped, {0,0}, omit}, {} }); |
| f_checkContent(vl_var1,vl_expected) |
| |
| if(tsp_EPTF_LGenBaseTestDebug){ |
| log("Check different listeners in busy state") |
| } |
| vl_expected := vl_expected +2 |
| f_EPTF_LGenBase_dispatchEvent({ { v_testFSMs_behav, v_addTwoInBusyNineInIdle, {0,0}, omit}, {} }); |
| f_checkContent(vl_var1,vl_expected) |
| |
| if(tsp_EPTF_LGenBaseTestDebug){ |
| log("Check anyState in busy") |
| } |
| vl_expected := vl_expected +3 |
| f_EPTF_LGenBase_dispatchEvent({ { v_testFSMs_behav, v_addThreeInAnyStateMoveIdle, {0,0}, omit}, c_dummyArgs }); |
| f_checkContent(vl_var1,vl_expected) |
| |
| f_EPTF_LGenBase_dispatchEvent({ { v_testFSMs_behav, v_moveToThird, {0,0}, omit}, {} }); |
| //-------sate third |
| |
| vl_expected := vl_expected +7 |
| f_EPTF_LGenBase_dispatchEvent({ { v_testFSMs_behav, v_addSevenInAnyFiveInBusy, {0,0}, omit}, {} }); |
| f_checkContent(vl_var1,vl_expected) |
| |
| //vl_expected := vl_expected +0 |
| f_EPTF_LGenBase_dispatchEvent({ { v_testFSMs_behav, v_addTwoOverlapped, {0,0}, omit}, {} }); |
| f_checkContent(vl_var1,vl_expected) |
| |
| //vl_expected := vl_expected +0 |
| f_EPTF_LGenBase_dispatchEvent({ { v_testFSMs_behav, v_addTwoInBusyNineInIdle, {0,0}, omit}, {} }); |
| f_checkContent(vl_var1,vl_expected) |
| |
| vl_expected := vl_expected +3 |
| f_EPTF_LGenBase_dispatchEvent({ { v_testFSMs_behav, v_addThreeInAnyStateMoveIdle, {0,0}, omit}, c_dummyArgs }); |
| f_checkContent(vl_var1,vl_expected) |
| setverdict(pass) |
| f_EPTF_Base_cleanup_CT() |
| } |
| |
| function f_checkContent(in integer pl_varId, in integer pl_expected) |
| runs on EPTF_Var_CT{ |
| var EPTF_Var_DirectContent vl_content; |
| f_EPTF_Var_getContent(pl_varId, vl_content); |
| if(not match(vl_content, {intVal := pl_expected})){ |
| setverdict(fail,"The content of the variable should be "&int2str(pl_expected)&" instead of ",vl_content) |
| } |
| } |
| } |
| |
| testcase tc_fsmDeclCompare() runs on EPTF_LGenBase_CT{ |
| const charstring c_fsmName := "fsmDeclCompare" |
| var EPTF_LGenBase_FsmTableDeclarator vl_decl1 := { |
| name := c_fsmName, |
| fsmParams := { |
| { |
| stateList := { |
| "idle", |
| "initiated", |
| "retryAfter" |
| } |
| }, |
| { |
| timerList := { |
| { |
| name := "T_userWatchdog", |
| startValue := 40.000000 |
| }, |
| { |
| name := "T_retryAfter", |
| startValue := 5.000000 |
| } |
| } |
| }, |
| { |
| varList := { |
| { |
| name := "vi_retryAfter", |
| initValue := { |
| intVal := 0 |
| }, |
| scope := FSM |
| } |
| } |
| }, |
| { |
| statHandlerStatList := { |
| { |
| name := "Retry-Afters", |
| providers := { |
| { |
| varList := { |
| "vi_retryAfter" |
| } |
| } |
| }, |
| statMethod := "Sum", |
| statResetValue := { |
| intVal := 0 |
| }, |
| scope := TC |
| } |
| } |
| }, |
| { |
| varList := { |
| { |
| name := "vi_reqSent", |
| initValue := { |
| intVal := 0 |
| }, |
| scope := TC |
| }, |
| { |
| name := "vi_reqSendError", |
| initValue := { |
| intVal := 0 |
| }, |
| scope := TC |
| }, |
| { |
| name := "vi_reqRecvOk", |
| initValue := { |
| intVal := 0 |
| }, |
| scope := TC |
| }, |
| { |
| name := "vi_reqRecvNOk", |
| initValue := { |
| intVal := 0 |
| }, |
| scope := TC |
| }, |
| { |
| name := "vi_respRecvOk", |
| initValue := { |
| intVal := 0 |
| }, |
| scope := TC |
| }, |
| { |
| name := "vi_respRecvNOk", |
| initValue := { |
| intVal := 0 |
| }, |
| scope := TC |
| }, |
| { |
| name := "vi_timeOut", |
| initValue := { |
| intVal := 0 |
| }, |
| scope := TC |
| }, |
| { |
| name := "vf_rtt", |
| initValue := { |
| floatVal := 0.000000 |
| }, |
| scope := TC |
| } |
| } |
| }, |
| { |
| statMeasWithParamsList := { |
| { |
| name := "l_latency", |
| providerVarName := "", |
| targetVarName := "vf_rtt", |
| statMeasParams := { |
| statType := chrono |
| }, |
| scope := FSM |
| } |
| } |
| }, |
| { |
| statHandlerStatList := { |
| { |
| name := "ReqSent", |
| providers := { |
| { |
| varList := { |
| "vi_reqSent" |
| } |
| } |
| }, |
| statMethod := "Sum", |
| statResetValue := { |
| intVal := 0 |
| }, |
| scope := TC |
| }, |
| { |
| name := "ReqSentInError", |
| providers := { |
| { |
| varList := { |
| "vi_reqSendError" |
| } |
| } |
| }, |
| statMethod := "Sum", |
| statResetValue := { |
| intVal := 0 |
| }, |
| scope := TC |
| }, |
| { |
| name := "RequestsReceivedOk", |
| providers := { |
| { |
| varList := { |
| "vi_reqRecvOk" |
| } |
| } |
| }, |
| statMethod := "Sum", |
| statResetValue := { |
| intVal := 0 |
| }, |
| scope := TC |
| } |
| } |
| }, |
| { |
| statMeasWithParamsList := { |
| { |
| name := "l_m_rtt", |
| providerVarName := "vf_rtt", |
| targetVarName := "", |
| statMeasParams := { |
| params := { |
| percentileP := { |
| valueP := 0.500000, |
| density := { |
| scale := { |
| min := 0.010000, |
| max := 5.000000, |
| n := 20, |
| scale := logarithmic |
| } |
| } |
| } |
| } |
| }, |
| scope := TC |
| }, |
| { |
| name := "l_p95_rtt", |
| providerVarName := "vf_rtt", |
| targetVarName := "", |
| statMeasParams := { |
| params := { |
| percentile95 := { |
| scale := { |
| min := 0.010000, |
| max := 5.000000, |
| n := 20, |
| scale := logarithmic |
| } |
| } |
| } |
| }, |
| scope := TC |
| }, |
| { |
| name := "l_d_rtt", |
| providerVarName := "vf_rtt", |
| targetVarName := "", |
| statMeasParams := { |
| params := { |
| density := { |
| scale := { |
| min := 0.010000, |
| max := 5.000000, |
| n := 20, |
| scale := logarithmic |
| } |
| } |
| } |
| }, |
| scope := TC |
| } |
| } |
| }, |
| { |
| statHandlerStatList := { |
| { |
| name := "RequestsReceivedNOk", |
| providers := { |
| { |
| varList := { |
| "vi_reqRecvNOk" |
| } |
| } |
| }, |
| statMethod := "Sum", |
| statResetValue := { |
| intVal := 0 |
| }, |
| scope := TC |
| }, |
| { |
| name := "ResponsesReceivedOk", |
| providers := { |
| { |
| varList := { |
| "vi_respRecvOk" |
| } |
| } |
| }, |
| statMethod := "Sum", |
| statResetValue := { |
| intVal := 0 |
| }, |
| scope := TC |
| }, |
| { |
| name := "ResponsesReceivedNOk", |
| providers := { |
| { |
| varList := { |
| "vi_respRecvNOk" |
| } |
| } |
| }, |
| statMethod := "Sum", |
| statResetValue := { |
| intVal := 0 |
| }, |
| scope := TC |
| }, |
| { |
| name := "timeOuts", |
| providers := { |
| { |
| varList := { |
| "vi_timeOut" |
| } |
| } |
| }, |
| statMethod := "Sum", |
| statResetValue := { |
| intVal := 0 |
| }, |
| scope := TC |
| }, |
| { |
| name := "latency_percentile95", |
| providers := { |
| { |
| statMeas := "l_p95_rtt" |
| } |
| }, |
| statMethod := "Percentile95", |
| statResetValue := { |
| floatVal := 0.000000 |
| }, |
| scope := TC |
| }, |
| { |
| name := "latency_median", |
| providers := { |
| { |
| statMeas := "l_m_rtt" |
| } |
| }, |
| statMethod := "PercentileP", |
| statResetValue := { |
| floatVal := 0.000000 |
| }, |
| scope := TC |
| }, |
| { |
| name := "latency", |
| providers := { |
| { |
| statMeas := "l_d_rtt" |
| } |
| }, |
| statMethod := "Density", |
| statResetValue := { |
| integerlistVal := { |
| 0,0,0,0,0, |
| 0,0,0,0,0, |
| 0,0,0,0,0, |
| 0,0,0,0,0, |
| 0 |
| } |
| }, |
| scope := TC |
| } |
| } |
| } |
| }, |
| table := { |
| classicTable := { |
| { |
| eventToListen := { |
| bName := "EPTF_CLL_LGenBase", |
| iName := "LGenBase: Start_the_traffic_case!", |
| eventType := fsm |
| }, |
| cellRow := { |
| { |
| actionList := { |
| { |
| stepOrFunctionName := c_EPTF_LGenBase_stepName_recordEntityStart, |
| contextArgs := omit |
| }, |
| { |
| stepOrFunctionName := "LGenBase: StepFunction_timerStart", |
| contextArgs := { |
| timerName := "T_userWatchdog" |
| } |
| }, |
| { |
| stepOrFunctionName := c_EPTF_LGenBase_stepName_entityAborted, |
| contextArgs := omit |
| }, |
| { |
| stepOrFunctionName := "LGenBase: Reset chronometer", |
| contextArgs := { |
| statMeasName := "l_latency" |
| } |
| }, |
| { |
| stepOrFunctionName := "LGenBase: Start chronometer", |
| contextArgs := { |
| statMeasName := "l_latency" |
| } |
| }, |
| { |
| stepOrFunctionName := "LGenBase: Increment variable", |
| contextArgs := { |
| varParams := { |
| varName := "vi_reqSent", |
| paramValue := { |
| intVal := 1 |
| } |
| } |
| } |
| } |
| }, |
| nextStateCalculation := omit, |
| nextState := "initiated" |
| }, |
| { |
| actionList := omit, |
| nextStateCalculation := omit, |
| nextState := omit |
| }, |
| { |
| actionList := omit, |
| nextStateCalculation := omit, |
| nextState := omit |
| } |
| } |
| } |
| } |
| } |
| } |
| var EPTF_LGenBase_FsmTableDeclarator vl_decl2 := { |
| name := c_fsmName&"2", |
| fsmParams := { |
| { |
| stateList := { |
| "idle", |
| "initiated", |
| "retryAfter" |
| } |
| }, |
| { |
| timerList := { |
| { |
| name := "T_userWatchdog", |
| startValue := 40.000000 |
| }, |
| { |
| name := "T_retryAfter", |
| startValue := 5.000000 |
| } |
| } |
| }, |
| { |
| varList := { |
| { |
| name := "vi_retryAfter", |
| initValue := { |
| intVal := 0 |
| }, |
| scope := FSM |
| }, |
| { |
| name := "vi_reqSent", |
| initValue := { |
| intVal := 0 |
| }, |
| scope := TC |
| }, |
| { |
| name := "vi_reqSendError", |
| initValue := { |
| intVal := 0 |
| }, |
| scope := TC |
| }, |
| { |
| name := "vi_reqRecvOk", |
| initValue := { |
| intVal := 0 |
| }, |
| scope := TC |
| }, |
| { |
| name := "vi_reqRecvNOk", |
| initValue := { |
| intVal := 0 |
| }, |
| scope := TC |
| }, |
| { |
| name := "vi_respRecvOk", |
| initValue := { |
| intVal := 0 |
| }, |
| scope := TC |
| }, |
| { |
| name := "vi_respRecvNOk", |
| initValue := { |
| intVal := 0 |
| }, |
| scope := TC |
| }, |
| { |
| name := "vi_timeOut", |
| initValue := { |
| intVal := 0 |
| }, |
| scope := TC |
| }, |
| { |
| name := "vf_rtt", |
| initValue := { |
| floatVal := 0.000000 |
| }, |
| scope := TC |
| } |
| } |
| }, |
| { |
| statHandlerStatList := { |
| { |
| name := "Retry-Afters", |
| providers := { |
| { |
| varList := { |
| "vi_retryAfter" |
| } |
| } |
| }, |
| statMethod := "Sum", |
| statResetValue := { |
| intVal := 0 |
| }, |
| scope := TC |
| }, |
| { |
| name := "ReqSent", |
| providers := { |
| { |
| varList := { |
| "vi_reqSent" |
| } |
| } |
| }, |
| statMethod := "Sum", |
| statResetValue := { |
| intVal := 0 |
| }, |
| scope := TC |
| }, |
| { |
| name := "ReqSentInError", |
| providers := { |
| { |
| varList := { |
| "vi_reqSendError" |
| } |
| } |
| }, |
| statMethod := "Sum", |
| statResetValue := { |
| intVal := 0 |
| }, |
| scope := TC |
| }, |
| { |
| name := "RequestsReceivedOk", |
| providers := { |
| { |
| varList := { |
| "vi_reqRecvOk" |
| } |
| } |
| }, |
| statMethod := "Sum", |
| statResetValue := { |
| intVal := 0 |
| }, |
| scope := TC |
| }, |
| { |
| name := "RequestsReceivedNOk", |
| providers := { |
| { |
| varList := { |
| "vi_reqRecvNOk" |
| } |
| } |
| }, |
| statMethod := "Sum", |
| statResetValue := { |
| intVal := 0 |
| }, |
| scope := TC |
| }, |
| { |
| name := "ResponsesReceivedOk", |
| providers := { |
| { |
| varList := { |
| "vi_respRecvOk" |
| } |
| } |
| }, |
| statMethod := "Sum", |
| statResetValue := { |
| intVal := 0 |
| }, |
| scope := TC |
| }, |
| { |
| name := "ResponsesReceivedNOk", |
| providers := { |
| { |
| varList := { |
| "vi_respRecvNOk" |
| } |
| } |
| }, |
| statMethod := "Sum", |
| statResetValue := { |
| intVal := 0 |
| }, |
| scope := TC |
| }, |
| { |
| name := "timeOuts", |
| providers := { |
| { |
| varList := { |
| "vi_timeOut" |
| } |
| } |
| }, |
| statMethod := "Sum", |
| statResetValue := { |
| intVal := 0 |
| }, |
| scope := TC |
| }, |
| { |
| name := "latency_percentile95", |
| providers := { |
| { |
| statMeas := "l_p95_rtt" |
| } |
| }, |
| statMethod := "Percentile95", |
| statResetValue := { |
| floatVal := 0.000000 |
| }, |
| scope := TC |
| }, |
| { |
| name := "latency_median", |
| providers := { |
| { |
| statMeas := "l_m_rtt" |
| } |
| }, |
| statMethod := "PercentileP", |
| statResetValue := { |
| floatVal := 0.000000 |
| }, |
| scope := TC |
| }, |
| { |
| name := "latency", |
| providers := { |
| { |
| statMeas := "l_d_rtt" |
| } |
| }, |
| statMethod := "Density", |
| statResetValue := { |
| integerlistVal := { |
| 0,0,0,0,0, |
| 0,0,0,0,0, |
| 0,0,0,0,0, |
| 0,0,0,0,0, |
| 0 |
| } |
| }, |
| scope := TC |
| } |
| } |
| }, |
| { |
| statMeasWithParamsList := { |
| { |
| name := "l_latency", |
| providerVarName := "", |
| targetVarName := "vf_rtt", |
| statMeasParams := { |
| statType := chrono |
| }, |
| scope := FSM |
| }, |
| { |
| name := "l_m_rtt", |
| providerVarName := "vf_rtt", |
| targetVarName := "", |
| statMeasParams := { |
| params := { |
| percentileP := { |
| valueP := 0.500000, |
| density := { |
| scale := { |
| min := 0.010000, |
| max := 5.000000, |
| n := 20, |
| scale := logarithmic |
| } |
| } |
| } |
| } |
| }, |
| scope := TC |
| }, |
| { |
| name := "l_p95_rtt", |
| providerVarName := "vf_rtt", |
| targetVarName := "", |
| statMeasParams := { |
| params := { |
| percentile95 := { |
| scale := { |
| min := 0.010000, |
| max := 5.000000, |
| n := 20, |
| scale := logarithmic |
| } |
| } |
| } |
| }, |
| scope := TC |
| }, |
| { |
| name := "l_d_rtt", |
| providerVarName := "vf_rtt", |
| targetVarName := "", |
| statMeasParams := { |
| params := { |
| density := { |
| scale := { |
| min := 0.010000, |
| max := 5.000000, |
| n := 20, |
| scale := logarithmic |
| } |
| } |
| } |
| }, |
| scope := TC |
| } |
| } |
| } |
| }, |
| table := { |
| classicTable := { |
| { |
| eventToListen := { |
| bName := "EPTF_CLL_LGenBase", |
| iName := "LGenBase: Start_the_traffic_case!", |
| eventType := fsm |
| }, |
| cellRow := { |
| { |
| actionList := { |
| { |
| stepOrFunctionName := c_EPTF_LGenBase_stepName_recordEntityStart, |
| contextArgs := omit |
| }, |
| { |
| stepOrFunctionName := "LGenBase: StepFunction_timerStart", |
| contextArgs := { |
| timerName := "T_userWatchdog" |
| } |
| }, |
| { |
| stepOrFunctionName := c_EPTF_LGenBase_stepName_entityAborted, |
| contextArgs := omit |
| }, |
| { |
| stepOrFunctionName := "LGenBase: Reset chronometer", |
| contextArgs := { |
| statMeasName := "l_latency" |
| } |
| }, |
| { |
| stepOrFunctionName := "LGenBase: Start chronometer", |
| contextArgs := { |
| statMeasName := "l_latency" |
| } |
| }, |
| { |
| stepOrFunctionName := "LGenBase: Increment variable", |
| contextArgs := { |
| varParams := { |
| varName := "vi_reqSent", |
| paramValue := { |
| intVal := 1 |
| } |
| } |
| } |
| } |
| }, |
| nextStateCalculation := omit, |
| nextState := "initiated" |
| }, |
| { |
| actionList := omit, |
| nextStateCalculation := omit, |
| nextState := omit |
| }, |
| { |
| actionList := omit, |
| nextStateCalculation := omit, |
| nextState := omit |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| f_EPTF_LGenBase_init("tc_fsmDecl") |
| |
| var integer v_fsm1 := f_EPTF_LGenBase_declareFSMTable(vl_decl1) |
| var integer v_fsm2 := f_EPTF_LGenBase_declareFSMTable(vl_decl2) |
| if(tsp_EPTF_LGenBaseTestDebug){ |
| log("FSM1: ",f_EPTF_LGenBase_getFSMTable(v_fsm1)) |
| log("FSM2: ",f_EPTF_LGenBase_getFSMTable(v_fsm2)) |
| } |
| if(match(f_EPTF_LGenBase_getFSMTable(v_fsm1),t_EPTF_LGenBaseTest_fsmCompare(c_fsmName, f_EPTF_LGenBase_getFSMTable(v_fsm2)))){ |
| setverdict(pass) |
| }else{ |
| setverdict(fail) |
| log(match(f_EPTF_LGenBase_getFSMTable(v_fsm1),t_EPTF_LGenBaseTest_fsmCompare(c_fsmName, f_EPTF_LGenBase_getFSMTable(v_fsm2)))) |
| } |
| f_EPTF_Base_cleanup_CT() |
| } |
| |
| function f_testStep_setverdictFail( |
| in EPTF_LGenBase_TestStepArgs pl_ptr) |
| runs on EPTF_LGenBase_CT |
| { |
| log(%definitionId&": called."); |
| setverdict(fail); |
| } |
| |
| testcase tc_fsmCancelAllTimers() |
| runs on EPTF_LGenBase_CT |
| { |
| const charstring c_fsmName := "theFsm"; |
| const charstring c_myBehavior := "myBehavior"; |
| const charstring c_eventName_cancelAllTimers := "cancelAllTimers"; |
| const charstring c_eventName_startTimers := "startTimers"; |
| const charstring c_stepName_setverdictFail := "stepName_setverdictFail"; |
| const charstring c_entityType := "entityType"; |
| const charstring c_entityGrp := "entityGrp"; |
| var EPTF_LGenBase_FsmTableDeclarator vl_decl := { |
| name := c_fsmName, |
| fsmParams := { |
| { |
| stateList := { |
| "theState" |
| } |
| }, |
| { |
| timerList := { |
| { |
| name := "T1", |
| startValue := 7.000000 |
| }, |
| { |
| name := "T2", |
| startValue := 5.000000 |
| } |
| } |
| } |
| }, |
| table := { |
| classicTable := { |
| { |
| eventToListen := { |
| bName := c_myBehavior, |
| iName := c_eventName_startTimers, |
| eventType := fsm |
| }, |
| cellRow := { |
| { |
| actionList := { |
| { |
| stepOrFunctionName := c_EPTF_LGenBase_stepName_timerStart, |
| contextArgs := {timerName := "T1"} |
| }, |
| { |
| stepOrFunctionName := c_EPTF_LGenBase_stepName_timerStart, |
| contextArgs := {timerName := "T2"} |
| } |
| }, |
| nextStateCalculation := omit, |
| nextState := omit |
| } |
| } |
| }, |
| { |
| eventToListen := { |
| bName := c_myBehavior, |
| iName := c_eventName_cancelAllTimers, |
| eventType := fsm |
| }, |
| cellRow := { |
| { |
| actionList := { |
| { |
| stepOrFunctionName := c_EPTF_LGenBase_stepName_cancelAllTimers, |
| contextArgs := omit |
| } |
| }, |
| nextStateCalculation := omit, |
| nextState := omit |
| } |
| } |
| }, |
| { |
| eventToListen := { |
| bName := c_EPTF_LGenBase_specialBName_timerTimeout, |
| iName := "T1", |
| eventType := fsm |
| }, |
| cellRow := { |
| { |
| actionList := { |
| { |
| stepOrFunctionName := c_stepName_setverdictFail, |
| contextArgs := omit |
| } |
| }, |
| nextStateCalculation := omit, |
| nextState := omit |
| } |
| } |
| }, |
| { |
| eventToListen := { |
| bName := c_EPTF_LGenBase_specialBName_timerTimeout, |
| iName := "T2", |
| eventType := fsm |
| }, |
| cellRow := { |
| { |
| actionList := { |
| { |
| stepOrFunctionName := c_stepName_setverdictFail, |
| contextArgs := omit |
| } |
| }, |
| nextStateCalculation := omit, |
| nextState := omit |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| f_EPTF_LGenBase_init(""); |
| |
| var integer vl_bIdx := f_EPTF_LGenBase_declareBehaviorType(c_myBehavior, -1, null, null, null) |
| var integer vl_dummyInt := f_EPTF_LGenBase_declareEntityType(c_entityType,{c_myBehavior}); |
| vl_dummyInt := f_EPTF_LGenBase_createEntityGroup({c_entityGrp,c_entityType,1}); |
| |
| var integer v_eventIdx_cancelAllTimers := |
| f_EPTF_LGenBase_declareFsmEvent(c_myBehavior, c_eventName_cancelAllTimers) |
| var integer v_eventIdx_startTimers := |
| f_EPTF_LGenBase_declareFsmEvent(c_myBehavior, c_eventName_startTimers) |
| |
| vl_dummyInt := f_EPTF_LGenBase_declareStep(c_myBehavior, {c_stepName_setverdictFail,refers(f_testStep_setverdictFail)}) |
| |
| var integer vl_fsm := f_EPTF_LGenBase_declareFSMTable(vl_decl) |
| |
| vl_dummyInt := f_EPTF_LGenBase_activateFsm(pl_eIdx:= 0, pl_tIdx:= vl_fsm, pl_sIdx:=0, pl_tcIdx:= -1) |
| |
| timer T; |
| T.start(1.0); |
| T.timeout; |
| f_EPTF_LGenBase_dispatchEvent({{vl_bIdx, v_eventIdx_startTimers, {0,0}, omit},{}}); |
| T.start(1.0); |
| T.timeout; |
| f_EPTF_LGenBase_dispatchEvent({{vl_bIdx, v_eventIdx_cancelAllTimers, {0,0}, omit},{}}); |
| T.start(10.0); |
| T.timeout; |
| setverdict(pass); |
| f_EPTF_Base_cleanup_CT(); |
| } |
| |
| //This TestCase tests if the f_EPTF_LGenBase_declareFSMTables() function can create |
| //the FSMTables given in its argument |
| // - it uses dummy FSM tables |
| // - the verdict will be pass only if all the FSMTables are created successfully |
| testcase tc_EPTF_LGenBase_Test_declareFSMTables() |
| runs on EPTF_LGenBase_CT{ |
| var EPTF_LGenBase_FsmTableDeclaratorList vl_EPTF_LGenBase_FsmTableDeclaratorList :={ |
| { |
| name := "start", |
| fsmParams := { |
| {stateList := {"idle"}} |
| }, |
| table := { |
| classicTable := { |
| {eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm}, |
| cellRow := { |
| {{ |
| {c_EPTF_LGenBase_stepName_testFinished, omit} |
| }, omit, omit} |
| } |
| } |
| } |
| } |
| }, |
| { |
| name := "stop", |
| fsmParams := { |
| {stateList := {"idle"}} |
| }, |
| table := { |
| classicTable := { |
| {eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm}, |
| cellRow := { |
| {{ |
| {c_EPTF_LGenBase_stepName_testFinished, omit} |
| }, omit, omit} |
| } |
| } |
| } |
| } |
| } |
| } |
| f_EPTF_LGenBase_init("LGenBase_declareFSMTables"); |
| |
| var EPTF_IntegerList vl_FSMTableIdx_List := |
| f_EPTF_LGenBase_declareFSMTables(vl_EPTF_LGenBase_FsmTableDeclaratorList); |
| |
| for ( var integer i := 0; i < sizeof(vl_FSMTableIdx_List) ; i := i+1 ){ |
| if (vl_FSMTableIdx_List[i] == -1){ |
| setverdict(fail); |
| break; |
| } |
| } |
| setverdict(pass); |
| f_EPTF_Base_cleanup_CT(); |
| |
| } |
| |
| //this function is for the testcase |
| //tc_EPTF_LGenBase_Test_FsmGetFunctions |
| function f_EPTF_LGenBase_step_forFsmGetFunctionsTc(in EPTF_LGenBase_TestStepArgs pl_args) |
| runs on fsmGetFunctions_CT |
| { |
| //testing f_EPTF_LGenBase_getFsmIdxOfTc |
| //the return value of the function should be equal |
| //with the index of the FSM created above |
| var integer vl_tcIdx := f_EPTF_LGenBase_tcIdxOfStep(pl_args) |
| if(f_EPTF_LGenBase_getFsmIdxOfTc(vl_tcIdx) != v_fsmIndex){ |
| setverdict ( fail ); |
| } |
| //testing f_EPTF_LGenBase_getFsmNameOfTc |
| //(and f_EPTF_LGenBase_getFsmName) |
| //the return value of the function should be equal |
| //with the name of the FSM created above |
| if (f_EPTF_LGenBase_getFsmNameOfTc(vl_tcIdx) != "testFSM"){ |
| setverdict ( fail ); |
| } |
| |
| //testing f_EPTF_LGenBase_getFsmIndexByCtxIdx |
| if (f_EPTF_LGenBase_getFsmIndexByCtxIdx(pl_args.eIdx, pl_args.refContext.fCtxIdx) != v_fsmIndex){ |
| setverdict ( fail ); |
| } |
| //testing f_EPTF_LGenBase_getFsmNameByCtxIdx |
| if (f_EPTF_LGenBase_getFsmNameByCtxIdx(pl_args.eIdx, pl_args.refContext.fCtxIdx) != "testFSM"){ |
| setverdict ( fail ); |
| } |
| |
| //testing f_EPTF_LGenBase_getFsmIndexByStepArgs |
| if (f_EPTF_LGenBase_getFsmIndexByStepArgs(pl_args) != v_fsmIndex){ |
| setverdict ( fail ); |
| } |
| //testing f_EPTF_LGenBase_getFsmNameByStepArgs |
| if (f_EPTF_LGenBase_getFsmNameByStepArgs(pl_args) != "testFSM"){ |
| setverdict ( fail ); |
| } |
| |
| setverdict ( pass ); |
| } |
| |
| //this component type is for the testcase |
| //tc_EPTF_LGenBase_Test_FsmGetFunctions |
| type component fsmGetFunctions_CT extends EPTF_LGenBase_CT{ |
| var integer v_fsmIndex |
| } |
| |
| //This TestCase tests if all the functions below works properly |
| // f_EPTF_LGenBase_getFsmNameOfTc |
| // f_EPTF_LGenBase_getFsmIdxOfTc |
| // f_EPTF_LGenBase_getFsmIndexByCtxIdx |
| // f_EPTF_LGenBase_getFsmNameByCtxIdx |
| // f_EPTF_LGenBase_getFsmIndexByStepArgs |
| // f_EPTF_LGenBase_getFsmNameByStepArgs |
| // f_EPTF_LGenBase_getFsmName |
| // |
| // - the verdict will be pass only if all the functions are working properly |
| testcase tc_EPTF_LGenBase_Test_FsmGetFunctions() |
| runs on fsmGetFunctions_CT{ |
| f_EPTF_LGenBase_init("test"); |
| var integer |
| v_bIdx := f_EPTF_LGenBase_declareBehaviorType("b1", -1, null, null, null); |
| var integer |
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1", "i1") |
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1", "i3") |
| v_dummyInt := f_EPTF_LGenBase_declareStep("b1", {"forFsmGetFunctionsTc", refers( f_EPTF_LGenBase_step_forFsmGetFunctionsTc )}) |
| var integer |
| v_iIdx := f_EPTF_LGenBase_declareFsmEvent("b1", "i2") |
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("Entity_Tc_A", {"b1"}); |
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({name := "eg0", eType := "Entity_Tc_A", eCount := 25}) |
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({name := "eg1", eType := "Entity_Tc_A", eCount := 125}) |
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({name := "eg2", eType := "Entity_Tc_A", eCount := 200}) |
| |
| f_EPTF_LGenBase_declareFSMTable( |
| { |
| name := "testFSM0", |
| fsmParams := { |
| {stateList := {"idle"}} |
| ,{varList := { |
| {name := "vf_callCounter", initValue := {intVal := 0}, scope := TC} |
| } |
| } |
| }, |
| table := { |
| classicTable := { |
| {eventToListen := { bName := "b1", iName := "i2", eventType := fsm }, |
| cellRow := { |
| //state==idle |
| {actionList := { |
| {stepOrFunctionName := c_EPTF_LGenBase_stepName_trafficFailed, contextArgs := omit} |
| }, |
| nextStateCalculation := omit, |
| nextState := omit |
| } |
| } |
| } |
| } |
| }//table |
| }//fsm //XCAPget_DOT:} |
| ) |
| v_fsmIndex := f_EPTF_LGenBase_declareFSMTable( |
| { |
| name := "testFSM", |
| fsmParams := { |
| {stateList := {"idle"}} |
| ,{varList := { |
| {name := "vf_callCounter", initValue := {intVal := 0}, scope := TC} |
| } |
| } |
| }, |
| table := { |
| classicTable := { |
| {eventToListen := { bName := "b1", iName := "i2", eventType := fsm }, |
| cellRow := { |
| //state==idle |
| {actionList := { |
| {stepOrFunctionName := "forFsmGetFunctionsTc", contextArgs := omit} |
| }, |
| nextStateCalculation := omit, |
| nextState := omit |
| } |
| } |
| } |
| } |
| }//table |
| }//fsm //XCAPget_DOT:} |
| ) |
| |
| f_EPTF_LGenBase_declareTcType2( |
| { |
| name := "testTC0", |
| fsmName := "testFSM0", |
| entityType := "Entity_Tc_A", |
| customEntitySucc := "" |
| }); |
| |
| var integer |
| v_tcTypeIdx := f_EPTF_LGenBase_declareTcType2( |
| { |
| name := "testTC", |
| fsmName := "testFSM", |
| entityType := "Entity_Tc_A", |
| customEntitySucc := "" |
| }); |
| |
| var integer |
| v_scIdx := f_EPTF_LGenBase_declareScenarioType3( |
| { |
| name := "sc1", |
| tcList := { |
| { tcName := "testTC0", |
| tcParamsList := { |
| {tcTypeName := "testTC0"}, |
| {enableEntitiesAtStart := true}, |
| {enabledAtStart := false}, |
| {target := {cpsToReach := 1111.0}} |
| } |
| }, |
| { tcName := "tc1", |
| tcParamsList := { |
| {tcTypeName := "testTC"}, |
| {enableEntitiesAtStart := true}, |
| {enabledAtStart := true}, |
| {target := {cpsToReach := 1111.0}} |
| } |
| } |
| }, |
| scParamsList := { |
| {enabled := true} |
| } |
| }) |
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","sc1"}, false) |
| //this event calls the step function f_EPTF_LGenBase_step_forFsmGetFunctionsTc |
| //the verdict will be set in the function |
| f_EPTF_LGenBase_dispatchEvent({{v_bIdx, v_iIdx, {26, 1}, omit},{}}); |
| |
| f_EPTF_Base_cleanup_CT() |
| } |
| |
| type component EPTF_LGenBase_startDelay_CT extends EPTF_LGenBase_Test_CT{ |
| var float c_delay := 5.0; |
| var boolean v_testStarted := false; |
| } |
| |
| function f_EPTF_LGenBase_Test_tcStartedListener( |
| EPTF_LGenBase_ReportedEventDescriptor pl_event, |
| EPTF_IntegerList pl_listenerArgs) |
| runs on EPTF_LGenBase_startDelay_CT{ |
| if(tsp_EPTF_LGenBaseTestDebug) {log(%definitionId)} |
| v_testStarted := true; |
| } |
| |
| function f_EPTF_LGenBase_Test_startDelay_init( in float pl_cpsToReach ) |
| runs on EPTF_LGenBase_startDelay_CT |
| { |
| f_EPTF_LGenBase_init("actionsPerCondition"); |
| v_dummyInt := f_EPTF_LGenBase_declareBehaviorType("b1", -1, null, null, null); |
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("Entity_Tc_A", {"b1"}); |
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({name := "eg0", eType := "Entity_Tc_A", eCount := 2}) |
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable({ |
| name := "stop", |
| fsmParams := { |
| {stateList := {"idle"}} |
| }, |
| table := { |
| classicTable := { |
| {eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm}, |
| cellRow := { |
| {{ |
| {c_EPTF_LGenBase_stepName_testFinished, omit} |
| }, omit, omit} |
| } |
| } |
| } |
| } |
| }) |
| v_dummyInt := f_EPTF_LGenBase_addGeneralEventListener( |
| c_EPTF_LGenBase_bIdx, |
| c_EPTF_LGenBase_inputIdx_testMgmt_startTC, |
| refers(f_EPTF_LGenBase_Test_tcStartedListener), {}) |
| v_dummyInt := f_EPTF_LGenBase_declareTcType2({ |
| name := "TC_Succ", |
| fsmName := "stop", |
| entityType := "Entity_Tc_A", |
| customEntitySucc := "" |
| }) |
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3( |
| { |
| name := "Scenario_Simple", |
| tcList := { |
| { |
| tcName := "TC_A0", |
| tcParamsList := { |
| {tcTypeName := "TC_Succ"}, |
| {startDelay := c_delay}, |
| {target := {cpsToReach := pl_cpsToReach}}, |
| {enableEntitiesAtStart := true}, |
| {enabledAtStart := true} |
| } |
| } |
| }, |
| |
| scParamsList := {} |
| }) |
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0", "Scenario_Simple"}, false) |
| f_EPTF_LGenBase_startTrafficCaseByIdx(0) |
| } |
| |
| // purpose: test start_delay TR's correction |
| // check: new cps value set, but the execution not started until start delay expired |
| testcase tc_EPTF_LGenBase_Test_startDelay_cps_change_R4() |
| runs on EPTF_LGenBase_startDelay_CT{ |
| f_EPTF_LGenBase_Test_startDelay_init(20.0); |
| |
| |
| timer t_dummy; // to give time for TC setup |
| t_dummy.start(0.5); |
| t_dummy.timeout; |
| |
| f_EPTF_LGenBase_setCPS(0, pl_newCps := 10.0); |
| |
| t_dummy.start(0.6); |
| t_dummy.timeout; |
| |
| if(v_testStarted){ |
| setverdict(fail) |
| } |
| |
| t_dummy.start(c_delay); |
| t_dummy.timeout; |
| |
| if(not v_testStarted){ |
| setverdict(fail) |
| } |
| |
| setverdict (pass); |
| f_EPTF_Base_cleanup_CT() |
| } |
| |
| // purpose: test start_delay TR's correction |
| // check: the starting cps value is 0, so no event enqueued with the start of the tc |
| // later new cps value set, and execution starts after start_delay is expired |
| testcase tc_EPTF_LGenBase_Test_startDelay_start_with_zero_cps_R4() |
| runs on EPTF_LGenBase_startDelay_CT{ |
| f_EPTF_LGenBase_Test_startDelay_init(0.0); |
| |
| timer t_dummy; // to give time for TC setup |
| t_dummy.start(0.5); |
| t_dummy.timeout; |
| |
| if(v_testStarted){ |
| setverdict(fail) |
| } |
| |
| f_EPTF_LGenBase_setCPS(0, pl_newCps := 20.0); |
| |
| t_dummy.start(0.6); |
| t_dummy.timeout; |
| |
| if(v_testStarted){ |
| setverdict(fail) |
| } |
| |
| t_dummy.start(c_delay); |
| t_dummy.timeout; |
| |
| if(not v_testStarted){ |
| setverdict(fail) |
| } |
| |
| setverdict (pass); |
| f_EPTF_Base_cleanup_CT() |
| } |
| |
| // purpose: test start_delay TR's correction |
| // check: zero cps value set during the test execution -> event removed from the queue |
| // later a nonzero cps value set, and execution starts after start_delay is expired |
| testcase tc_EPTF_LGenBase_Test_startDelay_set_zero_cps_R4() |
| runs on EPTF_LGenBase_startDelay_CT{ |
| f_EPTF_LGenBase_Test_startDelay_init(20.0); |
| |
| timer t_dummy; // to give time for TC setup |
| t_dummy.start(0.5); |
| t_dummy.timeout; |
| |
| // test the TR: after setting a cps the traffic immediately starts |
| f_EPTF_LGenBase_setCPS(0, pl_newCps := 0.0); |
| |
| t_dummy.start(0.6); |
| t_dummy.timeout; |
| |
| if(v_testStarted){ |
| setverdict(fail) |
| } |
| |
| f_EPTF_LGenBase_setCPS(0, pl_newCps := 20.0); |
| |
| t_dummy.start(0.6); |
| t_dummy.timeout; |
| |
| if(v_testStarted){ |
| setverdict(fail) |
| } |
| |
| t_dummy.start(c_delay); |
| t_dummy.timeout; |
| |
| if(not v_testStarted){ |
| setverdict(fail) |
| } |
| |
| setverdict (pass); |
| f_EPTF_Base_cleanup_CT() |
| } |
| |
| // purpose: test start_delay TR's correction |
| // check: zero cps value set during the test execution -> event removed from the queue |
| // later a nonzero cps value set when the start_delay exired, execution must start immediately |
| testcase tc_EPTF_LGenBase_Test_startDelay_expired_R4() |
| runs on EPTF_LGenBase_startDelay_CT{ |
| f_EPTF_LGenBase_Test_startDelay_init(20.0); |
| |
| timer t_dummy; // to give time for TC setup |
| t_dummy.start(0.5); |
| t_dummy.timeout; |
| |
| f_EPTF_LGenBase_setCPS(0, pl_newCps := 0.0); |
| |
| t_dummy.start(0.6); |
| t_dummy.timeout; |
| |
| if(v_testStarted){ |
| setverdict(fail) |
| } |
| |
| t_dummy.start(c_delay); |
| t_dummy.timeout; |
| |
| f_EPTF_LGenBase_setCPS(0, pl_newCps := 20.0); |
| |
| t_dummy.start(0.6); |
| t_dummy.timeout; |
| |
| if(not v_testStarted){ |
| setverdict(fail) |
| } |
| |
| setverdict (pass); |
| f_EPTF_Base_cleanup_CT() |
| } |
| |
| // purpose: test start_delay and pause interaction |
| // after pushing "pause" and "tc_start" the TC should not run until start_delay is expired |
| testcase tc_EPTF_LGenBase_Test_startDelay_pause_R4() |
| runs on EPTF_LGenBase_startDelay_CT{ |
| f_EPTF_LGenBase_Test_startDelay_init(20.0); |
| |
| timer t_dummy; // to give time for TC setup |
| t_dummy.start(0.5); |
| t_dummy.timeout; |
| |
| if(v_testStarted){ |
| setverdict(fail, "TC started immediately at the beginning") |
| } |
| |
| f_EPTF_LGenBase_pauseTrafficCase("eg0", "Scenario_Simple", "TC_A0") |
| |
| t_dummy.start(0.6); |
| t_dummy.timeout; |
| |
| if(v_testStarted){ |
| setverdict(fail, "TC started after pause") |
| } |
| |
| f_EPTF_LGenBase_startTrafficCase("eg0", "Scenario_Simple", "TC_A0") |
| |
| t_dummy.start(0.6); |
| t_dummy.timeout; |
| |
| if(v_testStarted){ |
| setverdict(fail, "TC started immediately after resume") |
| } |
| |
| t_dummy.start(c_delay); |
| t_dummy.timeout; |
| |
| if(not v_testStarted){ |
| setverdict(fail, "TC not started after start delay expiry") |
| } |
| |
| setverdict (pass); |
| f_EPTF_Base_cleanup_CT() |
| } |
| |
| function f_EPTF_LGenBase_Test_nextStateCalcTestFn( |
| in integer eIdx, |
| in integer fIdx, |
| in EPTF_IntegerList contextArgs, |
| in EPTF_LGenBase_FsmTableCellReference pl_cell, |
| in EPTF_IntegerList pl_stepArgs //supply args to actions |
| ) |
| runs on EPTF_LGenBase_Test_CT |
| return integer{ |
| //log("contextArgs: ",contextArgs) |
| //log("pl_stepArgs: ",pl_stepArgs) |
| var integer vl_state := f_EPTF_LGenBase_getFsmStateIdxByCtxIdx(eIdx, fIdx) |
| var EPTF_LGenBase_TestStepArgs vl_args := c_EPTF_LGenBase_emptyTestStepArgs |
| vl_args.eIdx := eIdx |
| vl_args.refContext.fCtxIdx := fIdx |
| vl_args.refContext.fRefArgs := contextArgs |
| vl_args.stepArgs := pl_stepArgs |
| select( vl_state ) |
| { |
| case ( 0 ){ |
| //varid |
| vl_state := vl_state + 1 |
| var integer vl_varId := f_EPTF_LGenBase_fsmVarIdFromStep(vl_args) |
| if(0 > vl_varId){ |
| setverdict ( fail, "Invalid variable ID" ) |
| } |
| var EPTF_Var_DirectContent vl_content |
| f_EPTF_Var_getContent(vl_varId, vl_content) |
| if(vl_content.intVal != 0){ |
| setverdict ( fail, "The content of the variable should be 0" ) |
| } |
| } |
| case ( 1 ){ |
| //varParams |
| vl_state := vl_state + 1 |
| var integer vl_varId |
| var EPTF_Var_DirectContent vl_content, vl_contentParam |
| f_EPTF_LGenBase_fsmVarParamsFromStep(vl_args, vl_varId, vl_contentParam) |
| f_EPTF_Var_getContent(vl_varId, vl_content) |
| if(vl_content != vl_contentParam){ |
| setverdict ( fail, "The received parameter should equal the content of the variable:", |
| log2str( match(vl_content,vl_contentParam) ) ) |
| } |
| } |
| case ( 2 ){ |
| vl_state := 0 |
| if({3,5,1}==contextArgs){ |
| setverdict(pass) |
| }else{ |
| setverdict(fail,log2str(match({3,5,1},contextArgs))) |
| } |
| } |
| case else{ |
| //There shouldn't be any other state |
| setverdict(inconc) |
| } |
| } |
| |
| return vl_state |
| } |
| |
| testcase tc_EPTF_LGenBase_Test_nextStateParams() |
| runs on EPTF_LGenBase_Test_CT{ |
| f_EPTF_LGenBase_init("nextStateParams"); |
| const integer c_entities := 6 |
| var integer v_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", c_entities}) |
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1", "event") |
| v_dummyInt := f_EPTF_LGenBase_declareFunction( |
| "nextStateCalcTestFn", |
| {nextStateCalcFunction := refers(f_EPTF_LGenBase_Test_nextStateCalcTestFn)}) |
| const EPTF_LGenBase_FsmTableDeclarator c_FSM := { |
| name := "FlexFsm1", |
| fsmParams := |
| { |
| {varList := |
| {{ |
| name := "var1", |
| initValue := {intVal := 9}, |
| scope := FSM |
| }, |
| { |
| name := "var2", |
| initValue := {intVal := 9}, |
| scope := FSM |
| }} |
| }, |
| {stateList := {"idle", "busy","third"}} |
| }, |
| table := { |
| extendedTable := { |
| { |
| events2Listen := {events := { |
| { singleEvent := {"b1","event", fsm} } |
| }}, |
| cellRow := { extStatedCellRow := { |
| { |
| inState := {state := "idle"}, |
| cell := { |
| {{"LGenBase: Set variable",{varParams := {"var1",{intVal := 0}}}}}, |
| {fnName := "nextStateCalcTestFn", argsList := {varNames := {"var1", "var2"}}}} |
| }, |
| { |
| inState := {state := "busy"}, |
| cell := { |
| {{"LGenBase: Set variable",{varParams := {"var1",{intVal := 1}}}}}, |
| {fnName := "nextStateCalcTestFn", argsList := {varParams := {"var1",{intVal := 1}}}}} |
| }, |
| { |
| inState := {state := "third"}, |
| cell := { |
| {{"LGenBase: Set variable",{varParams := {"var1",{intVal := 2}}}}}, |
| {fnName := "nextStateCalcTestFn", argsList := {stepContextArgs := {3,5,1}}}} |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_FSM) |
| f_EPTF_LGenBase_activateFsm(1, 0, 0, -1) |
| var EPTF_LGenBase_ReportedEventDescriptor vl_event := c_EPTF_LGenBase_emptyReportedEventDescriptor |
| vl_event.event.bIdx := v_behav |
| vl_event.event.iIdx := 0 |
| vl_event.event.target.eIdx := 1 |
| vl_event.event.target.fsmCtxIdx := 0 |
| f_EPTF_LGenBase_dispatchEvent(vl_event) |
| f_EPTF_LGenBase_dispatchEvent(vl_event) |
| f_EPTF_LGenBase_dispatchEvent(vl_event) |
| f_EPTF_Base_cleanup_CT() |
| } |
| |
| group FsmStateGetFunctions{ |
| function f_EPTF_LGenBase_step_forFsmStateGetFunctionsTc(in EPTF_LGenBase_TestStepArgs pl_args) |
| runs on fsmStateGetFunctions_CT |
| { |
| //testing f_EPTF_LGenBase_getFsmStateIdxByCtxIdx |
| //the return value of the function should be equal with the |
| //value in the pl_args.refContext.fRefArgs[0] parameter |
| var integer vl_stateIdx := f_EPTF_LGenBase_getFsmStateIdxByCtxIdx(pl_args.eIdx, pl_args.refContext.fCtxIdx); |
| if (vl_stateIdx != pl_args.refContext.fRefArgs[0]){ |
| setverdict ( fail ); |
| } |
| |
| //testing f_EPTF_LGenBase_getFsmStateNameByCtxIdx |
| //the return value of the function should be equal with the |
| //value depending on the pl_args.refContext.fRefArgs[0] parameter |
| var charstring vl_stateNameFromGetter := f_EPTF_LGenBase_getFsmStateNameByCtxIdx(pl_args.eIdx, pl_args.refContext.fCtxIdx); |
| var charstring vl_stateName; |
| if (pl_args.refContext.fRefArgs[0] == 0){ |
| vl_stateName := "first"; |
| } |
| if (pl_args.refContext.fRefArgs[0] == 1){ |
| vl_stateName := "second"; |
| } |
| if (vl_stateNameFromGetter != vl_stateName){ |
| setverdict ( fail ); |
| } |
| |
| //testing f_EPTF_LGenBase_getFsmStateIdxByStepArgs |
| //the return value of the function should be equal with the |
| //value in the pl_args.refContext.fRefArgs[0] parameter |
| vl_stateIdx := f_EPTF_LGenBase_getFsmStateIdxByStepArgs(pl_args); |
| if (vl_stateIdx != pl_args.refContext.fRefArgs[0]){ |
| setverdict ( fail ); |
| } |
| |
| //testing f_EPTF_LGenBase_getFsmStateNameByStepArgs |
| //the return value of the function should be equal with the |
| //value depending on the pl_args.refContext.fRefArgs[0] parameter |
| vl_stateNameFromGetter := f_EPTF_LGenBase_getFsmStateNameByStepArgs(pl_args); |
| if (vl_stateNameFromGetter != vl_stateName){ |
| setverdict ( fail ); |
| } |
| |
| setverdict ( pass ); |
| } |
| |
| type component fsmStateGetFunctions_CT extends EPTF_LGenBase_CT{ |
| } |
| |
| //This TestCase tests if all the functions below works properly |
| // f_EPTF_LGenBase_getFsmStateNameByCtxIdx |
| // f_EPTF_LGenBase_getFsmStateIdxByCtxIdx |
| // f_EPTF_LGenBase_getFsmStateNameByStepArgs |
| // f_EPTF_LGenBase_getFsmStateIdxByStepArgs |
| // |
| // - the verdict will be pass only if all the functions are working properly |
| testcase tc_EPTF_LGenBase_Test_FsmStateGetFunctions() |
| runs on fsmStateGetFunctions_CT{ |
| f_EPTF_LGenBase_init("test"); |
| var integer |
| v_bIdx := f_EPTF_LGenBase_declareBehaviorType("b1", -1, null, null, null); |
| var integer |
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1", "i1") |
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1", "i3") |
| v_dummyInt := f_EPTF_LGenBase_declareStep("b1", {"forFsmStateGetFunctionsTc", refers( f_EPTF_LGenBase_step_forFsmStateGetFunctionsTc )}) |
| var integer |
| v_iIdx := f_EPTF_LGenBase_declareFsmEvent("b1", "i2") |
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("Entity_Tc_A", {"b1"}); |
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({name := "eg0", eType := "Entity_Tc_A", eCount := 25}) |
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({name := "eg1", eType := "Entity_Tc_A", eCount := 125}) |
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({name := "eg2", eType := "Entity_Tc_A", eCount := 200}) |
| |
| var integer v_fsmIndex := f_EPTF_LGenBase_declareFSMTable( |
| { |
| name := "testFSM", |
| fsmParams := { |
| {stateList := {"first", "second"}} |
| ,{varList := { |
| {name := "vf_callCounter", initValue := {intVal := 0}, scope := TC} |
| } |
| } |
| }, |
| table := { |
| classicTable := { |
| {eventToListen := { bName := "b1", iName := "i2", eventType := fsm }, |
| cellRow := { |
| //state==first |
| {actionList := { |
| {stepOrFunctionName := "forFsmStateGetFunctionsTc", |
| contextArgs := { |
| stepContextArgs := {0} |
| } |
| } |
| }, |
| nextStateCalculation := omit, |
| nextState := "second" |
| }, |
| //state==second |
| {actionList := { |
| {stepOrFunctionName := "forFsmStateGetFunctionsTc", |
| contextArgs := { |
| stepContextArgs := {1} |
| } |
| } |
| }, |
| nextStateCalculation := omit, |
| nextState := "first" |
| } |
| } |
| } |
| } |
| }//table |
| }//fsm |
| ) |
| |
| var integer |
| v_tcTypeIdx := f_EPTF_LGenBase_declareTcType2( |
| { |
| name := "testTC", |
| fsmName := "testFSM", |
| entityType := "Entity_Tc_A", |
| customEntitySucc := "" |
| }); |
| |
| var integer |
| v_scIdx := f_EPTF_LGenBase_declareScenarioType3( |
| { |
| name := "sc1", |
| tcList := { |
| { tcName := "tc1", |
| tcParamsList := { |
| {tcTypeName := "testTC"}, |
| {enableEntitiesAtStart := true}, |
| {enabledAtStart := true}, |
| {target := {cpsToReach := 1111.0}} |
| } |
| } |
| }, |
| scParamsList := { |
| {enabled := true} |
| } |
| }) |
| |
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","sc1"}, false) |
| //this event calls the step function f_EPTF_LGenBase_step_forFsmStateGetFunctionsTc |
| //the verdict will be set in the function |
| f_EPTF_LGenBase_dispatchEvent({{v_bIdx, v_iIdx, {26, 0}, omit},{}}); |
| |
| timer t_wait; |
| t_wait.start( 0.5 ); |
| t_wait.timeout; |
| |
| f_EPTF_Base_cleanup_CT() |
| } |
| } |
| |
| group NameOfExpiredTimer{ |
| function f_EPTF_LGenBase_step_forNameOfExpiredTimerTc(in EPTF_LGenBase_TestStepArgs pl_args) |
| runs on NameOfExpiredTimer_CT |
| { |
| //testing f_EPTF_LGenBase_getNameOfExpiredTimer |
| //the return value of the function should be "timer_2" |
| if (f_EPTF_LGenBase_getNameOfExpiredTimer(pl_args) != "timer_2"){ |
| setverdict ( fail, match(f_EPTF_LGenBase_getNameOfExpiredTimer(pl_args), "timer_2")); |
| } |
| setverdict(pass); |
| } |
| |
| type component NameOfExpiredTimer_CT extends EPTF_LGenBase_CT{ |
| } |
| |
| //This TestCase tests if the f_EPTF_LGenBase_getNameOfExpiredTimer |
| //function is working properly |
| // |
| // - the verdict will be pass if the function is working properly |
| testcase tc_EPTF_LGenBase_Test_NameOfExpiredTimer() |
| runs on NameOfExpiredTimer_CT{ |
| f_EPTF_LGenBase_init("test"); |
| var integer |
| vl_bIdx := f_EPTF_LGenBase_declareBehaviorType("b1", -1, null, null, null); |
| var integer |
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1", "i1") |
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1", "i3") |
| v_dummyInt := f_EPTF_LGenBase_declareStep("b1", {"forNameOfExpiredTimerTc", refers( f_EPTF_LGenBase_step_forNameOfExpiredTimerTc )}) |
| var integer |
| vl_iIdx := f_EPTF_LGenBase_declareFsmEvent("b1", "i2") |
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("Entity_Tc_A", {"b1"}); |
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({name := "eg0", eType := "Entity_Tc_A", eCount := 25}) |
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({name := "eg1", eType := "Entity_Tc_A", eCount := 125}) |
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({name := "eg2", eType := "Entity_Tc_A", eCount := 200}) |
| |
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable( |
| { |
| name := "timerFSM", |
| fsmParams := { |
| {stateList := {"first", "second"}}, |
| {timerList := {{ |
| name := "timer_1", |
| startValue := 0.1 |
| }, |
| { name := "timer_2", |
| startValue := 0.2 |
| }, |
| { name := "timer_3", |
| startValue := 0.3 |
| } |
| } |
| } |
| },//fsmParams |
| table := { |
| extendedTable := { |
| { |
| events2Listen := {events := { |
| { singleEvent := { bName := "b1", iName := "i2", eventType := fsm} } |
| }}, |
| cellRow := { statedCellRow := { |
| { |
| inState := {state := "first"}, |
| cell := { |
| actionList := |
| {{ stepOrFunctionName := "LGenBase: StepFunction_timerStart", |
| contextArgs := {timerName := "timer_2"}}}, |
| nextStateCalculation := omit, |
| nextState := "second"} |
| } |
| } |
| } |
| }, |
| { |
| events2Listen := {events := { |
| { singleEvent := { bName := "Special behavior for timeout reporting", iName := "timer_2", eventType := fsm}} |
| }}, |
| cellRow := { statedCellRow := { |
| { |
| inState := {state := "second"}, |
| cell := { |
| actionList := |
| {{stepOrFunctionName := "forNameOfExpiredTimerTc",contextArgs := omit}}, |
| nextStateCalculation := omit, |
| nextState := omit |
| } |
| } |
| } |
| } |
| } |
| } |
| }//table |
| }//fsm |
| ) |
| f_EPTF_LGenBase_activateFsm(26, 0, 0, -1); |
| //this event calls the step function f_EPTF_LGenBase_step_forNameOfExpiredTimerTc |
| //the verdict will be set in the function |
| f_EPTF_LGenBase_dispatchEvent({{vl_bIdx, vl_iIdx, {26, 0}, omit},{}}); |
| timer t_wait; |
| t_wait.start( 0.5 ); |
| t_wait.timeout; |
| f_EPTF_Base_cleanup_CT() |
| } |
| |
| //This TestCase tests if the f_EPTF_LGenBase_getNameOfExpiredTimer |
| //function is working properly when it is called with bad parameters. |
| // |
| // - the verdict will be pass if the function is working properly |
| testcase tc_EPTF_LGenBase_Test_NameOfExpiredTimer_noTimer() |
| runs on NameOfExpiredTimer_CT{ |
| f_EPTF_LGenBase_init("test"); |
| |
| var integer |
| vl_bIdx := f_EPTF_LGenBase_declareBehaviorType("b1", -1, null, null, null); |
| var integer |
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1", "i1") |
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1", "i3") |
| v_dummyInt := f_EPTF_LGenBase_declareStep("b1", {"forNameOfExpiredTimerTc", refers( f_EPTF_LGenBase_step_forNameOfExpiredTimerTc )}) |
| var integer |
| vl_iIdx := f_EPTF_LGenBase_declareFsmEvent("b1", "i2") |
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("Entity_Tc_A", {"b1"}); |
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({name := "eg0", eType := "Entity_Tc_A", eCount := 25}) |
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({name := "eg1", eType := "Entity_Tc_A", eCount := 125}) |
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({name := "eg2", eType := "Entity_Tc_A", eCount := 200}) |
| |
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable( |
| { |
| name := "timerFSM", |
| fsmParams := { |
| {stateList := {"first", "second"}}, |
| {timerList := {{ |
| name := "timer_1", |
| startValue := 0.1 |
| }, |
| { name := "timer_2", |
| startValue := 0.2 |
| }, |
| { name := "timer_3", |
| startValue := 0.3 |
| } |
| } |
| } |
| },//fsmParams |
| table := { |
| extendedTable := { |
| { |
| events2Listen := {events := { |
| { singleEvent := { bName := "b1", iName := "i2", eventType := fsm} } |
| }}, |
| cellRow := { statedCellRow := { |
| { |
| inState := {state := "first"}, |
| cell := { |
| actionList := |
| {{ stepOrFunctionName := "LGenBase: StepFunction_timerStart", |
| contextArgs := {timerName := "timer_2"}}}, |
| nextStateCalculation := omit, |
| nextState := "second"} |
| } |
| } |
| } |
| }, |
| { |
| events2Listen := {events := { |
| { singleEvent := { bName := "Special behavior for timeout reporting", iName := "timer_2", eventType := fsm}} |
| }}, |
| cellRow := { statedCellRow := { |
| { |
| inState := {state := "second"}, |
| cell := { |
| actionList := |
| {{stepOrFunctionName := "forNameOfExpiredTimerTc",contextArgs := omit}}, |
| nextStateCalculation := omit, |
| nextState := omit |
| } |
| } |
| } |
| } |
| } |
| } |
| }//table |
| }//fsm |
| ) |
| f_EPTF_LGenBase_activateFsm(26, 0, 0, -1); |
| |
| //creating a not correct test step arg when there is no timer in it |
| var EPTF_LGenBase_TestStepArgs vl_testArgs; |
| vl_testArgs.eIdx := 26; |
| vl_testArgs.refContext.fCtxIdx := 0; |
| vl_testArgs.stepArgs := {}; |
| var charstring vl_nameOfTimer := f_EPTF_LGenBase_getNameOfExpiredTimer(vl_testArgs); |
| |
| if (vl_nameOfTimer == ""){ |
| setverdict ( pass, "No errors when the timer is undefined in the test step args." ); |
| } |
| else{ |
| setverdict ( pass ); |
| } |
| |
| f_EPTF_Base_cleanup_CT(); |
| } |
| } |
| |
| group ZeroCPSTest { |
| type component EPTF_LGenBase_ZeroCPSTest_CT extends EPTF_LGenBase_Test_CT{ |
| var boolean v_testZeroCPSTest_TC := false; |
| var boolean v_testZeroCPSTest_SC := false; |
| } |
| |
| const charstring c_LGenBase_Test_setZeroCPSStepName := "setZeroCPSStepName" |
| function f_EPTF_LGenBase_step_setZeroCPS(in EPTF_LGenBase_TestStepArgs pl_args) |
| runs on EPTF_LGenBase_Test_CT |
| { |
| var charstring vl_eGrpName, vl_scName, vl_tcName; |
| f_EPTF_LGenBase_trafficCaseIdNames(0, vl_eGrpName, vl_scName, vl_tcName) |
| f_EPTF_LGenBase_setCPSByNames(vl_eGrpName, vl_scName, vl_tcName, 0.0) |
| f_EPTF_LGenBase_setScenarioCPS(vl_eGrpName, "Scenario_Weighted", 0.0) |
| } |
| |
| function f_EPTF_LGenBase_Test_ZeroCPSTest_checkCleanup() |
| runs on EPTF_LGenBase_ZeroCPSTest_CT{ |
| setverdict(pass) |
| } |
| |
| function f_EPTF_LGenBase_Test_ZeroCPSTest_init() |
| runs on EPTF_LGenBase_ZeroCPSTest_CT |
| { |
| const charstring c_eGrpName := "eg0" |
| const charstring c_scNameWeighted :="Scenario_Weighted" |
| const charstring c_tcName := "testTC" |
| f_EPTF_LGenBase_init("actionsPerCondition"); |
| v_testZeroCPSTest_TC := false; |
| v_testZeroCPSTest_SC := false; |
| f_EPTF_Base_registerCleanup(refers(f_EPTF_LGenBase_Test_ZeroCPSTest_checkCleanup)); |
| f_EPTF_Base_setDTEHandling(false); |
| |
| v_dummyInt := f_EPTF_LGenBase_declareBehaviorType("b1", -1, null, null, null); |
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("Entity_Tc_A", {"b1"}); |
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({name := c_eGrpName, eType := "Entity_Tc_A", eCount := 5}) |
| v_dummyInt := f_EPTF_LGenBase_declareStep("b1",{c_LGenBase_Test_setZeroCPSStepName, refers(f_EPTF_LGenBase_step_setZeroCPS)}) |
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable({ |
| name := "stop", |
| fsmParams := { |
| {stateList := {"idle"}} |
| }, |
| table := { |
| classicTable := { |
| {eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm}, |
| cellRow := { |
| {{ |
| {c_LGenBase_Test_setZeroCPSStepName, omit}, |
| {c_EPTF_LGenBase_stepName_testFinished, omit} |
| }, omit, omit} |
| } |
| } |
| } |
| } |
| }) |
| v_dummyInt := f_EPTF_LGenBase_declareTcType2({ |
| name := "TC_Succ", |
| fsmName := "stop", |
| entityType := "Entity_Tc_A", |
| customEntitySucc := "" |
| }) |
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3( |
| { |
| name := "Scenario_Simple", |
| tcList := { |
| { |
| tcName := "TC_A0", |
| tcParamsList := { |
| {tcTypeName := "TC_Succ"}, |
| {target := {cpsToReach := 0.0}}, |
| {enableEntitiesAtStart := true}, |
| {enabledAtStart := true} |
| } |
| } |
| }, |
| |
| scParamsList := {} |
| }) |
| |
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0", "Scenario_Simple"}, false) |
| |
| |
| f_EPTF_LGenBase_startTrafficCaseByIdx(0) |
| |
| var charstring vl_eGrpName, vl_scName, vl_tcName; |
| f_EPTF_LGenBase_trafficCaseIdNames(0, vl_eGrpName, vl_scName, vl_tcName) |
| f_EPTF_LGenBase_setCPSByNames(vl_eGrpName, vl_scName, vl_tcName, 10.0) |
| |
| //Weighted scenario |
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3( |
| { |
| name := c_scNameWeighted, |
| tcList := { |
| { tcName := "statTC0", |
| tcParamsList := { |
| {tcTypeName := "TC_Succ"}, |
| {enableEntitiesAtStart := true}, |
| {enabledAtStart := true}, |
| {target := {trafficWeight := 0.5}} |
| } |
| }, |
| { tcName := c_tcName, |
| tcParamsList := { |
| {tcTypeName := "TC_Succ"}, |
| {enableEntitiesAtStart := true}, |
| {enabledAtStart := true}, |
| {target := {trafficWeight := 0.5}} |
| } |
| } |
| }, |
| scParamsList := { |
| {weightedScData := { |
| cpsToReach := 0.0, |
| lockCPS := false, |
| deterministicMix := false, |
| scheduler := omit |
| } |
| }, |
| {enabled := true} |
| } |
| }) |
| f_EPTF_LGenBase_createScenario2EntityGroup({c_eGrpName, c_scNameWeighted},false) |
| |
| f_EPTF_LGenBase_startWeightedScenario(c_eGrpName, c_scNameWeighted); |
| f_EPTF_LGenBase_setScenarioCPS(c_eGrpName, c_scNameWeighted, 10.0); |
| } |
| |
| // purpose: test if the CPS is set to 0 in a test step, f_EPTF_LGenBase_burstPreCalcCS does not stp with an error |
| // test of artifact: support #1365576 CLL: DTE in f_EPTF_LGenBase_burstPreCalcCS / Gábor Bettesch |
| testcase tc_EPTF_LGenBase_Test_ZeroCPSTest() |
| runs on EPTF_LGenBase_ZeroCPSTest_CT{ |
| const charstring c_eGrpName := "eg0" |
| const charstring c_scNameWeighted :="Scenario_Weighted" |
| |
| f_EPTF_LGenBase_Test_ZeroCPSTest_init(); |
| |
| |
| timer t_dummy; // to give time for TC setup |
| t_dummy.start(0.5); |
| t_dummy.timeout; |
| |
| //f_EPTF_LGenBase_setCPS(0, pl_newCps := 0.0); |
| //f_EPTF_LGenBase_setScenarioCPS(c_eGrpName, c_scNameWeighted, 0.0) |
| |
| t_dummy.start(0.6); |
| t_dummy.timeout; |
| |
| f_EPTF_Base_cleanup_CT() |
| } |
| |
| } // group ZeroCPSTest |
| |
| group CPSChangeCallback { |
| type component EPTF_LGenBase_CPSChangeCallback_CT extends EPTF_LGenBase_Test_CT{ |
| var boolean v_testCPSChangeCallback_TC := false; |
| var boolean v_testCPSChangeCallback_SC := false; |
| } |
| |
| function f_EPTF_LGenBase_Test_trafficCaseCPSChangedCallbackFn(in float pl_cps, in integer pl_tcIdx) runs on EPTF_LGenBase_CPSChangeCallback_CT { |
| v_testCPSChangeCallback_TC := true; |
| |
| var charstring vl_eGrpName; |
| var charstring vl_scName; |
| var charstring vl_tcName; |
| f_EPTF_LGenBase_trafficCaseIdNames(pl_tcIdx,vl_eGrpName,vl_scName,vl_tcName); |
| log(%definitionId&" TrafficCaseCPSChanged callback called with pl_cps: ", pl_cps, ", pl_tcIdx: ", pl_tcIdx, ", TC name: ", vl_eGrpName,".",vl_scName,".",vl_tcName); |
| } |
| |
| function f_EPTF_LGenBase_Test_scenarioCPSChangedCallbackFn(in float pl_cps, in integer pl_eGrpIdx, in integer pl_scIdx) runs on EPTF_LGenBase_CPSChangeCallback_CT { |
| v_testCPSChangeCallback_SC := true; |
| |
| var charstring vl_eGrpName; |
| var charstring vl_scName; |
| f_EPTF_LGenBase_scenarioIdNames(pl_eGrpIdx,pl_scIdx,vl_eGrpName,vl_scName); |
| log(%definitionId&" ScenarioCPSChanged callback called with pl_cps: ", pl_cps, ", pl_eGrpIdx: ", pl_eGrpIdx, ", pl_scIdx: ", pl_scIdx, ", TC name: ", vl_eGrpName,".",vl_scName); |
| } |
| |
| function f_EPTF_LGenBase_Test_CPSChangeCallback_checkCleanup() |
| runs on EPTF_LGenBase_CPSChangeCallback_CT{ |
|