| /////////////////////////////////////////////////////////////////////////////// |
| // // |
| // 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 R9 functionalities and bugfixes |
| // of LGenBase |
| // |
| // Module depends on: |
| // - |
| // |
| // Current Owner: |
| // László Skumát (ELSZSKU) |
| // |
| // Last Review Date: |
| // - |
| // |
| /////////////////////////////////////////////////////////////// |
| module EPTF_LGenBase_Test_TestcasesR9 |
| // [.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_CLL_LGenBase_StepFunctions all; |
| import from EPTF_LGenBase_Test_Definitions all; |
| import from EPTF_CLL_Common_Definitions all; |
| import from EPTF_CLL_Variable_Functions 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_LGenBase_Test_TestcasesR3 all; |
| import from EPTF_CLL_LGenBase_EventHandlingFunctions all; |
| import from EPTF_CLL_Base_Functions all; |
| import from EPTF_CLL_LGenBase_Definitions all; |
| import from EPTF_CLL_Variable_Definitions all; |
| import from TCCMaths_Functions all; |
| import from EPTF_CLL_LGenBase_ExternalFunctions all; |
| import from EPTF_CLL_StatMeasure_Definitions all; |
| import from EPTF_CLL_StatMeasure_Functions { function f_EPTF_StatMeasure_getStat_max }; |
| import from EPTF_CLL_LGenBase_PhaseFunctions all; |
| import from EPTF_CLL_LGenBase_PhaseConfigFunctions all; |
| |
| |
| group LimitExecution{ |
| |
| const charstring c_LGenBase_Test_CheckFinish := "CheckFinish"; |
| const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_FSMNotReportingFinish := |
| { |
| name := "NewFsm", |
| fsmParams := { |
| {stateList := {"idle"}}, |
| {varList := |
| { |
| { |
| name := "TCvarA", |
| initValue := {floatVal := 0.0}, |
| scope := TC |
| } |
| } |
| } |
| }, |
| table := { |
| classicTable := { |
| {eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm}, |
| cellRow := { |
| //state[0]==idle |
| {{ |
| {"LimitStart",omit }, |
| {"LGenBase: Increment variable",{varParams := {"TCvarA",{floatVal := 1.0}}}} |
| }, omit, omit} |
| } |
| } |
| , |
| {eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_stopTC,fsm}, |
| cellRow := { |
| {{ |
| {"LimitStop",omit }, |
| {c_EPTF_LGenBase_stepName_entityStopped, omit} }, omit, omit} |
| } |
| } |
| } |
| } |
| } |
| |
| const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_FSMReportingFinish := |
| { |
| name := "NewFsm", |
| fsmParams := { |
| {stateList := {"idle"}}, |
| {varList := |
| { |
| { |
| name := "TCvarA", |
| initValue := {floatVal := 0.0}, |
| scope := TC |
| } |
| } |
| } |
| }, |
| table := { |
| classicTable := { |
| {eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm}, |
| cellRow := { |
| //state[0]==idle |
| {{ |
| {"LimitStart",omit }, |
| {"LGenBase: Increment variable",{varParams := {"TCvarA",{floatVal := 1.0}}}}, |
| {c_EPTF_LGenBase_stepName_trafficSuccess, omit} |
| }, omit, omit} |
| } |
| } |
| , |
| {eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_stopTC,fsm}, |
| cellRow := { |
| {{ |
| {"LimitStop",omit }, |
| {c_EPTF_LGenBase_stepName_entityStopped, omit} }, omit, omit} |
| } |
| } |
| } |
| } |
| } |
| |
| const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_FSM2 := |
| { |
| name := "NewFsm2", |
| fsmParams := { |
| {stateList := {"idle"}}, |
| {varList := |
| { |
| { |
| name := "TCvarA", |
| initValue := {floatVal := 0.0}, |
| scope := TC |
| } |
| } |
| } |
| }, |
| table := { |
| classicTable := { |
| {eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm}, |
| cellRow := { |
| //state[0]==idle |
| {{ |
| {"LimitStart2",omit }, |
| {"LGenBase: Increment variable",{varParams := {"TCvarA",{floatVal := 1.0}}}}, |
| {c_EPTF_LGenBase_stepName_trafficSuccess, omit} |
| }, omit, omit} |
| } |
| } |
| , |
| {eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_stopTC,fsm}, |
| cellRow := { |
| {{ |
| {"LimitStop2",omit }, |
| {c_EPTF_LGenBase_stepName_entityStopped, omit} }, omit, omit} |
| } |
| } |
| } |
| } |
| } |
| |
| const EPTF_LGenBase_ScenarioTypeDeclarator c_LGenBase_Test_scNormal := { "SC1", |
| { |
| {"TC1",{ |
| {target := {cpsToReach := 100.0}}, |
| {fsmList := |
| { |
| "NewFsm" |
| } |
| } |
| ,{entityFinishConditions := {{nrOfSuccesses := 20}}} |
| ,{enableEntitiesAtStart := true} |
| ,{enabledAtStart := true} |
| ,{trafficStartFinish := {{ |
| nrOfExecStart := {count := 10, actions := {}}}}} |
| } |
| } |
| }, |
| {} |
| } |
| |
| const EPTF_LGenBase_ScenarioTypeDeclarator c_LGenBase_Test_scPhase := { |
| name := "SC1", |
| tcList := { |
| { |
| "TC1", |
| { |
| {target := {cpsToReach := 100.0}}, |
| {fsmList := |
| { |
| "NewFsm" |
| } |
| }, |
| {enableEntitiesAtStart := true}, |
| {enabledAtStart := true}, |
| {trafficStartFinish :={ |
| {nrOfExecStart := {10, {}}} |
| }} |
| } |
| }, |
| { |
| "TC2", |
| { |
| {target := {cpsToReach := 100.0}}, |
| {fsmList := |
| { |
| "NewFsm2" |
| } |
| }, |
| {enableEntitiesAtStart := true}, |
| {enabledAtStart := true}, |
| {trafficStartFinish :={ |
| {nrOfExecStart := {10, {}}} |
| }} |
| } |
| } |
| }, |
| scParamsList := { |
| {enabled :=true}, |
| {phaseListName := "BasicPhases"}, |
| {phaseFinishConditions := { |
| { |
| phase := "preamble", |
| conditions := { |
| {tcFinished := "TC1"} |
| } |
| }, |
| { |
| phase := "loadgen", |
| conditions := { |
| {tcFinished := "TC2"} |
| } |
| } |
| } |
| }, |
| {phaseStateChangeActions := { |
| { |
| phase := "preamble", |
| state := RUNNING, |
| actions := { |
| {startTc := "TC1"} |
| } |
| }, |
| { |
| phase := "loadgen", |
| state := RUNNING, |
| actions := { |
| {startTc := "TC2"} |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| const EPTF_LGenBase_ScenarioTypeDeclarator c_LGenBase_Test_scAvailFinished := { "SC1", |
| { |
| {"TC1",{ |
| {target := {cpsToReach := 100.0}}, |
| {fsmList := |
| { |
| "NewFsm" |
| } |
| } |
| ,{entityFinishConditions := {{nrOfSuccesses := 1}}} |
| ,{enableEntitiesAtStart := true} |
| ,{enabledAtStart := true} |
| ,{trafficStartFinish :={ |
| {nrOfExecStart := {200, {}}} |
| ,{availableEntitiesFinished := {{ |
| {customFinishFunction := c_LGenBase_Test_CheckFinish} |
| }}} |
| }} |
| } |
| } |
| }, |
| {} |
| } |
| |
| const EPTF_LGenBase_ScenarioTypeDeclarator c_LGenBase_Test_scNoCondition := { "SC1", |
| { |
| {"TC1",{ |
| {target := {cpsToReach := 10.0}}, |
| {fsmList := |
| { |
| "NewFsm" |
| } |
| } |
| //,{entityFinishConditions := {{nrOfSuccesses := 20}}} |
| ,{enableEntitiesAtStart := true} |
| ,{enabledAtStart := true} |
| //,{trafficStartFinish := {{ |
| // nrOfExecStart := {count := 10, actions := {}}}}} |
| } |
| } |
| }, |
| {} |
| } |
| |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: f_LGenBase_Test_limitStart |
| // |
| // Purpose: Counts the starts of newFsm1 |
| // |
| /////////////////////////////////////////////////////////// |
| function f_LGenBase_Test_limitStart(in EPTF_LGenBase_TestStepArgs pl_ptr) |
| runs on EPTF_LGenBase_VarAndStatTest_CT |
| { |
| v_LGenBase_Test_counters[0] := v_LGenBase_Test_counters[0] + 1; |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: f_LGenBase_Test_limitStop |
| // |
| // Purpose: Counts the stops of newFsm1 |
| // |
| /////////////////////////////////////////////////////////// |
| function f_LGenBase_Test_limitStop(in EPTF_LGenBase_TestStepArgs pl_ptr) |
| runs on EPTF_LGenBase_VarAndStatTest_CT |
| { |
| v_LGenBase_Test_counters[1] := v_LGenBase_Test_counters[1] + 1; |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: f_LGenBase_Test_limitStart2 |
| // |
| // Purpose: Counts the starts of newFsm2 |
| // |
| /////////////////////////////////////////////////////////// |
| function f_LGenBase_Test_limitStart2(in EPTF_LGenBase_TestStepArgs pl_ptr) |
| runs on EPTF_LGenBase_VarAndStatTest_CT |
| { |
| v_LGenBase_Test_counters[2] := v_LGenBase_Test_counters[2] + 1; |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: f_LGenBase_Test_limitStop2 |
| // |
| // Purpose: Counts the stops of newFsm2 |
| // |
| /////////////////////////////////////////////////////////// |
| function f_LGenBase_Test_limitStop2(in EPTF_LGenBase_TestStepArgs pl_ptr) |
| runs on EPTF_LGenBase_VarAndStatTest_CT |
| { |
| v_LGenBase_Test_counters[3] := v_LGenBase_Test_counters[3] + 1; |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: f_LGenBase_Test_phaseFinished |
| // |
| // Purpose: Counts the phase finishes. |
| // |
| /////////////////////////////////////////////////////////// |
| function f_LGenBase_Test_phaseFinished( in charstring pl_eGrpName, |
| in charstring pl_scName, |
| in charstring pl_phase, |
| in EPTF_IntegerList pl_args ) |
| runs on EPTF_LGenBase_VarAndStatTest_CT{ |
| v_LGenBase_Test_counters[4] := v_LGenBase_Test_counters[4] + 1; |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: f_LGenBase_Test_checkFinished |
| // |
| // Purpose: Counts the availableEntitiesFinished runs. |
| // |
| /////////////////////////////////////////////////////////// |
| function f_LGenBase_Test_checkFinished (in integer pl_tcIdx) |
| runs on EPTF_LGenBase_VarAndStatTest_CT{ |
| v_LGenBase_Test_counters[5] := v_LGenBase_Test_counters[5] + 1; |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: f_LGenBase_Test_LimitExec |
| // |
| // Purpose: the main function the traffic cases use. It starts the traffic case two times. Measures the starts and stops, finish conditions, etc. |
| // |
| // Parameters: |
| // pl_fsmName - *in* - <EPTF_LGenBase_FsmTableDeclarator> - FSM declarator. |
| // pl_IncValue_1Run - *in* - *float* - Accept value for the started entities after the first startTC. |
| // pl_IncValue_2Run - *in* - *float* - Accept value for the started entities after the second startTC. |
| // pl_eLimit - *in* - *integer* - The limit size of the entityGroup. |
| // pl_eLimit2 - *in* - *integer* - The limit size of the entityGroup for resetting the limit size. |
| // pl_sc - *in* - <EPTF_LGenBase_ScenarioTypeDeclarator> - The scenario declarator. |
| // pl_phase - *in* - *boolean* - startPhase should be executed or not. |
| // pl_unLimit - *in* - *boolean* - unLimit should be executed or not. |
| // pl_testUnLimit - *in* - *boolean* - Check whether unLimit is working correctly. |
| // pl_stopBetween2Starts - *in* - *boolean* - Between 2 startTc a stopTc is called or not. |
| // pl_availableCheck - *in* - *boolean* - Check the result of availableEntitiesFinished |
| // |
| /////////////////////////////////////////////////////////// |
| function f_LGenBase_Test_LimitExec(in EPTF_LGenBase_FsmTableDeclarator pl_fsmName, |
| in float pl_IncValue_1Run := 10.0, |
| in float pl_IncValue_2Run := 10.0, |
| in integer pl_eLimit := 4, |
| in integer pl_eLimit2 := 4, |
| in EPTF_LGenBase_ScenarioTypeDeclarator pl_sc := c_LGenBase_Test_scNormal, |
| in boolean pl_phase := false, |
| in boolean pl_unLimit := false, |
| in boolean pl_testUnLimit := false, |
| in boolean pl_stopBetween2Starts := false, |
| in boolean pl_availableCheck := false, |
| in boolean pl_restoreScenarioBetween2Limit := false, |
| in boolean pl_restoreAutoStart := false, |
| in boolean pl_restoreStopAfter := false, |
| in boolean pl_noCheck := false, |
| in boolean pl_setCPS := false, |
| in boolean pl_noCheckVal := false) |
| runs on EPTF_LGenBase_VarAndStatTest_CT |
| { |
| f_EPTF_LGenBase_init("LimitedExecution"); |
| v_LGenBase_Test_counters[0] := 0; |
| v_LGenBase_Test_counters[1] := 0; |
| v_LGenBase_Test_counters[2] := 0; |
| v_LGenBase_Test_counters[3] := 0; |
| v_LGenBase_Test_counters[4] := 0; |
| v_LGenBase_Test_counters[5] := 0; |
| |
| 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", 20}) |
| |
| f_EPTF_LGenBase_declareFunction(c_LGenBase_Test_CheckFinish, {customFinishFunction := refers(f_LGenBase_Test_checkFinished)}) |
| v_dummyInt := f_EPTF_LGenBase_declareFunction("LimitStart", {testStepFunction:= refers(f_LGenBase_Test_limitStart)}) |
| v_dummyInt := f_EPTF_LGenBase_declareFunction("LimitStop", {testStepFunction:= refers(f_LGenBase_Test_limitStop)}) |
| v_dummyInt := f_EPTF_LGenBase_declareFunction("LimitStart2", {testStepFunction:= refers(f_LGenBase_Test_limitStart2)}) |
| v_dummyInt := f_EPTF_LGenBase_declareFunction("LimitStop2", {testStepFunction:= refers(f_LGenBase_Test_limitStop2)}) |
| |
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable(pl_fsmName); |
| if(pl_phase){ |
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_FSM2); |
| v_dummyInt := f_EPTF_LGenBase_PhaseList_store( |
| { |
| name := "BasicPhases", |
| phases := |
| { |
| { name := "preamble", enabled := true }, |
| { name := "loadgen" , enabled := true } |
| } |
| }) |
| } |
| |
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3( pl_sc ) |
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},true) |
| |
| if(pl_phase){ |
| if (not f_EPTF_LGenBase_startPhase( pl_eGrpName := "eg1", |
| pl_scName := "SC1", |
| pl_phase := "preamble", |
| pl_fn := refers(f_LGenBase_Test_phaseFinished)) ){ |
| setverdict(fail, "StartPhase for phase preamble was not successfull!"); |
| } |
| } |
| |
| if(pl_restoreScenarioBetween2Limit){ |
| log("Calling stopTrafficCase"); |
| f_EPTF_LGenBase_stopTrafficCase("eg1", "SC1", "TC1"); |
| } |
| log("Limit to : " & log2str(pl_eLimit)); |
| f_EPTF_LGenBase_limitExecution(pl_eGrpIdx := 0, |
| pl_eLimit := pl_eLimit); |
| |
| if(pl_restoreScenarioBetween2Limit){ |
| log("Restore for the first time"); |
| f_EPTF_LGenBase_restoreScenario( |
| pl_eGrpName := "eg1", |
| pl_scName := "SC1", |
| pl_autoStart := pl_restoreAutoStart) |
| if(pl_restoreStopAfter){ |
| log("Calling stopTrafficCase(2nd time)"); |
| f_EPTF_LGenBase_stopTrafficCase("eg1", "SC1", "TC1"); |
| } |
| } |
| |
| if(pl_eLimit != pl_eLimit2){ |
| log("Limit(2nd time) to : " & log2str(pl_eLimit2)); |
| f_EPTF_LGenBase_limitExecution(pl_eGrpIdx := 0, |
| pl_eLimit := pl_eLimit2); |
| } |
| |
| if(pl_restoreScenarioBetween2Limit){ |
| log("Restore the 2nd time"); |
| f_EPTF_LGenBase_restoreScenario( |
| pl_eGrpName := "eg1", |
| pl_scName := "SC1", |
| pl_autoStart := pl_restoreAutoStart) |
| if(pl_restoreStopAfter){ |
| log("Calling stopTrafficCase(3rd time)"); |
| f_EPTF_LGenBase_stopTrafficCase("eg1", "SC1", "TC1"); |
| } |
| |
| log("Limit(3rd time) to : " & log2str(15)); |
| f_EPTF_LGenBase_limitExecution(pl_eGrpIdx := 0, |
| pl_eLimit := 15); |
| log("Limit(4th time) to : " & log2str(1)); |
| f_EPTF_LGenBase_limitExecution(pl_eGrpIdx := 0, |
| pl_eLimit := 1); |
| log("Restore the 3nd time"); |
| f_EPTF_LGenBase_restoreScenario( |
| pl_eGrpName := "eg1", |
| pl_scName := "SC1", |
| pl_autoStart := pl_restoreAutoStart) |
| if(pl_restoreStopAfter){ |
| log("Calling stopTrafficCase(4th time)"); |
| f_EPTF_LGenBase_stopTrafficCase("eg1", "SC1", "TC1"); |
| } |
| |
| log("Limit to : " & log2str(3)); |
| f_EPTF_LGenBase_limitExecution(pl_eGrpIdx := 0, |
| pl_eLimit := 3); |
| } |
| |
| if(pl_testUnLimit){ |
| log("Unlimiting"); |
| f_EPTF_LGenBase_unLimitExecution(pl_eGrpIdx := 0); |
| } |
| |
| if(not pl_phase){ |
| f_EPTF_LGenBase_startTrafficCase("eg1", "SC1", "TC1"); |
| } |
| |
| |
| |
| timer T_2 |
| T_2.start( 2.0 ) |
| alt{ |
| [] T_2.timeout { |
| v_LGenBase_testFinished := false |
| } |
| } |
| |
| if(pl_setCPS){ |
| var float vl_CPS2Reach := 0.0; |
| var float vl_currentCPS := 0.0; |
| vl_CPS2Reach := f_EPTF_LGenBase_getTcCpsToReachByName("eg1", "SC1", "TC1"); |
| log("CPStoReach : " & log2str(vl_CPS2Reach)); |
| vl_currentCPS := f_EPTF_LGenBase_getMeasuredCPSByNames("eg1", "SC1", "TC1"); |
| log("Actual CPS : " & log2str(vl_currentCPS)); |
| |
| if((vl_CPS2Reach - 0.5) < vl_currentCPS and vl_currentCPS < (vl_CPS2Reach + 0.5)){ |
| setverdict(pass) } |
| else { |
| setverdict(fail, "Wrong CPS value:" & log2str(vl_currentCPS)) |
| } |
| |
| log("Limit to : 2"); |
| f_EPTF_LGenBase_limitExecution(pl_eGrpIdx := 0, |
| pl_eLimit := 2); |
| |
| timer T_x |
| T_x.start( 4.0 ) |
| alt{ |
| [] T_x.timeout { |
| v_LGenBase_testFinished := false |
| } |
| } |
| vl_CPS2Reach := f_EPTF_LGenBase_getTcCpsToReachByName("eg1", "SC1", "TC1"); |
| log("CPStoReach after limiting : " & log2str(vl_CPS2Reach)); |
| vl_currentCPS := f_EPTF_LGenBase_getMeasuredCPSByNames("eg1", "SC1", "TC1"); |
| log("Actual CPS after limiting : " & log2str(vl_currentCPS)); |
| |
| if((vl_CPS2Reach - 0.5) < vl_currentCPS and vl_currentCPS < (vl_CPS2Reach + 0.5)){ |
| setverdict(pass) } |
| else { |
| setverdict(fail, "Wrong CPS value:" & log2str(vl_currentCPS)) |
| } |
| |
| log("Limit to : 10"); |
| f_EPTF_LGenBase_limitExecution(pl_eGrpIdx := 0, |
| pl_eLimit := 10); |
| |
| T_x.start( 4.0 ) |
| alt{ |
| [] T_x.timeout { |
| v_LGenBase_testFinished := false |
| } |
| } |
| vl_CPS2Reach := f_EPTF_LGenBase_getTcCpsToReachByName("eg1", "SC1", "TC1"); |
| log("CPStoReach after second limiting: " & log2str(vl_CPS2Reach)); |
| vl_currentCPS := f_EPTF_LGenBase_getMeasuredCPSByNames("eg1", "SC1", "TC1"); |
| log("Actual CPS after second limiting: " & log2str(vl_currentCPS)); |
| |
| if((vl_CPS2Reach - 0.5) < vl_currentCPS and vl_currentCPS < (vl_CPS2Reach + 0.5)){ |
| setverdict(pass) } |
| else { |
| setverdict(fail, "Wrong CPS value:" & log2str(vl_currentCPS)) |
| } |
| |
| log("Calling setCPS with 5.0"); |
| f_EPTF_LGenBase_setCPS( |
| pl_tcAbsIdx := 0, |
| pl_newCps := 5.0) |
| |
| T_x.start( 4.0 ) |
| alt{ |
| [] T_x.timeout { |
| v_LGenBase_testFinished := false |
| } |
| } |
| |
| vl_CPS2Reach := f_EPTF_LGenBase_getTcCpsToReachByName("eg1", "SC1", "TC1"); |
| log("CPStoReach after setCPS: " & log2str(vl_CPS2Reach)); |
| vl_currentCPS := f_EPTF_LGenBase_getMeasuredCPSByNames("eg1", "SC1", "TC1"); |
| log("Actual CPS after setCPS: " & log2str(vl_currentCPS)); |
| } |
| |
| var integer vl_varId; |
| var EPTF_Var_DirectContent vl_currentContent; |
| if( not pl_noCheckVal){ |
| vl_varId := f_EPTF_Var_getId(f_EPTF_LGenBase_varNameOfTCVar(0,"TCvarA")); |
| f_EPTF_Var_getContent(vl_varId, vl_currentContent) |
| |
| if(vl_currentContent.floatVal == pl_IncValue_1Run){ |
| setverdict(pass) } |
| else { |
| setverdict(fail, "Variable value:" & log2str(vl_currentContent.floatVal)) |
| } |
| } |
| |
| if(pl_unLimit){ |
| log("Unlimiting"); |
| f_EPTF_LGenBase_unLimitExecution(pl_eGrpIdx := 0); |
| } |
| |
| if(pl_phase){ |
| if (not f_EPTF_LGenBase_startPhase( pl_eGrpName := "eg1", |
| pl_scName := "SC1", |
| pl_phase := "loadgen", |
| pl_fn := refers(f_LGenBase_Test_phaseFinished)) ){ |
| setverdict(fail, "StartPhase for phase loadgen was not successfull!"); |
| } |
| } |
| |
| T_2.start( 1.0 ) |
| alt{ |
| [] T_2.timeout { |
| v_LGenBase_testFinished := false |
| } |
| } |
| |
| if(pl_stopBetween2Starts){ |
| log("Calling stopTrafficCase"); |
| f_EPTF_LGenBase_stopTrafficCase("eg1", "SC1", "TC1"); |
| } |
| |
| if(pl_unLimit){ |
| log("Unlimiting"); |
| f_EPTF_LGenBase_unLimitExecution(pl_eGrpIdx := 0); |
| } |
| if(not pl_phase){ |
| f_EPTF_LGenBase_startTrafficCase("eg1", "SC1", "TC1"); |
| } |
| |
| T_2.start( 1.0 ) |
| alt{ |
| [] T_2.timeout { |
| v_LGenBase_testFinished := false |
| } |
| } |
| |
| if( not pl_noCheckVal){ |
| vl_varId := f_EPTF_Var_getId(f_EPTF_LGenBase_varNameOfTCVar(0,"TCvarA")); |
| f_EPTF_Var_getContent(vl_varId, vl_currentContent) |
| if(vl_currentContent.floatVal == pl_IncValue_2Run){ |
| setverdict(pass) } |
| else { |
| setverdict(fail,"Variable value:" & log2str(vl_currentContent.floatVal)) |
| } |
| } |
| |
| if( not pl_noCheck){ |
| if (pl_availableCheck == false){ |
| if(pl_eLimit == pl_eLimit2){ |
| if(((not pl_testUnLimit) and (v_LGenBase_Test_counters[1] == pl_eLimit)) or |
| ((pl_testUnLimit) and (v_LGenBase_Test_counters[1] == v_LGenBase_Test_counters[0]))){ |
| setverdict(pass) } |
| else { |
| setverdict(fail, "The number of stop entities (" & log2str(v_LGenBase_Test_counters[1]) & ") does not equal with the given number (" & log2str(pl_eLimit) & ")") |
| } |
| } else { |
| if(((not pl_testUnLimit) and (v_LGenBase_Test_counters[1] == pl_eLimit2)) or |
| ((pl_testUnLimit) and (v_LGenBase_Test_counters[1] == v_LGenBase_Test_counters[0]))){ |
| setverdict(pass) } |
| else { |
| setverdict(fail, "The number of stop entities (" & log2str(v_LGenBase_Test_counters[1]) & ") does not equal with the given number (" & log2str(pl_eLimit2) & ")") |
| } |
| } |
| |
| if( ((not pl_stopBetween2Starts) and v_LGenBase_Test_counters[0] == float2int(pl_IncValue_1Run + pl_IncValue_2Run)) or |
| ((pl_stopBetween2Starts) and v_LGenBase_Test_counters[0] + v_LGenBase_Test_counters[2] == float2int(pl_IncValue_1Run + pl_IncValue_2Run)) ){ |
| setverdict(pass) } |
| else { |
| setverdict(fail, "The number of started entities (" & log2str(v_LGenBase_Test_counters[0]) & ") does not equal with the given number (" & log2str(float2int(pl_IncValue_1Run + pl_IncValue_2Run)) & ")") |
| } |
| |
| if((not pl_phase) or (v_LGenBase_Test_counters[4] == 2)){ |
| setverdict(pass) } |
| else { |
| setverdict(fail, "The number of stop phases (" & log2str(v_LGenBase_Test_counters[4]) & ") does not equal with the given number (" & log2str(2) & ")") |
| } |
| } else { |
| if(v_LGenBase_Test_counters[5] > 0){ |
| setverdict(pass); |
| } else { |
| setverdict(fail, "The function declared in the section of availableEntitiesFinished of the Fsm has not been started at all!"); |
| } |
| } |
| } |
| |
| f_EPTF_Base_cleanup_CT(); |
| } |
| |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_Test_LimitedExecution_Reportingfinish |
| // |
| // Purpose: Test the LimitedExecution feature with an FSM that reports finish. |
| // |
| /////////////////////////////////////////////////////////// |
| testcase tc_LGenBase_Test_LimitedExecution_reportingFinish() |
| runs on EPTF_LGenBase_VarAndStatTest_CT{ |
| f_LGenBase_Test_LimitExec(c_LGenBase_Test_FSMReportingFinish, |
| pl_stopBetween2Starts := true); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_Test_LimitedExecution_Reportingfinish_Unlimit |
| // |
| // Purpose: Test the LimitedExecution feature with an FSM that reports finish with unLimit. |
| // |
| /////////////////////////////////////////////////////////// |
| testcase tc_LGenBase_Test_LimitedExecution_reportingFinish_Unlimit() |
| runs on EPTF_LGenBase_VarAndStatTest_CT{ |
| f_LGenBase_Test_LimitExec(c_LGenBase_Test_FSMReportingFinish, |
| pl_testUnLimit := true, |
| pl_stopBetween2Starts := true); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_Test_LimitedExecution_NotReportingfinish |
| // |
| // Purpose: Test the LimitedExecution feature with an FSM that does not report finish. |
| // |
| /////////////////////////////////////////////////////////// |
| testcase tc_LGenBase_Test_LimitedExecution_notReportingFinish() |
| runs on EPTF_LGenBase_VarAndStatTest_CT{ |
| f_LGenBase_Test_LimitExec(c_LGenBase_Test_FSMNotReportingFinish, |
| pl_IncValue_1Run := 4.0, |
| pl_IncValue_2Run := 0.0, |
| pl_stopBetween2Starts := true); |
| } |
| |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_Test_LimitedExecution_ReportingfinishWithPhase |
| // |
| // Purpose: Test the LimitedExecution feature with an FSM that reports finish and a scenario that uses Phase. |
| // |
| /////////////////////////////////////////////////////////// |
| testcase tc_LGenBase_Test_LimitedExecution_reportingFinishWithPhase() |
| runs on EPTF_LGenBase_VarAndStatTest_CT{ |
| f_LGenBase_Test_LimitExec(c_LGenBase_Test_FSMReportingFinish, |
| pl_sc := c_LGenBase_Test_scPhase, |
| pl_phase := true, |
| pl_stopBetween2Starts := true); |
| } |
| |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_Test_LimitedExecution_Avail |
| // |
| // Purpose: Test the LimitedExecution feature with an FSM that reports finish and a scenario that uses availableEntitiesFinished. |
| // |
| /////////////////////////////////////////////////////////// |
| testcase tc_LGenBase_Test_LimitedExecution_avail() |
| runs on EPTF_LGenBase_VarAndStatTest_CT{ |
| f_LGenBase_Test_LimitExec(c_LGenBase_Test_FSMReportingFinish, |
| pl_IncValue_1Run := 4.0, |
| pl_IncValue_2Run := 0.0, |
| pl_sc := c_LGenBase_Test_scAvailFinished, |
| pl_stopBetween2Starts := true, |
| pl_availableCheck := true); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_Test_LimitedExecution_more |
| // |
| // Purpose: Test the LimitedExecution feature with calling limitExecution two times, the second time limits the execution even more. |
| // |
| /////////////////////////////////////////////////////////// |
| testcase tc_LGenBase_Test_LimitedExecution_more() |
| runs on EPTF_LGenBase_VarAndStatTest_CT{ |
| f_LGenBase_Test_LimitExec(c_LGenBase_Test_FSMReportingFinish, |
| pl_eLimit2 := 3, |
| pl_stopBetween2Starts := true); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_Test_LimitedExecution_less |
| // |
| // Purpose: Test the LimitedExecution feature with calling limitExecution two times, the second time limits the execution less. |
| // |
| /////////////////////////////////////////////////////////// |
| testcase tc_LGenBase_Test_LimitedExecution_less() |
| runs on EPTF_LGenBase_VarAndStatTest_CT{ |
| f_LGenBase_Test_LimitExec(c_LGenBase_Test_FSMReportingFinish, |
| pl_eLimit2 := 6, |
| pl_stopBetween2Starts := true); |
| } |
| |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_Test_LimitedExecution_lessRestore |
| // |
| // Purpose: Test the LimitedExecution feature with calling limitExecution two times, the second time limits the execution less. |
| // |
| /////////////////////////////////////////////////////////// |
| testcase tc_LGenBase_Test_LimitedExecution_lessRestore() |
| runs on EPTF_LGenBase_VarAndStatTest_CT{ |
| f_LGenBase_Test_LimitExec(c_LGenBase_Test_FSMReportingFinish, |
| pl_eLimit := 14, |
| pl_eLimit2 := 3, |
| pl_stopBetween2Starts := true, |
| pl_restoreScenarioBetween2Limit := true, |
| pl_noCheck := true); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_Test_LimitedExecution_lessRestoreWithStop |
| // |
| // Purpose: Test the LimitedExecution feature with calling limitExecution two times, the second time limits the execution less. |
| // |
| /////////////////////////////////////////////////////////// |
| testcase tc_LGenBase_Test_LimitedExecution_lessRestoreWithStop() |
| runs on EPTF_LGenBase_VarAndStatTest_CT{ |
| f_LGenBase_Test_LimitExec(c_LGenBase_Test_FSMReportingFinish, |
| pl_eLimit := 14, |
| pl_eLimit2 := 3, |
| pl_stopBetween2Starts := true, |
| pl_restoreScenarioBetween2Limit := true, |
| pl_restoreAutoStart := true, |
| pl_noCheck := true); |
| } |
| |
| |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_Test_LimitedExecution_lessRestore |
| // |
| // Purpose: Test the LimitedExecution feature with calling limitExecution two times, the second time limits the execution less. |
| // |
| /////////////////////////////////////////////////////////// |
| testcase tc_LGenBase_Test_LimitedExecution_lessRestoreAndStop() |
| runs on EPTF_LGenBase_VarAndStatTest_CT{ |
| f_LGenBase_Test_LimitExec(c_LGenBase_Test_FSMReportingFinish, |
| pl_eLimit := 14, |
| pl_eLimit2 := 3, |
| pl_stopBetween2Starts := true, |
| pl_restoreScenarioBetween2Limit := true, |
| pl_restoreStopAfter := true, |
| pl_noCheck := true); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_Test_LimitedExecution_lessRestoreWithStop |
| // |
| // Purpose: Test the LimitedExecution feature with calling limitExecution two times, the second time limits the execution less. |
| // |
| /////////////////////////////////////////////////////////// |
| testcase tc_LGenBase_Test_LimitedExecution_lessRestoreWithStopAndStop() |
| runs on EPTF_LGenBase_VarAndStatTest_CT{ |
| f_LGenBase_Test_LimitExec(c_LGenBase_Test_FSMReportingFinish, |
| pl_eLimit := 14, |
| pl_eLimit2 := 3, |
| pl_stopBetween2Starts := true, |
| pl_restoreScenarioBetween2Limit := true, |
| pl_restoreAutoStart := true, |
| pl_restoreStopAfter := true, |
| pl_noCheck := true); |
| } |
| |
| |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_Test_LimitedExecution_setCPSAfter |
| // |
| // Purpose: CPS setting |
| // |
| /////////////////////////////////////////////////////////// |
| testcase tc_LGenBase_Test_LimitedExecution_setCPSAfter() |
| runs on EPTF_LGenBase_VarAndStatTest_CT{ |
| f_LGenBase_Test_LimitExec(c_LGenBase_Test_FSMReportingFinish, |
| pl_sc := c_LGenBase_Test_scNoCondition, |
| pl_stopBetween2Starts := true, |
| pl_restoreScenarioBetween2Limit := true, |
| pl_restoreAutoStart := true, |
| pl_restoreStopAfter := true, |
| pl_noCheck := true, |
| pl_setCPS := true, |
| pl_noCheckVal := true); |
| } |
| |
| |
| |
| |
| |
| |
| } |
| |
| group fsmTimer{ |
| const integer c_gaussTimerSingle_densitySlides := 20; |
| modulepar float c_FsmTimer_tMin := 0.1; |
| modulepar float c_FsmTimer_tMax := 0.9; |
| |
| type record EPTF_LGenBase_Test_RandomTimer { float tMin, float tMax }; |
| type record of EPTF_LGenBase_Test_RandomTimer EPTF_LGenBase_Test_RandomTimerList; |
| type record EPTF_LGenBase_Test_GaussTimer { float mean, float deviation }; |
| type record of EPTF_LGenBase_Test_GaussTimer EPTF_LGenBase_Test_GaussTimerList; |
| modulepar EPTF_FloatList c_FsmTimers_static := {0.1, 0.9}; |
| modulepar EPTF_LGenBase_Test_RandomTimerList c_FsmTimers_random := {{0.1, 0.6}, {0.4, 0.9}}; |
| modulepar EPTF_LGenBase_Test_GaussTimerList c_FsmTimers_gauss := {{0.3, 0.02}, {0.7, 0.04}}; |
| |
| modulepar integer tsp_staticTimerSingle_startCount := 1000; |
| modulepar integer tsp_randomTimerSingle_startCount := 1000; |
| modulepar integer tsp_gaussTimerSingle_startCount := 1000; |
| |
| const charstring c_FsmTimer_gaussTimerFSMName := "c_gaussTimerFSM"; |
| const charstring c_FsmTimer_gaussTimerDensityStatName := "timeoutDistribution"; |
| const charstring c_FsmTimer_gaussTimerDeviationStatName := "timeoutDeviation"; |
| template EPTF_LGenBase_ScenarioTypeDeclarator t_FsmTimer_Scenario( |
| //in integer pl_entitySuccCount, |
| in float pl_cps := 1.0, |
| in EPTF_LGenBase_TcFinishConditionList pl_conditionList |
| ) := { |
| "SC1", |
| { |
| {"TC1",{ |
| {target := {cpsToReach := pl_cps}}, |
| {fsmList := {c_FsmTimer_gaussTimerFSMName}}, |
| {entityFinishConditions := {}}, |
| {trafficStartFinish := pl_conditionList}, |
| {trafficFinishedActions := {{testFinished := {} }}}, |
| {enableEntitiesAtStart := true}, |
| {enabledAtStart := true} |
| } |
| } |
| }, |
| { |
| {enabled := true} |
| } |
| } |
| |
| group gaussTimer{ |
| |
| const charstring c_FsmTimer_gaussTimer1Name := "gaussTimer1"; |
| const charstring c_FsmTimer_gaussTimer2Name := "gaussTimer2"; |
| const charstring c_FsmTimer_gaussTimer_timerStartStepName := "gaussTimerStartStep"; |
| |
| function f_LGenBase_Test_gaussTimer_startTimerStep(in EPTF_LGenBase_TestStepArgs pl_ptr) |
| runs on EPTF_LGenBase_Test_CT { |
| var integer vl_timerToStart := pl_ptr.eIdx; |
| pl_ptr.refContext.fRefArgs := {vl_timerToStart}; |
| f_EPTF_LGenBase_step_timerStart(pl_ptr); |
| } |
| |
| function f_LGenBase_Test_getTimerRange( |
| in EPTF_LGenBase_FsmTimerList pl_fsmTimerList, |
| out float pl_min, |
| out float pl_max) |
| runs on EPTF_LGenBase_Test_CT |
| { |
| pl_min := 10000.0; |
| pl_max := -1.0; |
| for(var integer i:=0; i<sizeof(pl_fsmTimerList); i:=i+1) { |
| if(ischosen(pl_fsmTimerList[i].timerParams.static)) { |
| if(pl_fsmTimerList[i].timerParams.static.startValue < pl_min) { |
| pl_min := pl_fsmTimerList[i].timerParams.static.startValue; |
| } |
| if(pl_fsmTimerList[i].timerParams.static.startValue > pl_max) { |
| pl_max := pl_fsmTimerList[i].timerParams.static.startValue; |
| } |
| } else if(ischosen(pl_fsmTimerList[i].timerParams.random)) { |
| if(pl_fsmTimerList[i].timerParams.random.timeoutMin < pl_min) { |
| pl_min := pl_fsmTimerList[i].timerParams.random.timeoutMin; |
| } |
| if(pl_fsmTimerList[i].timerParams.random.timeoutMax > pl_max) { |
| pl_max := pl_fsmTimerList[i].timerParams.random.timeoutMax; |
| } |
| } else if(ischosen(pl_fsmTimerList[i].timerParams.randomGauss)) { |
| // FIXME? |
| pl_min := 0.0; |
| pl_max := pl_fsmTimerList[i].timerParams.randomGauss.mean * 2.0; |
| } else { |
| setverdict(inconc, "unsupported timer param "&log2str(pl_fsmTimerList[i].timerParams)); |
| f_EPTF_Base_stop(none); |
| } |
| } |
| } |
| |
| function f_LGenBase_Test_fsmTimerTest( |
| in integer pl_eGrpSize, |
| in float pl_cps, |
| //in integer pl_entitySuccCount, |
| in EPTF_LGenBase_TcFinishConditionList pl_conditionList, |
| in float pl_timeout, |
| in EPTF_LGenBase_FsmTimerList pl_fsmTimerList, |
| in float pl_timerRangeMin, |
| in float pl_timerRangeMax, |
| out EPTF_IntegerArray2D pl_distribution, |
| out EPTF_FloatList pl_meanList, |
| out EPTF_FloatList pl_deviationList |
| ) |
| runs on EPTF_LGenBase_Test_CT{ |
| |
| if(pl_eGrpSize > sizeof(pl_fsmTimerList)) { |
| setverdict(inconc, "pl_eGrpSize > sizeof(pl_fsmTimerList)"); |
| f_EPTF_Base_stop(none); |
| } |
| |
| var EPTF_CharstringList vl_timerNameList := {}; |
| for(var integer i:=0; i<sizeof(pl_fsmTimerList); i:=i+1) { |
| vl_timerNameList[i] := pl_fsmTimerList[i].name; |
| } |
| |
| var EPTF_LGenBase_FsmTableDeclarator c_FsmTimer_fsm := { |
| name := c_FsmTimer_gaussTimerFSMName, |
| fsmParams :={ |
| {stateList := {"idle", "running"}}, |
| {fsmTimerList := pl_fsmTimerList}, |
| { |
| varList := { |
| { |
| name := "timeoutVar", |
| initValue := { |
| floatVal := 0.000000 |
| }, |
| scope := FSM |
| } |
| } |
| }, |
| {statMeasWithParamsList := { |
| { |
| name := "timeoutChrono", |
| providerVarName := "", |
| targetVarName := "timeoutVar", |
| statMeasParams := { |
| statType := chrono |
| }, |
| scope := FSM |
| }, |
| { |
| name := c_FsmTimer_gaussTimerDensityStatName, |
| providerVarName := "timeoutVar", |
| targetVarName := "", |
| statMeasParams := { |
| params := { |
| density := { |
| scale := { |
| min := pl_timerRangeMin, |
| max := pl_timerRangeMax, |
| n := c_gaussTimerSingle_densitySlides, |
| scale := linear |
| } |
| } |
| } |
| }, |
| scope := FSM |
| }, |
| { |
| name := c_FsmTimer_gaussTimerDeviationStatName, |
| providerVarName := "timeoutVar", |
| targetVarName := "", |
| statMeasParams := { |
| params := { |
| standardDev := { } |
| } |
| }, |
| scope := FSM |
| } |
| } |
| } |
| }, |
| table := { |
| extendedTable := { |
| { |
| events2Listen := { events := {{ singleEvent := {c_EPTF_LGenBase_behavior, c_EPTF_LGenBase_inputName_testMgmt_startTC, fsm}}}}, |
| cellRow :={ statedCellRow := {{ |
| inState := { state := "idle"}, |
| cell :={{ |
| {c_FsmTimer_gaussTimer_timerStartStepName, omit}, |
| {c_EPTF_LGenBase_stepName_fsmResetChrono,{statMeasName := "timeoutChrono"}}, |
| {c_EPTF_LGenBase_stepName_fsmStartChrono,{statMeasName := "timeoutChrono"}} |
| }, |
| omit, "running" |
| } |
| } |
| } |
| } |
| }, |
| { |
| events2Listen := { events := {{ eventList := {c_EPTF_LGenBase_specialBName_timerTimeout, vl_timerNameList, fsm}}}}, |
| cellRow :={ statedCellRow := {{ |
| inState := { state := "running"}, |
| cell :={{ |
| {c_EPTF_LGenBase_stepName_fsmStopChrono, {statMeasName := "timeoutChrono"}}, |
| {c_EPTF_LGenBase_stepName_trafficSuccess,omit} |
| }, |
| omit, "idle" |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| |
| f_EPTF_LGenBase_init("gaussTimerTest"); |
| f_EPTF_LGenBase_declareBehaviorType("gaussTimer", -1, null, null, null, null); |
| f_EPTF_LGenBase_declareEntityType("et1", {"gaussTimer"}); |
| f_EPTF_LGenBase_declareStep("gaussTimer", {c_FsmTimer_gaussTimer_timerStartStepName, refers(f_LGenBase_Test_gaussTimer_startTimerStep)}) |
| f_EPTF_LGenBase_declareFSMTable(c_FsmTimer_fsm); |
| f_EPTF_LGenBase_createEntityGroup({"eg1", "et1", pl_eGrpSize}); |
| f_EPTF_LGenBase_declareScenarioType3(valueof(t_FsmTimer_Scenario(/*pl_entitySuccCount,*/ pl_cps, pl_conditionList))); |
| v_dummyInt := f_EPTF_LGenBase_addGeneralEventListener( |
| c_EPTF_LGenBase_bIdx, |
| c_EPTF_LGenBase_inputIdx_testMgmt_testFinished, |
| refers(f_EPTF_LGenBase_Test_testFinishedListener), {}) |
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"}, true); |
| f_EPTF_LGenBase_wait4TestFinished(pl_timeout); |
| //var EPTF_IntegerArray2D vl_ret |
| for ( var integer vl_i := 0; vl_i < pl_eGrpSize ; vl_i := vl_i+1 ) |
| { |
| //Get timeout values |
| var integer vl_statId := f_EPTF_LGenBase_fsmStatMeasIdOfFSM(vl_i, 0, c_FsmTimer_gaussTimerDensityStatName); |
| var integer vl_statId2 := f_EPTF_LGenBase_fsmStatMeasIdOfFSM(vl_i, 0, c_FsmTimer_gaussTimerDeviationStatName); |
| f_EPTF_StatMeasure_getStat_density(vl_statId, pl_distribution[vl_i]); |
| f_EPTF_StatMeasure_getStat_standardDev(vl_statId2, pl_deviationList[vl_i]); |
| f_EPTF_StatMeasure_getStat_standardDev_mean(vl_statId2, pl_meanList[vl_i]); |
| } |
| //return vl_ret; |
| } |
| |
| function f_LGenBase_Test_staticTimer( |
| in integer pl_eGrpSize, |
| in EPTF_LGenBase_FsmTimerList pl_fsmTimerList) |
| runs on EPTF_LGenBase_Test_CT |
| { |
| var EPTF_IntegerArray2D vl_distribution; |
| var EPTF_FloatList vl_meanList; |
| var EPTF_FloatList vl_deviationList; |
| var float vl_cps := (1.0/c_FsmTimer_tMax) * int2float(pl_eGrpSize); |
| var float vl_min := 0.0, vl_max := 0.0; |
| f_LGenBase_Test_getTimerRange(pl_fsmTimerList, vl_min, vl_max); |
| f_LGenBase_Test_fsmTimerTest( |
| pl_eGrpSize := pl_eGrpSize, |
| pl_cps := vl_cps, |
| pl_conditionList := {{nrOfExecStart := {tsp_staticTimerSingle_startCount, {}} }}, |
| pl_timeout := (int2float(tsp_staticTimerSingle_startCount) / vl_cps) + 5.0, |
| pl_fsmTimerList := pl_fsmTimerList, |
| pl_timerRangeMin := vl_min, |
| pl_timerRangeMax := vl_max, |
| pl_distribution := vl_distribution, |
| pl_meanList := vl_meanList, |
| pl_deviationList := vl_deviationList) |
| log(vl_distribution); |
| log(vl_meanList); |
| log(vl_deviationList); |
| const float c_ignore := 0.0; |
| for(var integer i:=0; i<pl_eGrpSize; i:=i+1) { |
| f_LGenBase_Test_checkDeviation(pl_fsmTimerList[i].timerParams.static.startValue, vl_meanList[i], c_ignore, c_ignore, 0.01); |
| if(vl_deviationList[i] > 0.0001) { |
| setverdict(fail, "The measured deviation is over the limit, measured dev="&float2str(vl_deviationList[0])&")."); |
| } |
| } |
| f_EPTF_Base_stop(pass); |
| } |
| |
| function f_LGenBase_Test_randomTimer( |
| in integer pl_eGrpSize, |
| in EPTF_LGenBase_FsmTimerList pl_fsmTimerList) |
| runs on EPTF_LGenBase_Test_CT |
| { |
| var EPTF_IntegerArray2D vl_distribution; |
| var EPTF_FloatList vl_meanList; |
| var EPTF_FloatList vl_deviationList; |
| var float vl_cps := (1.0/c_FsmTimer_tMax) * int2float(pl_eGrpSize); |
| var float vl_min := 0.0, vl_max := 0.0; |
| f_LGenBase_Test_getTimerRange(pl_fsmTimerList, vl_min, vl_max); |
| f_LGenBase_Test_fsmTimerTest( |
| pl_eGrpSize := pl_eGrpSize, |
| pl_cps := vl_cps, |
| pl_conditionList := {{nrOfExecStart := {tsp_randomTimerSingle_startCount, {}} }}, |
| pl_timeout := (int2float(tsp_randomTimerSingle_startCount) / vl_cps) + 5.0, |
| pl_fsmTimerList := pl_fsmTimerList, |
| pl_timerRangeMin := vl_min, |
| pl_timerRangeMax := vl_max, |
| pl_distribution := vl_distribution, |
| pl_meanList := vl_meanList, |
| pl_deviationList := vl_deviationList) |
| log(vl_distribution); |
| log(vl_meanList); |
| log(vl_deviationList); |
| |
| for(var integer i:=0; i<pl_eGrpSize; i:=i+1) { |
| vl_min := pl_fsmTimerList[i].timerParams.random.timeoutMin; |
| vl_max := pl_fsmTimerList[i].timerParams.random.timeoutMax; |
| var float vl_expectedMean := (vl_min + vl_max) * 0.5; |
| // see variance on http://en.wikipedia.org/wiki/Uniform_distribution_(continuous) |
| var float vl_expectedDeviation := ((vl_max-vl_min) * (vl_max-vl_min)) / 12.0; |
| f_LGenBase_Test_checkDeviation(vl_expectedMean, vl_meanList[i], vl_expectedDeviation, vl_deviationList[i], 0.1); |
| } |
| |
| f_EPTF_Base_stop(pass); |
| } |
| |
| function f_LGenBase_Test_gaussTimer( |
| in integer pl_eGrpSize, |
| in EPTF_LGenBase_FsmTimerList pl_fsmTimerList) |
| runs on EPTF_LGenBase_Test_CT |
| { |
| var EPTF_IntegerArray2D vl_distribution; |
| var EPTF_FloatList vl_meanList; |
| var EPTF_FloatList vl_deviationList; |
| var float vl_cps := (1.0/c_FsmTimer_tMax) * int2float(pl_eGrpSize); |
| var float vl_min := 0.0, vl_max := 0.0; |
| f_LGenBase_Test_getTimerRange(pl_fsmTimerList, vl_min, vl_max); |
| f_LGenBase_Test_fsmTimerTest( |
| pl_eGrpSize := pl_eGrpSize, |
| pl_cps := vl_cps, |
| pl_conditionList := {{nrOfExecStart := {tsp_gaussTimerSingle_startCount, {}} }}, |
| pl_timeout := (int2float(tsp_gaussTimerSingle_startCount) / vl_cps) + 5.0, |
| pl_fsmTimerList := pl_fsmTimerList, |
| pl_timerRangeMin := vl_min, |
| pl_timerRangeMax := vl_max, |
| pl_distribution := vl_distribution, |
| pl_meanList := vl_meanList, |
| pl_deviationList := vl_deviationList) |
| log(vl_distribution); |
| log(vl_meanList); |
| log(vl_deviationList); |
| |
| for(var integer i:=0; i<pl_eGrpSize; i:=i+1) { |
| var float vl_expectedMean := pl_fsmTimerList[i].timerParams.randomGauss.mean; |
| var float vl_expectedDeviation := pl_fsmTimerList[i].timerParams.randomGauss.deviation; |
| var float vl_measuredDeviation := f_sqrtF(vl_deviationList[i]); |
| f_LGenBase_Test_checkDeviation(vl_expectedMean, vl_meanList[i], vl_expectedDeviation, vl_measuredDeviation, 0.1); |
| } |
| |
| f_EPTF_Base_stop(pass); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_Test_staticTimerSingle |
| // |
| // Purpose: |
| // This positive test tests the FSM timers. |
| // The timers run parallel, at the same time. |
| // |
| // Action: |
| // There is 1 entity. The FSM has a static timer. |
| // Starts the timer 1000 times. |
| // Stores the timeout values into distribution EPTF stats. |
| // |
| // Expected Result: |
| // the mean value is the timer start-value |
| // the variance is less than 1e-6 |
| // |
| /////////////////////////////////////////////////////////// |
| testcase tc_LGenBase_Test_staticTimerSingle() |
| runs on EPTF_LGenBase_Test_CT{ |
| var EPTF_LGenBase_FsmTimerList vl_fsmTimerList := { |
| { |
| name := "timer1", |
| timerParams := { |
| static := { |
| startValue := c_FsmTimers_static[0] |
| } |
| } |
| } |
| } |
| f_LGenBase_Test_staticTimer(1, vl_fsmTimerList); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_Test_staticTimerParallel |
| // |
| // Purpose: |
| // This positive test tests the FSM timers. |
| // The timers run parallel, at the same time. |
| // |
| // Action: |
| // There are 2 entities. Each FSM has a static timer. |
| // Starts the timers 1000 times each. |
| // Stores the timeout values into distribution EPTF stats. |
| // |
| // Expected Result: |
| // the mean value is the timer start-value |
| // the variance is less than 1e-6 |
| // |
| /////////////////////////////////////////////////////////// |
| testcase tc_LGenBase_Test_staticTimerParallel() |
| runs on EPTF_LGenBase_Test_CT{ |
| var EPTF_LGenBase_FsmTimerList vl_fsmTimerList := {}; |
| for(var integer i:=0; i<sizeof(c_FsmTimers_static); i:=i+1) { |
| vl_fsmTimerList[i] := { |
| name := "timer"&int2str(i), |
| timerParams := { |
| static := { |
| startValue := c_FsmTimers_static[i] |
| } |
| } |
| } |
| } |
| // f_LGenBase_Test_staticTimer(50); |
| f_LGenBase_Test_staticTimer(2, vl_fsmTimerList); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_Test_randomTimerSingle |
| // |
| // Purpose: |
| // This positive test tests the FSM timers with uniform distribution. |
| // The timers run parallel, at the same time. |
| // |
| // Action: |
| // There is 1 entity. The FSM has a random timer. |
| // Starts the timer 1000 times. |
| // Stores the timeout values into distribution EPTF stats. |
| // |
| // Expected Result: |
| // the mean value is (min+max)/2.0 |
| // the variance is ((max-min)*(max-min))/12.0 |
| // |
| /////////////////////////////////////////////////////////// |
| testcase tc_LGenBase_Test_randomTimerSingle() |
| runs on EPTF_LGenBase_Test_CT{ |
| var EPTF_LGenBase_FsmTimerList vl_fsmTimerList := { |
| { |
| name := "timer1", |
| timerParams := { |
| random := { |
| timeoutMin := c_FsmTimers_random[0].tMin, // FIXME |
| timeoutMax := c_FsmTimers_random[0].tMax // FIXME |
| } |
| } |
| } |
| } |
| f_LGenBase_Test_randomTimer(1, vl_fsmTimerList); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_Test_randomTimerParallel |
| // |
| // Purpose: |
| // This positive test tests the FSM timers with uniform distribution. |
| // The timers run parallel, at the same time. |
| // |
| // Action: |
| // There are 2 entities. Each FSM has a random timer. |
| // Starts the timers 1000 times each. |
| // Stores the timeout values into distribution EPTF stats. |
| // |
| // Expected Result: |
| // the mean value is (min+max)/2.0 |
| // the variance is ((max-min)*(max-min))/12.0 |
| // |
| /////////////////////////////////////////////////////////// |
| testcase tc_LGenBase_Test_randomTimerParallel() |
| runs on EPTF_LGenBase_Test_CT{ |
| var EPTF_LGenBase_FsmTimerList vl_fsmTimerList := {} |
| for(var integer i:=0; i<sizeof(c_FsmTimers_random); i:=i+1) { |
| vl_fsmTimerList[i] := { |
| name := "timer"&int2str(i), |
| timerParams := { |
| random := { |
| timeoutMin := c_FsmTimers_random[i].tMin, // FIXME |
| timeoutMax := c_FsmTimers_random[i].tMax // FIXME |
| } |
| } |
| } |
| } |
| // f_LGenBase_Test_randomTimer(50); |
| f_LGenBase_Test_randomTimer(2, vl_fsmTimerList); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_Test_gaussTimerSingle |
| // |
| // Purpose: |
| // This positive test tests the FSM timers with normal distribution. |
| // The timers run parallel, at the same time. |
| // |
| // Action: |
| // There is 1 entity. The FSM has a normal distribution (gauss) random timer. |
| // Starts the timer 1000 times. |
| // Stores the timeout values into distribution EPTF stats. |
| // |
| // Expected Result: |
| // The distribution shows Gaussian curve. |
| // |
| /////////////////////////////////////////////////////////// |
| testcase tc_LGenBase_Test_gaussTimerSingle() |
| runs on EPTF_LGenBase_Test_CT{ |
| var EPTF_LGenBase_FsmTimerList vl_fsmTimerList := { |
| { |
| name := "timer1", |
| timerParams := { |
| randomGauss := { |
| mean := c_FsmTimers_gauss[0].mean, |
| deviation := c_FsmTimers_gauss[0].deviation |
| } |
| } |
| } |
| } |
| f_LGenBase_Test_gaussTimer(1, vl_fsmTimerList); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_Test_gaussTimerParallel |
| // |
| // Purpose: |
| // This positive test tests the FSM timers with normal distribution. |
| // The timers run parallel, at the same time. |
| // |
| // Action: |
| // There are 2 entities. Each FSM has a normal distribution (gauss) random timer. |
| // Starts the timers 1000 times each. |
| // Stores the timeout values into distribution EPTF stats. |
| // |
| // Expected Result: |
| // The distributions show Gaussian curve. |
| // |
| /////////////////////////////////////////////////////////// |
| testcase tc_LGenBase_Test_gaussTimerParallel() |
| runs on EPTF_LGenBase_Test_CT{ |
| var EPTF_LGenBase_FsmTimerList vl_fsmTimerList := {} |
| for(var integer i:=0; i<sizeof(c_FsmTimers_random); i:=i+1) { |
| vl_fsmTimerList[i] := { |
| name := "timer"&int2str(i), |
| timerParams := { |
| randomGauss := { |
| mean := c_FsmTimers_gauss[i].mean, |
| deviation := c_FsmTimers_gauss[i].deviation |
| } |
| } |
| } |
| } |
| // f_LGenBase_Test_gaussTimer(50); |
| f_LGenBase_Test_gaussTimer(2, vl_fsmTimerList); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_EPTF_LGenBase_Test_rnd_normal_basic |
| // |
| // Purpose: |
| // This positive test tests f_EPTF_LGenBase_rnd_normal function. |
| // This function should genereate random numbers with normal distribution. |
| // |
| // Action: |
| // It generates a given number of random numbers with the defined mean and deviation. |
| // It stores the generated numbers with the help of StatMeasure and in the end it |
| // determines the mean and teh deviation of the stored list of random numbers. |
| // |
| // Expected Result: |
| // The calculated numbers should be equal with the starting parameters |
| // between a given tolerance limit. |
| // |
| /////////////////////////////////////////////////////////// |
| testcase tc_EPTF_LGenBase_Test_rnd_normal_basic() |
| runs on EPTF_StatMeasure_CT{ |
| |
| f_EPTF_StatMeasure_init_CT("Gauss_Test_Basic"); |
| |
| var float vl_mean := 100.0; |
| var float vl_dev := 12.0; |
| |
| var integer vl_num := 100000; //number of generated random numbers |
| var float vl_tolerance := 0.01; //if vl_num is decreased it should be increased |
| |
| var integer vl_density_stat := f_EPTF_StatMeasure_newStat_density({}); |
| var integer vl_measure_stat := f_EPTF_StatMeasure_newStat_standardDev(); |
| |
| f_EPTF_StatMeasure_setScale_density(vl_density_stat, vl_mean - 5.0 * vl_dev, vl_mean + 5.0 * vl_dev, 100); |
| |
| var float vl_min := vl_mean; |
| var float vl_max := vl_mean; |
| |
| action("Generating "&log2str(vl_num)&" random numbers with normal distribution (mean="&log2str(vl_mean)&", deviation="&log2str(vl_dev)&")."); |
| action("Tolerance is "&log2str(vl_tolerance)&"."); |
| |
| var float vl_newrnd; |
| for (var integer i := 0; i < vl_num; i := i + 1 ) { |
| vl_newrnd := f_EPTF_LGenBase_rnd_normal(vl_mean, vl_dev); |
| // action(vl_newrnd); |
| |
| if (vl_newrnd < vl_min){ |
| vl_min := vl_newrnd; |
| } |
| if (vl_newrnd > vl_max){ |
| vl_max := vl_newrnd; |
| } |
| |
| f_EPTF_StatMeasure_addData_density(vl_density_stat, vl_newrnd); |
| f_EPTF_StatMeasure_addData_standardDev(vl_measure_stat, vl_newrnd); |
| } |
| |
| var float vl_m; |
| f_EPTF_StatMeasure_getStat_standardDev_mean(vl_measure_stat, vl_m); |
| var float vl_d; |
| f_EPTF_StatMeasure_getStat_standardDev(vl_measure_stat, vl_d); |
| vl_d := f_sqrtF(vl_d); |
| var EPTF_FloatList vl_density; |
| f_EPTF_StatMeasure_getStat_normalized_density(vl_density_stat, vl_density); |
| action("density function: ", vl_density); |
| action("Measured mean: ", vl_m); |
| action("Measured variance: ", vl_d); |
| action("Min num: ", vl_min); |
| action("Max num: ", vl_max); |
| |
| f_LGenBase_Test_checkDeviation(vl_mean, vl_m, vl_dev, vl_d, vl_tolerance); |
| |
| f_EPTF_Base_stop(pass); |
| } |
| } |
| |
| function f_LGenBase_Test_checkDeviation( |
| in float pl_expectedMean, |
| in float pl_measuredMean, |
| in float pl_expectedDev, |
| in float pl_measuredDev, |
| in float pl_tolerance) |
| { |
| var float vl_meanerr; |
| if (pl_measuredMean > pl_expectedMean){ |
| vl_meanerr := (pl_measuredMean - pl_expectedMean); |
| } |
| else { |
| vl_meanerr := (pl_expectedMean - pl_measuredMean); |
| } |
| |
| var float vl_devnerr; |
| if (pl_measuredDev > pl_expectedDev){ |
| vl_devnerr := (pl_measuredDev - pl_expectedDev); |
| } |
| else { |
| vl_devnerr := (pl_expectedDev - pl_measuredDev); |
| } |
| |
| if ( vl_meanerr > pl_tolerance * pl_expectedMean) { |
| setverdict(fail, "The measured mean is over the tolerance limit (Orig mean="&log2str(pl_expectedMean)&", measured mean="&log2str(pl_measuredMean) &")."); |
| } |
| |
| if ( vl_devnerr > pl_tolerance * pl_expectedDev) { |
| setverdict(fail, "The measured deviation is over the tolerance limit (Orig dev="&log2str(pl_expectedDev)&", measured dev="&log2str(pl_measuredDev) &")."); |
| } |
| } |
| |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_EPTF_LGenBase_Test_rnd_normal_multiple_gen |
| // |
| // Purpose: |
| // This positive test tests f_EPTF_LGenBase_rnd_normal function. |
| // This function should genereate random numbers with normal distribution. |
| // |
| // Action: |
| // It generates a given number of random numbers with 3 different mean and deviation. |
| // It stores the generated numbers with the help of StatMeasure and in the end it |
| // determines the mean and teh deviation of each of the stored list of random numbers. |
| // |
| // Expected Result: |
| // The calculated numbers should be equal with the starting parameters |
| // between a given tolerance limit. |
| // |
| /////////////////////////////////////////////////////////// |
| testcase tc_EPTF_LGenBase_Test_rnd_normal_multiple_gen() |
| runs on EPTF_StatMeasure_CT{ |
| |
| f_EPTF_StatMeasure_init_CT("Gauss_Test_Multiple_Generation"); |
| |
| var integer vl_listsize := 3; |
| |
| var EPTF_FloatList vl_mean := { |
| 100.0, |
| 5.0, |
| 125000.0 |
| } |
| var EPTF_FloatList vl_dev := { |
| 12.0, |
| 2.0, |
| 5000.0 |
| } |
| |
| var integer vl_num := 100000; //number of generated random numbers |
| var float vl_tolerance := 0.01; //if vl_num is decreased it should be increased |
| |
| var EPTF_IntegerList vl_density_stat := { |
| f_EPTF_StatMeasure_newStat_density({}), |
| f_EPTF_StatMeasure_newStat_density({}), |
| f_EPTF_StatMeasure_newStat_density({}) |
| } |
| var EPTF_IntegerList vl_measure_stat := { |
| f_EPTF_StatMeasure_newStat_standardDev(), |
| f_EPTF_StatMeasure_newStat_standardDev(), |
| f_EPTF_StatMeasure_newStat_standardDev() |
| } |
| |
| for (var integer i := 0; i < vl_listsize; i := i + 1){ |
| f_EPTF_StatMeasure_setScale_density(vl_density_stat[i], vl_mean[i] - 5.0 * vl_dev[i], vl_mean[i] + 5.0 * vl_dev[i], 100); |
| } |
| |
| for (var integer i := 0; i < vl_listsize; i := i + 1){ |
| action("Generating "&log2str(vl_num)&" random numbers with normal distribution #",i+1,"(mean="&log2str(vl_mean[i])&", deviation="&log2str(vl_dev[i])&")."); |
| } |
| action("Tolerance is "&log2str(vl_tolerance)&"."); |
| |
| var float vl_newrnd; |
| for (var integer i := 0; i < vl_num; i := i + 1 ) { |
| for (var integer j := 0; j < vl_listsize; j := j + 1){ |
| vl_newrnd := f_EPTF_LGenBase_rnd_normal(vl_mean[j], vl_dev[j]); |
| f_EPTF_StatMeasure_addData_density(vl_density_stat[j], vl_newrnd); |
| f_EPTF_StatMeasure_addData_standardDev(vl_measure_stat[j], vl_newrnd); |
| } |
| } |
| |
| var EPTF_FloatList vl_m, vl_d, vl_meanerr, vl_deverr; |
| for (var integer j := 0; j < vl_listsize; j := j + 1){ |
| f_EPTF_StatMeasure_getStat_standardDev_mean(vl_measure_stat[j], vl_m[j]); |
| f_EPTF_StatMeasure_getStat_standardDev(vl_measure_stat[j], vl_d[j]); |
| vl_d[j] := f_sqrtF(vl_d[j]); |
| |
| f_LGenBase_Test_checkDeviation( |
| vl_mean[j], |
| vl_m[j], |
| vl_dev[j], |
| vl_d[j], |
| vl_tolerance); |
| } |
| |
| f_EPTF_Base_stop(pass); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_EPTF_LGenBase_Test_rnd_normal_multiple_gen_rnd_order |
| // |
| // Purpose: |
| // This positive test tests f_EPTF_LGenBase_rnd_normal function. |
| // This function should genereate random numbers with normal distribution. |
| // |
| // Action: |
| // It generates a given number of random numbers with 3 different mean and deviation. |
| // The generation of the numbers happens in a random order. |
| // It stores the generated numbers with the help of StatMeasure and in the end it |
| // determines the mean and teh deviation of each of the stored list of random numbers. |
| // |
| // Expected Result: |
| // The calculated numbers should be equal with the starting parameters |
| // between a given tolerance limit. |
| // |
| /////////////////////////////////////////////////////////// |
| testcase tc_EPTF_LGenBase_Test_rnd_normal_multiple_gen_rnd_order() |
| runs on EPTF_StatMeasure_CT{ |
| |
| f_EPTF_StatMeasure_init_CT("Gauss_Test_Multiple_Generation"); |
| |
| var integer vl_listsize := 3; |
| |
| var EPTF_FloatList vl_mean := { |
| 100.0, |
| 5.0, |
| 125000.0 |
| } |
| var EPTF_FloatList vl_dev := { |
| 12.0, |
| 2.0, |
| 5000.0 |
| } |
| |
| var integer vl_num := 100000; //number of generated random numbers |
| var float vl_tolerance := 0.01; //if vl_num is decreased it should be increased |
| |
| var EPTF_IntegerList vl_density_stat := { |
| f_EPTF_StatMeasure_newStat_density({}), |
| f_EPTF_StatMeasure_newStat_density({}), |
| f_EPTF_StatMeasure_newStat_density({}) |
| } |
| var EPTF_IntegerList vl_measure_stat := { |
| f_EPTF_StatMeasure_newStat_standardDev(), |
| f_EPTF_StatMeasure_newStat_standardDev(), |
| f_EPTF_StatMeasure_newStat_standardDev() |
| } |
| |
| for (var integer i := 0; i < vl_listsize; i := i + 1){ |
| f_EPTF_StatMeasure_setScale_density(vl_density_stat[i], vl_mean[i] - 5.0 * vl_dev[i], vl_mean[i] + 5.0 * vl_dev[i], 100); |
| } |
| |
| for (var integer i := 0; i < vl_listsize; i := i + 1){ |
| action("Generating "&log2str(vl_num)&" random numbers with normal distribution #",i+1,"(mean="&log2str(vl_mean[i])&", deviation="&log2str(vl_dev[i])&")."); |
| } |
| action("Tolerance is "&log2str(vl_tolerance)&"."); |
| |
| var float vl_newrnd; |
| var integer index; |
| for (var integer i := 0; i < vl_listsize * vl_num; i := i + 1 ) { |
| index := float2int(rnd() * (int2float(vl_listsize) - 0.001)); |
| vl_newrnd := f_EPTF_LGenBase_rnd_normal(vl_mean[index], vl_dev[index]); |
| f_EPTF_StatMeasure_addData_density(vl_density_stat[index], vl_newrnd); |
| f_EPTF_StatMeasure_addData_standardDev(vl_measure_stat[index], vl_newrnd); |
| } |
| |
| var EPTF_FloatList vl_m, vl_d, vl_meanerr, vl_deverr; |
| for (var integer j := 0; j < vl_listsize; j := j + 1){ |
| f_EPTF_StatMeasure_getStat_standardDev_mean(vl_measure_stat[j], vl_m[j]); |
| f_EPTF_StatMeasure_getStat_standardDev(vl_measure_stat[j], vl_d[j]); |
| vl_d[j] := f_sqrtF(vl_d[j]); |
| |
| f_LGenBase_Test_checkDeviation( |
| vl_mean[j], |
| vl_m[j], |
| vl_dev[j], |
| vl_d[j], |
| vl_tolerance); |
| } |
| |
| f_EPTF_Base_stop(pass); |
| } |
| } |
| |
| //HN77446 |
| group tcTypeName{ |
| |
| const integer c_tcTypeCount := 10; |
| const charstring c_tcTypeNameBase := "TC" |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_EPTF_LGenBase_Test_getTcTypeName_Zero |
| // |
| // Purpose: Check if the f_EPTF_LGenBase_getTcTypeName returns with the proper name for index 0 |
| // |
| // Action: Calls function f_EPTF_LGenBase_Test_getTcTypeName |
| // |
| // Expected Result: The retrieved and the required name should be equal |
| /////////////////////////////////////////////////////////// |
| testcase tc_EPTF_LGenBase_Test_getTcTypeName_Zero() |
| runs on EPTF_LGenBase_CT |
| { |
| f_EPTF_LGenBase_Test_getTcTypeName(0,c_tcTypeNameBase&"0"); |
| } |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_EPTF_LGenBase_Test_getTcTypeName_Min2 |
| // |
| // Purpose: Check if the f_EPTF_LGenBase_getTcTypeName returns with "" for index -2 |
| // |
| // Action: Calls function f_EPTF_LGenBase_Test_getTcTypeName |
| // |
| // Expected Result: The retrieved name should be an empty string, as -2 is not a legal index |
| /////////////////////////////////////////////////////////// |
| testcase tc_EPTF_LGenBase_Test_getTcTypeName_Min2() |
| runs on EPTF_LGenBase_CT |
| { |
| f_EPTF_LGenBase_Test_getTcTypeName(-2,""); |
| } |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_EPTF_LGenBase_Test_getTcTypeName_Out |
| // |
| // Purpose: Check if the f_EPTF_LGenBase_getTcTypeName returns with "" for an out of range index |
| // |
| // Action: Calls function f_EPTF_LGenBase_Test_getTcTypeName |
| // |
| // Expected Result: The retrieved name should be an empty string |
| /////////////////////////////////////////////////////////// |
| testcase tc_EPTF_LGenBase_Test_getTcTypeName_Out() |
| runs on EPTF_LGenBase_CT |
| { |
| f_EPTF_LGenBase_Test_getTcTypeName(16,""); |
| } |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_EPTF_LGenBase_Test_getTcTypeName_Valid |
| // |
| // Purpose: Check if the f_EPTF_LGenBase_getTcTypeName returns with the proper name for a valid index |
| // |
| // Action: Calls function f_EPTF_LGenBase_Test_getTcTypeName |
| // |
| // Expected Result: The retrieved and the required name should be equal |
| /////////////////////////////////////////////////////////// |
| testcase tc_EPTF_LGenBase_Test_getTcTypeName_Valid() |
| runs on EPTF_LGenBase_CT |
| { |
| f_EPTF_LGenBase_Test_getTcTypeName(5,c_tcTypeNameBase&"5"); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Function: f_EPTF_LGenBase_Test_getTcTypeName |
| // |
| // Parameters: |
| // pl_i: Index of the traffic case type in v_LGenBase_trafficCaseTypes |
| // pl_requiredName: The expected traffic case type name to be returned by f_EPTF_LGenBase_getTcTypeName for index pl_i |
| // |
| // Purpose: Declares c_tcTypeCount traffic case types. Calls the f_EPTF_LGenBase_getTcTypeName |
| // function with parameter pl_i to get the pl_i -th traffic case type`s name.(in v_LGenBase_trafficCaseTypes) |
| // Checks if the retrieved name and the required name equals. |
| // |
| /////////////////////////////////////////////////////////// |
| |
| function f_EPTF_LGenBase_Test_getTcTypeName( |
| in integer pl_i, |
| in charstring pl_requiredName) |
| runs on EPTF_LGenBase_CT{ |
| f_EPTF_LGenBase_init("getTcTypeName"); |
| var integer |
| v_dummyInt := f_EPTF_LGenBase_declareBehaviorType("b1", -1, null, null, null); |
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("et1", {"b1"}); |
| f_EPTF_LGenBase_declareFSMTable({ |
| name := "dummyFSM", |
| fsmParams := { |
| {stateList := {"idle"}} |
| }, |
| table := { |
| classicTable := { |
| } |
| } |
| }) |
| for ( var integer vl_i := 0; vl_i < c_tcTypeCount ; vl_i := vl_i+1 ){
|
| v_dummyInt := f_EPTF_LGenBase_declareTrafficCaseType({ |
| c_tcTypeNameBase&int2str(vl_i), |
| "dummyFSM", |
| "et1", |
| {} |
| }) |
| }
|
| |
| var charstring vl_ret := f_EPTF_LGenBase_getTcTypeName(pl_i) |
| if(pl_requiredName == vl_ret){ |
| setverdict(pass) |
| }else{ |
| setverdict(fail,"The return value is '"&vl_ret&"' instead of the required '"&pl_requiredName&"' when the index is "&int2str(pl_i)); |
| } |
| f_EPTF_Base_cleanup_CT() |
| } |
| } |
| |
| group H036616{ |
| function f_EPTF_LGenBase_Test_rangesCount( |
| in integer pl_tcIdx, |
| in integer pl_expected) |
| runs on EPTF_LGenBase_CT{ |
| f_EPTF_LGenBase_init(%definitionId); |
| var integer |
| v_dummyInt := f_EPTF_LGenBase_declareBehaviorType("b1", -1, null, null, null); |
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("et1", {"b1"}); |
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({name := "eg0", eType := "et1", eCount := 100}) |
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable( { |
| name := %definitionId, |
| fsmParams := { |
| {stateList := {"idle"}} |
| }, |
| table := { |
| classicTable := { |
| } |
| } |
| } |
| ) |
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3( |
| { |
| name := "Scenario_A", |
| tcList := { |
| { |
| tcName := "TC_A0_Pre", |
| tcParamsList := { |
| {target := { trafficWeight := 1.0 }}, |
| {enableEntitiesAtStart := true}, |
| {enabledAtStart := false}, |
| {fsmList := {%definitionId}}, |
| {ranges := { |
| {name := "public id", enableSplit := true, baseOffset := 0, count := 3}, |
| {name := "user id", enableSplit := false, baseOffset := 0, count := 1}, |
| {name := "subscriber id", enableSplit := false, baseOffset := 0, count := 3} |
| } |
| } |
| } |
| } |
| }, |
| scParamsList := { |
| {weightedScData := {cpsToReach := 40.0, lockCPS := false, deterministicMix := true, scheduler := omit}}, |
| {enabled := false} |
| } |
| } |
| ) |
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0", "Scenario_A"}, false) |
| var integer vl_count := f_EPTF_LGenBase_getParamRangesCount(pl_tcIdx) |
| if(pl_expected != vl_count){ |
| setverdict(fail,"Returned ranges count = ",vl_count," instead of ",pl_expected) |
| } |
| f_EPTF_Base_stop(pass) |
| } |
| testcase tc_EPTF_LGenBase_Test_rangesCountValid() |
| runs on EPTF_LGenBase_CT{ |
| f_EPTF_LGenBase_Test_rangesCount(0, 3) |
| } |
| testcase tc_EPTF_LGenBase_Test_rangesCountNegative() |
| runs on EPTF_LGenBase_CT{ |
| f_EPTF_LGenBase_Test_rangesCount(-2, -1) |
| } |
| testcase tc_EPTF_LGenBase_Test_rangesCountToomuch() |
| runs on EPTF_LGenBase_CT{ |
| f_EPTF_LGenBase_Test_rangesCount(1, -1) |
| } |
| } |
| control{ |
| /* |
| execute(tc_LGenBase_Test_staticTimerSingle()); |
| execute(tc_LGenBase_Test_staticTimerParallel()); |
| execute(tc_LGenBase_Test_randomTimerSingle()); |
| execute(tc_LGenBase_Test_randomTimerParallel()); |
| execute(tc_LGenBase_Test_gaussTimerSingle()); |
| execute(tc_LGenBase_Test_gaussTimerParallel()); |
| */ |
| execute(tc_EPTF_LGenBase_Test_rnd_normal_basic()); |
| execute(tc_EPTF_LGenBase_Test_rnd_normal_multiple_gen()); |
| execute(tc_EPTF_LGenBase_Test_rnd_normal_multiple_gen_rnd_order()); |
| |
| execute(tc_LGenBase_Test_LimitedExecution_reportingFinish()) |
| execute(tc_LGenBase_Test_LimitedExecution_reportingFinish_Unlimit()); |
| execute(tc_LGenBase_Test_LimitedExecution_notReportingFinish()) |
| execute(tc_LGenBase_Test_LimitedExecution_avail()); |
| execute(tc_LGenBase_Test_LimitedExecution_reportingFinishWithPhase()) |
| execute(tc_LGenBase_Test_LimitedExecution_more()); |
| execute(tc_LGenBase_Test_LimitedExecution_less()); |
| execute(tc_LGenBase_Test_LimitedExecution_lessRestore()); |
| execute(tc_LGenBase_Test_LimitedExecution_lessRestoreWithStop()); |
| execute(tc_LGenBase_Test_LimitedExecution_lessRestoreAndStop()); |
| execute(tc_LGenBase_Test_LimitedExecution_lessRestoreWithStopAndStop()); |
| execute(tc_LGenBase_Test_LimitedExecution_setCPSAfter()); |
| |
| execute(tc_EPTF_LGenBase_Test_getTcTypeName_Zero()); |
| execute(tc_EPTF_LGenBase_Test_getTcTypeName_Valid()); |
| execute(tc_EPTF_LGenBase_Test_getTcTypeName_Min2()); |
| execute(tc_EPTF_LGenBase_Test_getTcTypeName_Out()); |
| |
| execute(tc_EPTF_LGenBase_Test_rangesCountValid()); |
| execute(tc_EPTF_LGenBase_Test_rangesCountNegative()); |
| execute(tc_EPTF_LGenBase_Test_rangesCountToomuch()); |
| } |
| |
| } // end of module |