| /////////////////////////////////////////////////////////////////////////////// |
| // // |
| // Copyright (c) 2000-2017 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_Functions |
| // |
| // Purpose: |
| // This module provides functions for testing LGenBase |
| // |
| // Module depends on: |
| // - |
| // |
| // Current Owner: |
| // Attila Jen� Balask� (ETHBAAT) |
| // |
| // Last Review Date: |
| // - |
| // |
| // Detailed Comments: |
| // Provide functions to test LGenBase |
| // |
| // |
| /////////////////////////////////////////////////////////////// |
| module EPTF_LGenBase_Test_Functions |
| { |
| |
| import from EPTF_CLL_Common_Definitions all; |
| import from EPTF_CLL_Base_Functions all; |
| import from EPTF_CLL_LGenBase_Definitions all; |
| import from EPTF_CLL_LGenBase_ConfigDefinitions all; |
| import from EPTF_CLL_LGenBase_Functions all; |
| import from EPTF_CLL_ILog_Functions all; |
| import from EPTF_CLL_LGenBase_ILog_Functions 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_ObsoleteConfigFunctions all; |
| //import from EPTF_CLL_LGenBase_ObsoleteConfigDefinitions all; |
| |
| import from EPTF_LGenBase_Test_Definitions all; |
| import from EPTF_CLL_HashMapStr2Int_Functions all; |
| import from EPTF_CLL_HashMapInt2Int_Functions all; |
| import from EPTF_CLL_HashMapOct2Int_Functions all; |
| import from EPTF_CLL_RBTScheduler_Functions all; |
| import from EPTF_CLL_Scheduler_Definitions all; |
| import from EPTF_CLL_FBQ_Definitions all; |
| import from EPTF_CLL_FBQ_Functions all; |
| import from EPTF_CLL_Variable_Definitions all; |
| import from EPTF_CLL_Variable_Functions all; |
| |
| import from EPTF_LGenBase_Test_TestcasesR3 all; |
| import from EPTF_CLL_DataSource_Functions all; |
| import from EPTF_CLL_DataSource_Definitions all; |
| import from EPTF_CLL_LGenBase_TemplateDefinitions all; |
| import from TCCConversion_Functions all; |
| |
| |
| //=====get-set functions for LGenBase================================================= |
| group GetSetFunctionsForLGenBase { |
| |
| //================================================== |
| // f_EPTF_LGenBase_Test_getTestStepFunction |
| //================================================== |
| /* |
| function f_EPTF_LGenBase_Test_getTestStepFunction(in integer pl_bIdx, in integer pl_testStepIdx) |
| runs on EPTF_LGenBase_Test_CT |
| return EPTF_LGenBase_TestStepFunction_FT |
| { |
| var EPTF_LGenBase_TestStepFunction_FT vl_descriptor; |
| vl_descriptor := v_LGenBase_functions[v_LGenBase_testSteps[pl_bIdx][pl_testStepIdx]].testStepFunction; |
| return vl_descriptor; |
| } |
| */ |
| //================================================== |
| // f_EPTF_LGenBase_Test_getTestStepFromName |
| //================================================== |
| /* |
| function f_EPTF_LGenBase_Test_getTestStepFromName(in charstring pl_testStepName, inout EPTF_LGenBase_TestStepFunction_FT pl_tD) |
| runs on EPTF_LGenBase_Test_CT |
| return boolean |
| { |
| var integer vl_functionIdx; |
| vl_functionIdx := f_EPTF_LGenBase_functionNameIndex(pl_testStepName); |
| log("v_LGenBase_functions:",v_LGenBase_functions[vl_functionIdx]); |
| if(ischosen(v_LGenBase_functions[vl_functionIdx].testStepFunction)){ |
| pl_tD := v_LGenBase_functions[vl_functionIdx].testStepFunction; |
| return true; |
| } else { |
| return false; |
| } |
| } |
| */ |
| //================================================== |
| // f_EPTF_LGenBase_Test_getFsmEventName |
| //================================================== |
| /* |
| function f_EPTF_LGenBase_Test_getFsmEventName(in integer pl_bIdx, in integer pl_inputIdx) |
| runs on EPTF_LGenBase_Test_CT |
| return charstring |
| { |
| return v_LGenBase_fsmEvents[pl_bIdx][pl_inputIdx].name; |
| } |
| */ |
| /*These functions doen't have any reason because of the changes in the event handling |
| //================================================== |
| // f_EPTF_LGenBase_Test_getEntityListenerHashMapRef |
| //================================================== |
| function f_EPTF_LGenBase_Test_getEntityListenerHashMapRef(in integer pl_bIdx, in integer pl_inputIdx) |
| runs on EPTF_LGenBase_Test_CT |
| return integer |
| { |
| return v_LGenBase_genericEventListeners[pl_bIdx][pl_inputIdx].entityListenerHashMapRef; |
| } |
| |
| //================================================== |
| // f_EPTF_LGenBase_Test_getEntityListenerHashMapRefFromNames |
| //================================================== |
| function f_EPTF_LGenBase_Test_getEntityListenerHashMapRefFromNames(in charstring pl_bName, in charstring pl_inputName) |
| runs on EPTF_LGenBase_Test_CT |
| return integer |
| { |
| var integer vl_bIdx, vl_inputIdx; |
| |
| if( |
| f_EPTF_str2int_HashMap_Find( |
| v_LGenBase_fsmEventsBehaviorHashMap, |
| pl_bName&tsp_LGenBase_nameSeparator&pl_inputName, |
| vl_bIdx) and |
| f_EPTF_str2int_HashMap_Find( |
| v_LGenBase_fsmEventsInputHashMap, |
| tsp_EPTF_LGenBase_Test_behaviorTypeName&tsp_LGenBase_nameSeparator&pl_inputName, |
| vl_inputIdx)) |
| { |
| return f_EPTF_LGenBase_Test_getEntityListenerHashMapRef(vl_bIdx,vl_inputIdx) |
| } |
| else |
| { |
| return -1; |
| } |
| }//f |
| */ |
| //================================================== |
| // f_EPTF_LGenBase_Test_getGenericEventListeners |
| //================================================== |
| /* |
| function f_EPTF_LGenBase_Test_getGenericEventListeners( |
| in integer pl_bIdx, |
| in integer pl_inputIdx) |
| runs on EPTF_LGenBase_Test_CT |
| return EPTF_LGenBase_EventListenerStorageList |
| { |
| var EPTF_LGenBase_EventListenerStorageList vl_ret := {}; |
| var integer vl_idx := -1; |
| var boolean vl_isListener := f_EPTF_FBQ_getBusyHeadIdx(vl_idx, v_LGenBase_genericEventListeners[pl_bIdx][pl_inputIdx]) |
| while ( vl_isListener ) |
| { |
| var integer vl_listenerIdx := f_EPTF_FBQ_getQueueData(vl_idx, v_LGenBase_genericEventListeners[pl_bIdx][pl_inputIdx], 0); |
| vl_ret[sizeof(vl_ret)] := v_LGenBase_listeners[vl_listenerIdx]; |
| vl_isListener := f_EPTF_FBQ_getFwdBusyItemIdx(vl_idx, v_LGenBase_genericEventListeners[pl_bIdx][pl_inputIdx]) |
| } |
| return vl_ret; |
| } |
| */ |
| /* |
| //================================================== |
| // f_EPTF_LGenBase_Test_getEntityListenerIdx, see f_EPTF_LGenBase_reportEvent4Entity |
| //================================================== |
| function f_EPTF_LGenBase_Test_getEntityListenerIdx( |
| in integer pl_bIdx, |
| in integer pl_inputIdx, |
| in integer pl_entityIdx, |
| inout integer pl_listenerIdx) |
| runs on EPTF_LGenBase_Test_CT |
| return boolean |
| { |
| return f_EPTF_int2int_HashMap_Find( |
| v_LGenBase_genericEventListeners[pl_bIdx][pl_inputIdx].entityListenerHashMapRef, |
| pl_entityIdx, |
| pl_listenerIdx) |
| } |
| */ |
| |
| //================================================== |
| // f_EPTF_LGenBase_Test_getCompactFsmTable |
| // see f_EPTF_LGenBase_declareCompactFsmTable |
| //================================================== |
| /* |
| function f_EPTF_LGenBase_Test_getCompactFsmTable(in integer pl_tIdx) |
| runs on EPTF_LGenBase_Test_CT |
| return EPTF_LGenBase_InternalFsmTable |
| { |
| return v_LGenBase_fsmTables[pl_tIdx]; |
| } |
| */ |
| //================================================== |
| // f_EPTF_LGenBase_Test_getEntityType |
| //================================================== |
| /* |
| function f_EPTF_LGenBase_Test_getEntityType(in integer pl_entityTypeIdx) |
| runs on EPTF_LGenBase_Test_CT |
| return EPTF_LGenBase_EntityType |
| { |
| return v_LGenBase_entityTypes[pl_entityTypeIdx]; |
| } |
| */ |
| //================================================== |
| // f_EPTF_LGenBase_Test_getEntityGroup |
| //================================================== |
| /* |
| function f_EPTF_LGenBase_Test_getEntityGroup(in charstring pl_eGroupName, inout EPTF_LGenBase_EntityGroup pl_EG) runs on EPTF_LGenBase_Test_CT |
| return boolean |
| { |
| var integer vl_grpIdx := f_EPTF_LGenBase_entityGrpNameIndex(pl_eGroupName); |
| if( vl_grpIdx>=0) { |
| pl_EG:=v_LGenBase_entityGroups[vl_grpIdx]; |
| return true; |
| } else { |
| return false; |
| } |
| } |
| */ |
| } |
| |
| //============Public Functions for TestCase Writers=================================== |
| |
| //================================================== |
| // f_EPTF_LGenBase_Test_SetverdictFromBool |
| //================================================== |
| function f_EPTF_LGenBase_Test_setVerdictFromBool(in boolean pl_result) runs on EPTF_LGenBase_Test_CT |
| { |
| if(pl_result==true) { |
| setverdict(pass) |
| } else { |
| setverdict(fail) |
| } |
| } |
| //================================================== |
| // f_EPTF_LGenBase_Test_getVerdictFromBool |
| //================================================== |
| function f_EPTF_LGenBase_Test_getVerdictFromBool(in boolean pl_result) runs on EPTF_LGenBase_Test_CT return verdicttype |
| { |
| if(pl_result==true) { |
| return pass; |
| } else { |
| return fail; |
| } |
| } |
| //********* Dummy Function Calls for tracing ************* |
| |
| //================================================== |
| // f_EPTF_LGenBase_Test_step_Dummy1 |
| //================================================== |
| function f_EPTF_LGenBase_Test_step_Dummy1(in EPTF_LGenBase_TestStepArgs pl_ptr) runs on EPTF_LGenBase_Test_CT |
| { |
| if(tsp_EPTF_LGenBaseTestDebug) { log("f_EPTF_LGenBase_Test_step_Dummy1 called");} |
| v_LGenBase_Test_DummyTestStep1Called:=true; |
| |
| } |
| //================================================== |
| // f_EPTF_LGenBase_Test_step_Dummy2 |
| //================================================== |
| function f_EPTF_LGenBase_Test_step_Dummy2(in EPTF_LGenBase_TestStepArgs pl_ptr) runs on EPTF_LGenBase_Test_CT |
| { |
| if(tsp_EPTF_LGenBaseTestDebug) { log("f_EPTF_LGenBase_Test_step_Dummy2 called");} |
| v_LGenBase_Test_DummyTestStep2Called:=true; |
| } |
| //================================================== |
| // f_EPTF_LGenBase_Test_step_Dummy3 |
| //================================================== |
| function f_EPTF_LGenBase_Test_step_Dummy3(in EPTF_LGenBase_TestStepArgs pl_ptr) runs on EPTF_LGenBase_Test_CT |
| { |
| if(tsp_EPTF_LGenBaseTestDebug) { log("f_EPTF_LGenBase_Test_step_Dummy3 called");} |
| v_LGenBase_Test_DummyTestStep3Called:=true; |
| } |
| //================================================== |
| // f_EPTF_LGenBase_Test_step_reportTrafficCaseStarted |
| //================================================== |
| function f_EPTF_LGenBase_Test_step_reportTrafficCaseStarted(in EPTF_LGenBase_TestStepArgs pl_ptr) runs on EPTF_LGenBase_Test_CT |
| { |
| if(tsp_EPTF_LGenBaseTestDebug) { log("f_EPTF_LGenBase_Test_step_reportTrafficCaseStarted called");} |
| v_LGenBase_Test_trafficCaseStarted:=true; |
| } |
| //================================================== |
| // f_EPTF_LGenBase_Test_step_incrementTrafficCaseStartedCounter |
| //================================================== |
| function f_EPTF_LGenBase_Test_step_incrementTrafficCaseCounter(in EPTF_LGenBase_TestStepArgs pl_ptr) runs on EPTF_LGenBase_Test_CT |
| { |
| if(tsp_EPTF_LGenBaseTestDebug) { log("f_EPTF_LGenBase_Test_step_reportTrafficCaseStarted called");} |
| v_LGenBase_Test_trafficCaseStartedCounter := v_LGenBase_Test_trafficCaseStartedCounter+1; |
| if( tsp_EPTF_LGenBaseTestDebug and(v_LGenBase_Test_trafficCaseStartedCounter mod 1000 == 0)) { |
| log("===>DEBUG: trafficCaseStartedCounter :", v_LGenBase_Test_trafficCaseStartedCounter); |
| } |
| //f_EPTF_LGenBase_Test_logTrafficCaseStats(pl_ptr); |
| } |
| //================================================== |
| // f_EPTF_LGenBase_Test_step_reportTrafficCaseStopped |
| //================================================== |
| function f_EPTF_LGenBase_Test_step_reportTrafficCaseStopped(in EPTF_LGenBase_TestStepArgs pl_ptr) runs on EPTF_LGenBase_Test_CT |
| { |
| if(tsp_EPTF_LGenBaseTestDebug) { log("f_EPTF_LGenBase_Test_step_reportTrafficCaseStopped called");} |
| v_LGenBase_Test_trafficCaseStopped:=true; |
| //f_EPTF_LGenBase_Test_logTrafficCaseStats(pl_ptr); |
| } |
| //================================================== |
| // f_EPTF_LGenBase_Test_step_reportTrafficCaseMixedRet |
| //================================================== |
| function f_EPTF_LGenBase_Test_step_reportTrafficCaseMixedRet(in EPTF_LGenBase_TestStepArgs pl_ptr) runs on EPTF_LGenBase_Test_CT |
| { |
| if(tsp_EPTF_LGenBaseTestDebug) { log(%definitionId," called. EIdx: ",pl_ptr.eIdx);} |
| if(0 == pl_ptr.eIdx mod 2){ |
| f_EPTF_LGenBase_step_trafficSuccess(pl_ptr); |
| }else{ |
| f_EPTF_LGenBase_step_trafficFailed(pl_ptr) |
| } |
| } |
| //================================================== |
| // f_EPTF_LGenBase_Test_step_reportTrafficCaseAborted |
| //================================================== |
| function f_EPTF_LGenBase_Test_step_reportTrafficCaseAborted(in EPTF_LGenBase_TestStepArgs pl_ptr) runs on EPTF_LGenBase_Test_CT |
| { |
| if(tsp_EPTF_LGenBaseTestDebug) { log(%definitionId," called");} |
| v_LGenBase_Test_trafficCaseAborted:=true; |
| //f_EPTF_LGenBase_Test_logTrafficCaseStats(pl_ptr) |
| |
| } |
| |
| //================================================== |
| // f_EPTF_LGenBase_Test_step_reportEntityStopped |
| //================================================== |
| function f_EPTF_LGenBase_Test_step_reportEntityStopped(in EPTF_LGenBase_TestStepArgs pl_ptr) runs on EPTF_LGenBase_Test_CT |
| { |
| log("f_EPTF_LGenBase_Test_step_reportEntityStopped called"); |
| v_LGenBase_Test_entityStopped:=true; |
| //f_EPTF_LGenBase_Test_logTrafficCaseStats(pl_ptr); |
| } |
| |
| //================================================== |
| // f_EPTF_LGenBase_Test_step_reportEntityAborted |
| //================================================== |
| function f_EPTF_LGenBase_Test_step_reportEntityAborted(in EPTF_LGenBase_TestStepArgs pl_ptr) runs on EPTF_LGenBase_Test_CT |
| { |
| log("f_EPTF_LGenBase_Test_step_reportEntityAborted called"); |
| v_LGenBase_Test_entityAborted:=true; |
| //f_EPTF_LGenBase_Test_logTrafficCaseStats(pl_ptr); |
| } |
| |
| //================================================== |
| // f_EPTF_LGenBase_Test_DummyGenericEventListener |
| //================================================== |
| function f_EPTF_LGenBase_Test_DummyGenericEventListener( |
| in EPTF_LGenBase_ReportedEventDescriptor pl_event, |
| in EPTF_IntegerList pl_listenerArgs) |
| runs on EPTF_LGenBase_Test_CT |
| { |
| log("f_EPTF_LGenBase_Test_DummyGenericEventListener called"); |
| v_LGenBase_Test_genericEventListenerFunctionCalled:= true; |
| } |
| //================================================== |
| // f_EPTF_LGenBase_Test_DummyGenericEventListener2 |
| //================================================== |
| function f_EPTF_LGenBase_Test_DummyGenericEventListener2( |
| in EPTF_LGenBase_ReportedEventDescriptor pl_event, |
| in EPTF_IntegerList pl_listenerArgs) |
| runs on EPTF_LGenBase_Test_CT |
| { |
| log("f_EPTF_LGenBase_Test_DummyGenericEventListener2 called"); |
| v_LGenBase_Test_genericEventListenerFunction2Called:= true; |
| } |
| //================================================== |
| // f_EPTF_LGenBase_Test_DummyEntityEventListener |
| //================================================== |
| function f_EPTF_LGenBase_Test_DummyEntityEventListener( |
| in EPTF_LGenBase_ReportedEventDescriptor pl_event, |
| in EPTF_IntegerList pl_listenerArgs) |
| runs on EPTF_LGenBase_Test_CT |
| { |
| log("f_EPTF_LGenBase_Test_DummyEntityEventListener called"); |
| v_LGenBase_Test_entityEventListenerFunctionCalled:= true; |
| } |
| |
| //================================================== |
| // f_EPTF_LGenBase_Test_DummyEntityEventListener |
| //================================================== |
| function f_EPTF_LGenBase_Test_DummyEntityEventListener2( |
| in EPTF_LGenBase_ReportedEventDescriptor pl_event, |
| in EPTF_IntegerList pl_listenerArgs) |
| runs on EPTF_LGenBase_Test_CT |
| { |
| log("f_EPTF_LGenBase_Test_DummyEntityEventListener called"); |
| v_LGenBase_Test_entityEventListenerFunction2Called:= true; |
| } |
| //********* IS functions *************** |
| |
| //================================================== |
| // f_EPTF_LGenBase_Test_isDummyTestStep1Called |
| //================================================== |
| function f_EPTF_LGenBase_Test_isDummyTestStep1Called() |
| runs on EPTF_LGenBase_Test_CT |
| return boolean |
| { |
| return v_LGenBase_Test_DummyTestStep1Called; |
| } |
| //================================================== |
| // f_EPTF_LGenBase_Test_isDummyTestStep2Called |
| //================================================== |
| function f_EPTF_LGenBase_Test_isDummyTestStep2Called() |
| runs on EPTF_LGenBase_Test_CT |
| return boolean |
| { |
| return v_LGenBase_Test_DummyTestStep2Called; |
| } |
| //================================================== |
| // f_EPTF_LGenBase_Test_isDummyTestStep3Called |
| //================================================== |
| function f_EPTF_LGenBase_Test_isDummyTestStep3Called() |
| runs on EPTF_LGenBase_Test_CT |
| return boolean |
| { |
| return v_LGenBase_Test_DummyTestStep3Called; |
| } |
| //================================================== |
| // f_EPTF_LGenBase_Test_isTrafficCaseStarted |
| //================================================== |
| function f_EPTF_LGenBase_Test_isTrafficCaseStarted() |
| runs on EPTF_LGenBase_Test_CT |
| return boolean |
| { |
| return v_LGenBase_Test_trafficCaseStarted; |
| } |
| |
| //================================================== |
| // f_EPTF_LGenBase_Test_isTrafficCaseStopped |
| //================================================== |
| function f_EPTF_LGenBase_Test_isTrafficCaseStopped() |
| runs on EPTF_LGenBase_Test_CT |
| return boolean |
| { |
| return v_LGenBase_Test_trafficCaseStopped; |
| } |
| //================================================== |
| // f_EPTF_LGenBase_Test_isTrafficCaseAborted |
| //================================================== |
| function f_EPTF_LGenBase_Test_isTrafficCaseAborted() |
| runs on EPTF_LGenBase_Test_CT |
| return boolean |
| { |
| return v_LGenBase_Test_trafficCaseAborted; |
| } |
| |
| //================================================== |
| // f_EPTF_LGenBase_Test_isEntityStopped |
| //================================================== |
| function f_EPTF_LGenBase_Test_isEntityStopped() |
| runs on EPTF_LGenBase_Test_CT |
| return boolean |
| { |
| return v_LGenBase_Test_entityStopped; |
| }//================================================== |
| // f_EPTF_LGenBase_Test_isEntityAborted |
| //================================================== |
| function f_EPTF_LGenBase_Test_isEntityAborted() |
| runs on EPTF_LGenBase_Test_CT |
| return boolean |
| { |
| return v_LGenBase_Test_entityAborted; |
| } |
| //================================================== |
| // f_EPTF_LGenBase_Test_isDummyGenericEventListenerCalled |
| //================================================== |
| function f_EPTF_LGenBase_Test_isDummyGenericEventListenerCalled() |
| runs on EPTF_LGenBase_Test_CT |
| return boolean |
| { |
| return v_LGenBase_Test_genericEventListenerFunctionCalled; |
| } |
| //================================================== |
| // f_EPTF_LGenBase_Test_isDummyGenericEventListener2Called |
| //================================================== |
| function f_EPTF_LGenBase_Test_isDummyGenericEventListener2Called() |
| runs on EPTF_LGenBase_Test_CT |
| return boolean |
| { |
| return v_LGenBase_Test_genericEventListenerFunction2Called; |
| } |
| //================================================== |
| // f_EPTF_LGenBase_Test_isDummyEntityEventListenerCalled |
| //================================================== |
| function f_EPTF_LGenBase_Test_isDummyEntityEventListenerCalled() |
| runs on EPTF_LGenBase_Test_CT |
| return boolean |
| { |
| return v_LGenBase_Test_entityEventListenerFunctionCalled; |
| } |
| //================================================== |
| // f_EPTF_LGenBase_Test_isDummyEntityEventListener2Called |
| //================================================== |
| function f_EPTF_LGenBase_Test_isDummyEntityEventListener2Called() |
| runs on EPTF_LGenBase_Test_CT |
| return boolean |
| { |
| return v_LGenBase_Test_entityEventListenerFunction2Called; |
| } |
| |
| //************* Reset Functions ******************* |
| |
| |
| //================================================== |
| // f_EPTF_LGenBase_Test_resetDummyTestStep1Called |
| //================================================== |
| function f_EPTF_LGenBase_Test_resetDummyTestStep1Called() |
| runs on EPTF_LGenBase_Test_CT |
| { |
| v_LGenBase_Test_DummyTestStep1Called:=false; |
| } |
| |
| //================================================== |
| // f_EPTF_LGenBase_Test_resetDummyTestStep2Called |
| //================================================== |
| function f_EPTF_LGenBase_Test_resetDummyTestStep2Called() |
| runs on EPTF_LGenBase_Test_CT |
| { |
| v_LGenBase_Test_DummyTestStep2Called:=false; |
| } |
| //================================================== |
| // f_EPTF_LGenBase_Test_resetDummyTestStep3Called |
| //================================================== |
| function f_EPTF_LGenBase_Test_resetDummyTestStep3Called() |
| runs on EPTF_LGenBase_Test_CT |
| { |
| v_LGenBase_Test_DummyTestStep3Called:=false; |
| } |
| //================================================== |
| // f_EPTF_LGenBase_Test_resetAllDummyTestStepsCalled |
| //================================================== |
| function f_EPTF_LGenBase_Test_resetAllDummyTestStepAndListenerFlag() |
| runs on EPTF_LGenBase_Test_CT |
| { |
| v_LGenBase_Test_DummyTestStep1Called:=false; |
| v_LGenBase_Test_DummyTestStep2Called:=false; |
| v_LGenBase_Test_DummyTestStep3Called:=false; |
| v_LGenBase_Test_genericEventListenerFunctionCalled := false; |
| v_LGenBase_Test_genericEventListenerFunction2Called := false; |
| v_LGenBase_Test_entityEventListenerFunctionCalled := false; |
| v_LGenBase_Test_entityEventListenerFunction2Called := false; |
| v_LGenBase_Test_entityStopped:= false; |
| v_LGenBase_Test_entityAborted:=false; |
| } |
| |
| //================================================== |
| // f_EPTF_LGenBase_Test_resetTrafficCaseStarted |
| //================================================== |
| function f_EPTF_LGenBase_Test_resetTrafficCaseStarted() |
| runs on EPTF_LGenBase_Test_CT |
| { |
| v_LGenBase_Test_trafficCaseStarted:=false; |
| } |
| //================================================== |
| // f_EPTF_LGenBase_Test_resetTrafficCaseStopped |
| //================================================== |
| function f_EPTF_LGenBase_Test_resetTrafficCaseStopped() |
| runs on EPTF_LGenBase_Test_CT |
| { |
| v_LGenBase_Test_trafficCaseStopped:=false; |
| } |
| //================================================== |
| // f_EPTF_LGenBase_Test_resetTrafficCaseAborted |
| //================================================== |
| function f_EPTF_LGenBase_Test_resetTrafficCaseAborted() |
| runs on EPTF_LGenBase_Test_CT |
| { |
| v_LGenBase_Test_trafficCaseAborted:=false; |
| } |
| //================================================== |
| // f_EPTF_LGenBase_Test_resetDummyGenericEventListenerCalled |
| //================================================== |
| function f_EPTF_LGenBase_Test_resetDummyGenericEventListenerCalled() |
| runs on EPTF_LGenBase_Test_CT |
| { |
| v_LGenBase_Test_genericEventListenerFunctionCalled := false; |
| } |
| //================================================== |
| // f_EPTF_LGenBase_Test_resetDummyGenericEventListener2Called |
| //================================================== |
| function f_EPTF_LGenBase_Test_resetDummyGenericEventListener2Called() |
| runs on EPTF_LGenBase_Test_CT |
| { |
| v_LGenBase_Test_genericEventListenerFunction2Called := false; |
| } |
| //================================================== |
| // f_EPTF_LGenBase_Test_resetDummyEntityEventListenerCalled |
| //================================================== |
| function f_EPTF_LGenBase_Test_resetDummyEntityEventListenerCalled() |
| runs on EPTF_LGenBase_Test_CT |
| { |
| v_LGenBase_Test_entityEventListenerFunctionCalled := false; |
| } |
| |
| //================================================== |
| // f_EPTF_LGenBase_Test_resetDummyEntityEventListener2Called |
| //================================================== |
| function f_EPTF_LGenBase_Test_resetDummyEntityEventListener2Called() |
| runs on EPTF_LGenBase_Test_CT |
| { |
| v_LGenBase_Test_entityEventListenerFunction2Called := false; |
| } |
| |
| // Type of EPTF_LGenBase_RegisteredFunctions/EPTF_LGenBase_customFinishCondition_FT |
| |
| //================================================== |
| // f_EPTF_LGenBase_Test_groupFinishCondition |
| //================================================== |
| function f_EPTF_LGenBase_Test_groupFinishCondition( |
| in integer pl_tcIdx, |
| in integer pl_eIdx |
| ) |
| runs on EPTF_LGenBase_Test_CT |
| return boolean |
| { |
| v_LGenBase_Test_groupFinishConditionFunctionCalled := true; |
| return true |
| } |
| |
| //================================================== |
| // f_EPTF_LGenBase_Test_resetGroupFinishCondition |
| //================================================== |
| function f_EPTF_LGenBase_Test_resetGroupFinishCondition( |
| in integer pl_tcIdx, |
| in integer pl_eIdx |
| ) |
| runs on EPTF_LGenBase_Test_CT |
| { |
| v_LGenBase_Test_groupFinishConditionFunctionCalled := false; |
| } |
| |
| //================================================== |
| // f_EPTF_LGenBase_Test_isGroupFinishConditionCalled |
| //================================================== |
| function f_EPTF_LGenBase_Test_isGroupFinishConditionCalled( |
| in integer pl_tcIdx, |
| in integer pl_eIdx |
| ) |
| runs on EPTF_LGenBase_Test_CT |
| return boolean |
| { |
| return v_LGenBase_Test_groupFinishConditionFunctionCalled; |
| } |
| |
| //================================================== |
| // f_EPTF_LGenBase_Test_entityFinishCondition |
| //================================================== |
| function f_EPTF_LGenBase_Test_entityFinishCondition( |
| in integer pl_tcIdx, |
| in integer pl_eIdx |
| ) |
| runs on EPTF_LGenBase_Test_CT |
| return boolean |
| { |
| v_LGenBase_Test_entityFinishConditionFunctionCalled := true; |
| return true |
| } |
| |
| //================================================== |
| // f_EPTF_LGenBase_Test_resetentityFinishCondition |
| //================================================== |
| function f_EPTF_LGenBase_Test_resetEntityFinishCondition( |
| in integer pl_tcIdx, |
| in integer pl_eIdx |
| ) |
| runs on EPTF_LGenBase_Test_CT |
| { |
| v_LGenBase_Test_entityFinishConditionFunctionCalled := false; |
| } |
| |
| //================================================== |
| // f_EPTF_LGenBase_Test_isEntityFinishConditionCalled |
| //================================================== |
| function f_EPTF_LGenBase_Test_isEntityFinishConditionCalled( |
| in integer pl_tcIdx, |
| in integer pl_eIdx |
| ) |
| runs on EPTF_LGenBase_Test_CT |
| return boolean |
| { |
| return v_LGenBase_Test_entityFinishConditionFunctionCalled; |
| } |
| |
| /* |
| //================================================== |
| // f_EPTF_LGenBase_Test_logTrafficCaseStats |
| //================================================== |
| function f_EPTF_LGenBase_Test_logTrafficCaseStats(in EPTF_LGenBase_TestStepArgs pl_ptr) |
| runs on EPTF_LGenBase_Test_CT |
| { |
| var integer vl_tcIdx:=f_EPTF_LGenBase_tcIdxOfStep(pl_ptr) |
| if(tsp_EPTF_LGenBaseTestDebug) { |
| log( //"==>ptr:", pl_ptr, |
| "\nTC name: ", v_LGenBase_trafficCases[vl_tcIdx].uniqueName, |
| "\nstartDelay:", v_LGenBase_trafficCases[vl_tcIdx].startDelay, |
| //"\nstartTime: ", v_LGenBase_trafficCases[vl_tcIdx].startTime, |
| "\nlastCPS: ",f_EPTF_LGenBase_getCPS(vl_tcIdx), |
| "\nnrOfStarts: ",v_LGenBase_trafficCases[vl_tcIdx].nrOfStarts, |
| "\nnrOfSuccesses :",v_LGenBase_trafficCases[vl_tcIdx].nrOfSuccesses, |
| "\nnrOfFails :", v_LGenBase_trafficCases[vl_tcIdx].nrOfFails, |
| "\nnrOfAllEntities : ",v_LGenBase_trafficCases[vl_tcIdx].nrOfAllEntities, |
| "\nnrOfAvailableEntities :",v_LGenBase_trafficCases[vl_tcIdx].nrOfAvailableEntities, |
| "\nnrOfNotFinishedEntities : ",v_LGenBase_trafficCases[vl_tcIdx].nrOfNotFinishedEntities, |
| "\nnrOfRunningEntities : ",v_LGenBase_trafficCases[vl_tcIdx].nrOfRunningEntities, |
| "\nschedulingTimer : ", v_LGenBase_trafficCases[vl_tcIdx].schedulingTimer//, |
| //"\nentityInfo:",v_LGenBase_trafficCases[vl_tcIdx].entityInfo |
| ); |
| } |
| } |
| */ |
| //================================================== |
| // f_EPTF_LGenBase_Test_init |
| //================================================== |
| function f_EPTF_LGenBase_Test_init(in charstring pl_bName, in EPTF_LGenBase_burstFunc pl_burstFunc) runs on EPTF_LGenBase_Test_CT { |
| f_EPTF_LGenBase_init( |
| pl_selfName:= tsp_LGenBase_Test_name, |
| pl_numEntities:=tsp_numEntities, |
| pl_entityNamePrefix:=tsp_LGenBase_Test_name&"_", |
| pl_EPTF_LGenBase_burstFunc:= pl_burstFunc); |
| |
| if(tsp_EPTF_LGenBaseTestDebug) { log("=============== Part 'Declare Behaviour Type' starts ============");} |
| v_myBCtxIdx:=f_EPTF_LGenBase_declareBehaviorType( |
| pl_name:= pl_bName, |
| pl_maxCount:= 9, |
| pl_resetFn := refers(f_EPTF_LGenBase_Test_contextReset), |
| pl_bindFn := refers(f_EPTF_LGenBase_Test_contextBind), |
| pl_unbindFn:= refers(f_EPTF_LGenBase_Test_contextUnbind)); |
| } |
| |
| //================================================== |
| // f_EPTF_LGenBase_Test_checkSelfName |
| //================================================== |
| function f_EPTF_LGenBase_Test_checkSelfName(in charstring pl_name) runs on EPTF_LGenBase_Test_CT return boolean{ |
| if(tsp_EPTF_LGenBaseTestDebug) { log("pl_name:",pl_name);} |
| if(tsp_EPTF_LGenBaseTestDebug) { log("f_EPTF_Base_selfName()",f_EPTF_Base_selfName());} |
| return(pl_name == f_EPTF_Base_selfName()); |
| } |
| //================================================== |
| // f_EPTF_LGenBase_Test_checkNumOfEntities |
| //================================================== |
| //================================================== |
| // f_EPTF_LGenBase_Test_checkNamePrefixes |
| //================================================== |
| //================================================== |
| // f_EPTF_LGenBase_Test_checkBurstCalcMode |
| //================================================== |
| //partial check: name checked, method not |
| /*function f_EPTF_LGenBase_Test_checkBurstCalcMode(in EPTF_LGenBase_burstFunc pl_func) |
| runs on EPTF_LGenBase_Test_CT return boolean{ |
| return( v_LGenBase_burstCalcMode == f_EPTF_LGenBase_BurstFuncName2Char(pl_func)) |
| }*/ |
| |
| //================================================== |
| // f_EPTF_LGenBase_Test_checkStr2IntHashMap |
| //================================================== |
| //check name and ID only, not key-values |
| function f_EPTF_LGenBase_Test_checkStr2IntHashMap(in charstring pl_name, in integer pl_id) |
| runs on EPTF_LGenBase_Test_CT |
| return boolean |
| { |
| var integer vl_id := -1; |
| return( f_EPTF_str2int_HashMap_GetID(pl_name, vl_id) and (vl_id ==pl_id) ) |
| } |
| |
| //================================================== |
| // f_EPTF_LGenBase_checkInt2IntHashMap |
| //================================================== |
| //check name and ID only, not key-values |
| function f_EPTF_LGenBase_checkInt2IntHashMap(in charstring pl_name, in integer pl_id) |
| runs on EPTF_LGenBase_Test_CT |
| return boolean |
| { |
| var integer vl_id := -1; |
| return( f_EPTF_int2int_HashMap_GetID(pl_name, vl_id) and (vl_id ==pl_id) ) |
| } |
| //================================================== |
| // f_EPTF_LGenBase_Test_checkHashMapTableCreations |
| //================================================== |
| //checks if all hash map tables have been created. Returns true if yes otherwise with false |
| /* |
| function f_EPTF_LGenBase_Test_checkHashMapTableCreations() runs on EPTF_LGenBase_Test_CT return boolean{ |
| var boolean vl_result:=true; |
| if( not f_EPTF_LGenBase_Test_checkStr2IntHashMap( c_EPTF_LGenBase_behaviorHashMap,v_LGenBase_behaviorHashMap)) |
| { |
| vl_result:=false; |
| } |
| if( not f_EPTF_LGenBase_Test_checkStr2IntHashMap( |
| c_EPTF_LGenBase_eventBehaviorHashmap,v_LGenBase_fsmEventsBehaviorHashMap)) |
| { |
| vl_result:=false |
| } |
| |
| if( not f_EPTF_LGenBase_Test_checkStr2IntHashMap( |
| c_EPTF_LGenBase_eventInputHashmap, v_LGenBase_fsmEventsInputHashMap)) |
| { |
| vl_result:=false |
| } |
| if( not f_EPTF_LGenBase_Test_checkStr2IntHashMap( |
| c_EPTF_LGenBase_functionHashmap, v_LGenBase_functionHashMap )) |
| { |
| vl_result:=false |
| } |
| log( "Result of checking Hash Map Tables:",vl_result); |
| return vl_result; |
| } |
| */ |
| //================================================== |
| //f_EPTF_LGenBase_Test_checkAllHashMapTablesRemoved |
| //================================================== |
| function f_EPTF_LGenBase_Test_checkAllHashMapTablesRemoved() runs on EPTF_LGenBase_Test_CT return boolean{ |
| var integer vl_id:=-1; |
| var boolean vl_result := true; |
| |
| if( f_EPTF_str2int_HashMap_GetID(c_EPTF_LGenBase_behaviorHashMap,vl_id)) { |
| log("Hash Map with id c_EPTF_LGenBase_behaviorHashMap shouldn't be exist after cleanup"); |
| vl_result := false; |
| } else { |
| if(tsp_EPTF_LGenBaseTestDebug) { log("It is accepted.");} |
| } |
| |
| if( f_EPTF_str2int_HashMap_GetID(c_EPTF_LGenBase_eventBehaviorHashmap,vl_id)) { |
| log("Hash Map with id c_EPTF_LGenBase_eventBehaviorHashmap shouldn't be exist after cleanup"); |
| vl_result := false; |
| }else { |
| if(tsp_EPTF_LGenBaseTestDebug) { log("It is accepted.");} |
| } |
| |
| if( f_EPTF_str2int_HashMap_GetID( c_EPTF_LGenBase_eventInputHashmap,vl_id)) { |
| log("Hash Map with id c_EPTF_LGenBase_eventInputHashmap shouldn't be exist after cleanup"); |
| vl_result := false; |
| }else { |
| if(tsp_EPTF_LGenBaseTestDebug) { log("It is accepted.");} |
| } |
| |
| if( f_EPTF_str2int_HashMap_GetID( c_EPTF_LGenBase_functionHashmap,vl_id)) { |
| log("Hash Map with id c_EPTF_LGenBase_functionHashmap shouldn't be exist after cleanup"); |
| vl_result := false; |
| }else { |
| if(tsp_EPTF_LGenBaseTestDebug) { log("It is accepted.");} |
| } |
| return vl_result; |
| } |
| |
| group BehaviorContext { |
| //**************************************************** |
| // v_behaviorContexts Simulation |
| // v_behaviorContexts[pl_eIdx]: |
| // -1 : uninit or removed (not binded or unbinded) |
| // 0: binded or reset but doesn't contain real data |
| // >0: real data |
| //**************************************************** |
| |
| //================================================== |
| //f_EPTF_LGenBase_Test_contextBind |
| //================================================== |
| function f_EPTF_LGenBase_Test_contextBind(in integer pl_eIdx) |
| runs on EPTF_LGenBase_Test_CT |
| return EPTF_IntegerList |
| { |
| v_behaviorContexts[pl_eIdx]:= 0; //simulates init, database item. it can be right value from know. |
| return { pl_eIdx } |
| } |
| //================================================== |
| //f_EPTF_LGenBase_Test_contextReset |
| //================================================== |
| function f_EPTF_LGenBase_Test_contextReset(in integer pl_eIdx) |
| runs on EPTF_LGenBase_Test_CT |
| { |
| v_behaviorContexts[pl_eIdx]:= 0; |
| } |
| //================================================== |
| //f_EPTF_LGenBase_Test_contextUnbind |
| //================================================== |
| function f_EPTF_LGenBase_Test_contextUnbind(in integer pl_eIdx) runs on EPTF_LGenBase_Test_CT |
| { |
| v_behaviorContexts[pl_eIdx] := -1;//or even remove it, or free it by FBQ |
| } |
| |
| }//group BehaviorContext |
| |
| //================================================== |
| // f_LGenBase_Test_evalSuccess (Dummy) |
| //================================================== |
| function f_LGenBase_Test_evalSuccess( |
| in integer eGroupIdx, |
| in integer eIdxInGroup ) |
| runs on EPTF_LGenBase_Test_CT |
| return boolean |
| { |
| return ((eIdxInGroup mod 3)==0); |
| } |
| //================================================== |
| // f_LGenBase_Test_evalSuccess2 (Dummy) |
| //================================================== |
| function f_LGenBase_Test_evalSuccess2( |
| in integer pl_tcIdx, |
| in integer pl_eIdxInTc, |
| in boolean pl_lastSuccess) |
| runs on EPTF_LGenBase_Test_CT |
| return EPTF_LGenBase_EntityState |
| { |
| if(tsp_EPTF_LGenBaseTestDebug){log(%definitionId,": ",(pl_eIdxInTc mod 3)==0)} |
| return f_EPTF_LGenBase_Test_getVerdictFromBool((pl_eIdxInTc mod 3)==0 ); |
| } |
| |
| group CreateDeclareFuncions |
| { |
| //================================================== |
| // f_EPTF_LGenBase_Test_createEntityGroup |
| //================================================== |
| function f_EPTF_LGenBase_Test_createEntityGroup() |
| runs on EPTF_LGenBase_Test_CT |
| return EPTF_LGenBase_EntityGroup |
| { |
| f_EPTF_LGenBase_init( |
| pl_selfName:= tsp_LGenBase_Test_name, |
| pl_numEntities:=0, |
| pl_entityNamePrefix:=tsp_LGenBase_Test_name&"_", |
| pl_EPTF_LGenBase_burstFunc:= imst2); |
| //===Create===== |
| var integer vl_myBCtxIdx1:=f_EPTF_LGenBase_declareBehaviorType( |
| pl_name:= tsp_EPTF_LGenBase_Test_behaviorTypeName&"_1", |
| pl_maxCount:= 5, |
| pl_resetFn := refers(f_EPTF_LGenBase_Test_contextReset), |
| pl_bindFn := refers(f_EPTF_LGenBase_Test_contextBind), |
| pl_unbindFn:= refers(f_EPTF_LGenBase_Test_contextUnbind)); |
| |
| v_myBCtxIdx:= vl_myBCtxIdx1; //Only this bType will be used |
| |
| var integer vl_myBCtxIdx2:=f_EPTF_LGenBase_declareBehaviorType( |
| pl_name:= tsp_EPTF_LGenBase_Test_behaviorTypeName&"_2", |
| pl_maxCount:= 7, |
| pl_resetFn := null,//refers(f_EPTF_LGenBase_Test_contextReset), |
| pl_bindFn := null, //refers(f_EPTF_LGenBase_Test_contextBind), |
| pl_unbindFn:= null) //refers(f_EPTF_LGenBase_Test_contextUnbind)); |
| |
| var integer vl_myBCtxIdx3:=f_EPTF_LGenBase_declareBehaviorType( |
| pl_name:= tsp_EPTF_LGenBase_Test_behaviorTypeName&"_3", |
| pl_maxCount:= 6, |
| pl_resetFn := null, //refers(f_EPTF_LGenBase_Test_contextReset), |
| pl_bindFn := null, //refers(f_EPTF_LGenBase_Test_contextBind), |
| pl_unbindFn:= null) //refers(f_EPTF_LGenBase_Test_contextUnbind)); |
| |
| |
| var integer vl_etIdx:= f_EPTF_LGenBase_declareEntityType( |
| pl_name:="TestEntityType", |
| pl_behaviorTypeList:= { |
| tsp_EPTF_LGenBase_Test_behaviorTypeName&"_1", |
| tsp_EPTF_LGenBase_Test_behaviorTypeName&"_2", |
| tsp_EPTF_LGenBase_Test_behaviorTypeName&"_3" |
| }); |
| |
| var EPTF_LGenBase_EntityGrpDeclarator vl_eg:={ name:="TestEntityGroup",eType:="TestEntityType",eCount:=20 }; |
| |
| //Create: |
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup(vl_eg); |
| |
| var EPTF_LGenBase_EntityGroup vl_expectedEG:= cEPTF_LGenBase_emptyEntityGroup |
| vl_expectedEG.name:= "TestEntityGroup" |
| vl_expectedEG.eTypeIdx := vl_etIdx |
| vl_expectedEG.eOffset := 0 |
| vl_expectedEG.eCount := 5 |
| |
| return vl_expectedEG; |
| |
| }//f_EPTF_LGenBase_Test_createEntityGroup |
| |
| //================================================== |
| // f_EPTF_LGenBase_Test_createEntityGroup4Measurement |
| //================================================== |
| function f_EPTF_LGenBase_Test_createEntityGroup4Measurement(in integer pl_nrOfEntitites) |
| runs on EPTF_LGenBase_Test_CT |
| return EPTF_LGenBase_EntityGroup |
| { |
| f_EPTF_LGenBase_init( |
| pl_selfName:= tsp_LGenBase_Test_name, |
| pl_numEntities:=0, |
| pl_entityNamePrefix:=tsp_LGenBase_Test_name&"_", |
| pl_EPTF_LGenBase_burstFunc:= imst2); |
| //===Create===== |
| var integer vl_myBCtxIdx1:=f_EPTF_LGenBase_declareBehaviorType( |
| pl_name:= tsp_EPTF_LGenBase_Test_behaviorTypeName&"_1", |
| pl_maxCount:= pl_nrOfEntitites, |
| pl_resetFn := refers(f_EPTF_LGenBase_Test_contextReset), |
| pl_bindFn := refers(f_EPTF_LGenBase_Test_contextBind), |
| pl_unbindFn:= refers(f_EPTF_LGenBase_Test_contextUnbind)); |
| |
| v_myBCtxIdx:= vl_myBCtxIdx1; //Only this bType will be used |
| |
| var integer vl_etIdx:= f_EPTF_LGenBase_declareEntityType( |
| pl_name:="TestEntityType", |
| pl_behaviorTypeList:= { |
| tsp_EPTF_LGenBase_Test_behaviorTypeName&"_1" |
| }); |
| |
| var EPTF_LGenBase_EntityGrpDeclarator vl_eg:={ name:="TestEntityGroup",eType:="TestEntityType",eCount:=pl_nrOfEntitites }; |
| |
| //Create: |
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup(vl_eg); |
| |
| var EPTF_LGenBase_EntityGroup vl_expectedEG:=cEPTF_LGenBase_emptyEntityGroup; |
| vl_expectedEG:= |
| { |
| name:= "TestEntityGroup", |
| eTypeIdx := vl_etIdx, |
| eOffset := 0, |
| eCount := pl_nrOfEntitites, |
| scenarios :={} |
| }; |
| |
| return vl_expectedEG; |
| |
| }//f_EPTF_LGenBase_Test_createEntityGroup4Measurement |
| |
| //================================================== |
| // f_EPTF_LGenBase_Test_declareCompactFsmTable (Dummy) |
| //================================================== |
| function f_EPTF_LGenBase_Test_declareCompactFsmTable() |
| runs on EPTF_LGenBase_Test_CT |
| return integer //fsmIdx |
| { |
| var charstring vl_bName:=tsp_EPTF_LGenBase_Test_behaviorTypeName&"_1"; |
| var EPTF_LGenBase_FsmEvent vl_input1:="TestFsmEvent1";//, vl_input2:="TestFsmEvent2"; |
| var integer vl_inputIdx1:=f_EPTF_LGenBase_declareFsmEvent( pl_bName:= vl_bName,pl_input:= vl_input1); |
| //var integer vl_inputIdx2:=f_EPTF_LGenBase_declareFsmEvent( pl_bName:= vl_bName,pl_input:= vl_input2); |
| |
| var EPTF_LGenBase_CompactFsmTable vl_fsmTable := { |
| name:= "TestCompactFsmTable", |
| stateList:= {"idle", "busy"}, |
| timerList:= { {"Timer1",0.5},{"Timer2", 2.0},{"Timer3", 2.0}}, |
| table := { |
| { |
| eventToListen := {c_EPTF_LGenBase_bIdx,c_EPTF_LGenBase_inputIdx_testMgmt_startTC,fsm}, |
| cellRow := { |
| //state[0]==idle |
| { |
| { |
| {refers(f_EPTF_LGenBase_step_timerStart),{0}}, |
| {refers(f_EPTF_LGenBase_Test_step_reportTrafficCaseStarted),{0}} |
| //,{refers(f_EPTF_LGenBase_Test_logTrafficCaseStats),{0}} |
| }, |
| omit, |
| 1 |
| }, |
| //state[1]==busy |
| {omit, omit, omit} |
| } |
| }, |
| { |
| eventToListen := {c_EPTF_LGenBase_specialBIdx_timerTimeout,0,fsm}, |
| cellRow := { |
| //state[0]==idle |
| {omit , omit, 0}, |
| //state[1]==busy |
| { |
| { |
| {refers(f_EPTF_LGenBase_step_trafficSuccess),{0}} //calls this: c_EPTF_LGenBase_inputIdx_testMgmt_finishedTcSuccess |
| //,{refers(f_EPTF_LGenBase_Test_logTrafficCaseStats),{0}} |
| }, |
| omit, |
| 0 |
| } |
| } |
| }, |
| { |
| eventToListen := {c_EPTF_LGenBase_bIdx,c_EPTF_LGenBase_inputIdx_testMgmt_stopTC,fsm}, |
| cellRow := { |
| //state[0]==idle |
| { |
| omit, omit, 0 |
| }, |
| //state[1]==busy |
| { |
| {{refers(f_EPTF_LGenBase_Test_step_reportTrafficCaseStopped),{0}}}, omit, 0 |
| } |
| } |
| }, |
| { |
| eventToListen := {c_EPTF_LGenBase_bIdx,c_EPTF_LGenBase_inputIdx_testMgmt_abortTC,general}, |
| cellRow := { |
| //state[0]==idle |
| {omit, omit, 0}, |
| //state[0]==busy, goes into idle |
| { |
| {{refers(f_EPTF_LGenBase_Test_step_reportTrafficCaseAborted),{0}}}, omit, 0 |
| } |
| } |
| }, |
| { |
| eventToListen:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdx1, eventType:= fsm}, |
| cellRow:= { |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy1),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=1 |
| }, |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy2),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=0 |
| } |
| } |
| } |
| } |
| } |
| |
| var integer vl_fsmIdx := f_EPTF_LGenBase_declareCompactFsmTable(vl_fsmTable); |
| return vl_fsmIdx; |
| } |
| //================================================== |
| // f_EPTF_LGenBase_Test_declareCompactFsmTable4TrafficSuccessTest |
| //================================================== |
| function f_EPTF_LGenBase_Test_declareCompactFsmTable4TrafficSuccessTest() |
| runs on EPTF_LGenBase_Test_CT |
| return integer //fsmIdx |
| { |
| var charstring vl_bName:=tsp_EPTF_LGenBase_Test_behaviorTypeName&"_1"; |
| var EPTF_LGenBase_CompactFsmTable vl_fsmTable := { |
| name:= "TestCompactFsmTableTraffic", |
| stateList:= {"idle", "busy"}, |
| timerList:= {{"Timer1",tsp_LGenBase_Test_timeout}}, |
| table := { |
| { |
| eventToListen := {c_EPTF_LGenBase_bIdx,c_EPTF_LGenBase_inputIdx_testMgmt_startTC,fsm}, |
| cellRow := { |
| //state[0]==idle |
| { |
| { |
| {refers(f_EPTF_LGenBase_step_timerStart),{0}}, |
| {refers(f_EPTF_LGenBase_Test_step_reportTrafficCaseStarted),{0}}, |
| {refers(f_EPTF_LGenBase_Test_step_incrementTrafficCaseCounter),{0}} |
| //,{refers(f_EPTF_LGenBase_Test_logTrafficCaseStats),{0}} |
| }, |
| omit, |
| 1 |
| }, |
| //state[1]==busy |
| {omit, omit, omit} |
| } |
| }, |
| { |
| eventToListen := {c_EPTF_LGenBase_specialBIdx_timerTimeout,0,fsm}, |
| cellRow := { |
| //state[0]==idle |
| {omit , omit, 0}, |
| //state[1]==busy |
| { |
| { |
| {refers(f_EPTF_LGenBase_Test_step_reportTrafficCaseStopped),{0}}, |
| {refers(f_EPTF_LGenBase_step_trafficSuccess),{0}} //calls this: c_EPTF_LGenBase_inputIdx_testMgmt_finishedTcSuccess |
| //,{refers(f_EPTF_LGenBase_Test_logTrafficCaseStats),{0}} |
| }, |
| omit, |
| 0 |
| } |
| } |
| }, |
| { |
| eventToListen := {c_EPTF_LGenBase_bIdx,c_EPTF_LGenBase_inputIdx_testMgmt_stopTC,fsm}, |
| cellRow := { |
| //state[0]==idle |
| { |
| omit, omit, 0 |
| }, |
| //state[1]==busy |
| {omit, omit, 0} |
| } |
| }, |
| { |
| eventToListen := {c_EPTF_LGenBase_bIdx,c_EPTF_LGenBase_inputIdx_testMgmt_abortTC,general}, |
| cellRow := { |
| //state[0]==idle |
| {omit, omit, 0}, |
| //state[0]==busy, goes into idle |
| { |
| {{refers(f_EPTF_LGenBase_Test_step_reportTrafficCaseAborted),{0}}}, omit, 0 |
| } |
| } |
| } |
| } |
| } |
| |
| var integer vl_fsmIdx := f_EPTF_LGenBase_declareCompactFsmTable(vl_fsmTable); |
| return vl_fsmIdx; |
| } |
| |
| //================================================== |
| // f_EPTF_LGenBase_Test_declareCompactFsmTable4TrafficFailedTest |
| //================================================== |
| function f_EPTF_LGenBase_Test_declareCompactFsmTable4TrafficFailedTest() |
| runs on EPTF_LGenBase_Test_CT |
| return integer //fsmIdx |
| { |
| //var charstring vl_bName:=tsp_EPTF_LGenBase_Test_behaviorTypeName&"_1"; |
| |
| var EPTF_LGenBase_CompactFsmTable vl_fsmTable := { |
| name:= "TestCompactFsmTableTraffic", |
| stateList:= {"idle", "busy"}, |
| timerList:= {{"Timer1",0.2}}, |
| table := { |
| { |
| eventToListen := {c_EPTF_LGenBase_bIdx,c_EPTF_LGenBase_inputIdx_testMgmt_startTC,fsm}, |
| cellRow := { |
| //state[0]==idle |
| { |
| { |
| {refers(f_EPTF_LGenBase_step_timerStart),{0}}, |
| {refers(f_EPTF_LGenBase_Test_step_reportTrafficCaseStarted),{0}} |
| //\\{refers(f_EPTF_LGenBase_Test_logTrafficCaseStats),{0}} |
| }, |
| omit, |
| 1 |
| }, |
| //state[1]==busy |
| {omit, omit, omit} |
| } |
| }, |
| { |
| eventToListen := {c_EPTF_LGenBase_specialBIdx_timerTimeout,0,fsm}, |
| cellRow := { |
| //state[0]==idle |
| {omit , omit, 0}, |
| //state[1]==busy |
| { |
| { |
| {refers(f_EPTF_LGenBase_Test_step_reportTrafficCaseStopped),{0}}, |
| {refers(f_EPTF_LGenBase_step_trafficFailed),{0}} |
| //,{refers(f_EPTF_LGenBase_Test_logTrafficCaseStats),{0}} |
| }, |
| omit, |
| 0 |
| } |
| } |
| }, |
| { |
| eventToListen := {c_EPTF_LGenBase_bIdx,c_EPTF_LGenBase_inputIdx_testMgmt_stopTC,fsm}, |
| cellRow := { |
| //state[0]==idle |
| { |
| omit, omit, 0 |
| }, |
| //state[1]==busy |
| {omit, omit, 0} |
| } |
| }, |
| { |
| eventToListen := {c_EPTF_LGenBase_bIdx,c_EPTF_LGenBase_inputIdx_testMgmt_abortTC,general}, |
| cellRow := { |
| //state[0]==idle |
| {omit, omit, 0}, |
| //state[0]==busy, goes into idle |
| { |
| {{refers(f_EPTF_LGenBase_Test_step_reportTrafficCaseAborted),{0}}}, omit, 0 |
| } |
| } |
| },{ |
| eventToListen := {c_EPTF_LGenBase_bIdx,c_EPTF_LGenBase_inputIdx_testMgmt_abortTC,general}, |
| cellRow := { |
| //state[0]==idle |
| {omit, omit, 0}, |
| //state[0]==busy, goes into idle |
| { |
| {{refers(f_EPTF_LGenBase_Test_step_reportTrafficCaseAborted),{0}}}, omit, 0 |
| } |
| } |
| } |
| } |
| } |
| |
| var integer vl_fsmIdx := f_EPTF_LGenBase_declareCompactFsmTable(vl_fsmTable); |
| return vl_fsmIdx; |
| } |
| |
| function f_EPTF_LGenBase_Test_stepTrafficFailedWithTemplate(in EPTF_LGenBase_TestStepArgs pl_ptr) |
| runs on EPTF_LGenBase_CT { |
| f_EPTF_LGenBase_dispatchEvent(valueof(t_LGenBase_finishedTcFailed(pl_ptr.eIdx, f_EPTF_LGenBase_tcIdxOfStep(pl_ptr)))) |
| } |
| |
| //================================================== |
| // f_EPTF_LGenBase_Test_declareCompactFsmTable4TrafficFailedTest |
| //================================================== |
| function f_EPTF_LGenBase_Test_declareCompactFsmTable4TrafficFailedTest2() |
| runs on EPTF_LGenBase_Test_CT |
| return integer //fsmIdx |
| { |
| //var charstring vl_bName:=tsp_EPTF_LGenBase_Test_behaviorTypeName&"_1"; |
| |
| var EPTF_LGenBase_CompactFsmTable vl_fsmTable := { |
| name:= "TestCompactFsmTableTraffic", |
| stateList:= {"idle", "busy"}, |
| timerList:= {{"Timer1",0.2}}, |
| table := { |
| { |
| eventToListen := {c_EPTF_LGenBase_bIdx,c_EPTF_LGenBase_inputIdx_testMgmt_startTC,fsm}, |
| cellRow := { |
| //state[0]==idle |
| { |
| { |
| {refers(f_EPTF_LGenBase_step_timerStart),{0}}, |
| {refers(f_EPTF_LGenBase_Test_step_reportTrafficCaseStarted),{0}} |
| //\\{refers(f_EPTF_LGenBase_Test_logTrafficCaseStats),{0}} |
| }, |
| omit, |
| 1 |
| }, |
| //state[1]==busy |
| {omit, omit, omit} |
| } |
| }, |
| { |
| eventToListen := {c_EPTF_LGenBase_specialBIdx_timerTimeout,0,fsm}, |
| cellRow := { |
| //state[0]==idle |
| {omit , omit, 0}, |
| //state[1]==busy |
| { |
| { |
| {refers(f_EPTF_LGenBase_Test_step_reportTrafficCaseStopped),{0}}, |
| {refers(f_EPTF_LGenBase_Test_stepTrafficFailedWithTemplate),{0}} |
| //,{refers(f_EPTF_LGenBase_Test_logTrafficCaseStats),{0}} |
| }, |
| omit, |
| 0 |
| } |
| } |
| }, |
| { |
| eventToListen := {c_EPTF_LGenBase_bIdx,c_EPTF_LGenBase_inputIdx_testMgmt_stopTC,fsm}, |
| cellRow := { |
| //state[0]==idle |
| { |
| omit, omit, 0 |
| }, |
| //state[1]==busy |
| {omit, omit, 0} |
| } |
| }, |
| { |
| eventToListen := {c_EPTF_LGenBase_bIdx,c_EPTF_LGenBase_inputIdx_testMgmt_abortTC,general}, |
| cellRow := { |
| //state[0]==idle |
| {omit, omit, 0}, |
| //state[0]==busy, goes into idle |
| { |
| {{refers(f_EPTF_LGenBase_Test_step_reportTrafficCaseAborted),{0}}}, omit, 0 |
| } |
| } |
| },{ |
| eventToListen := {c_EPTF_LGenBase_bIdx,c_EPTF_LGenBase_inputIdx_testMgmt_abortTC,general}, |
| cellRow := { |
| //state[0]==idle |
| {omit, omit, 0}, |
| //state[0]==busy, goes into idle |
| { |
| {{refers(f_EPTF_LGenBase_Test_step_reportTrafficCaseAborted),{0}}}, omit, 0 |
| } |
| } |
| } |
| } |
| } |
| |
| var integer vl_fsmIdx := f_EPTF_LGenBase_declareCompactFsmTable(vl_fsmTable); |
| return vl_fsmIdx; |
| } |
| //================================================== |
| // f_EPTF_LGenBase_Test_declareCompactFsmTable4EntityStoppedTest |
| //================================================== |
| function f_EPTF_LGenBase_Test_declareCompactFsmTable4EntityStoppedTest() |
| runs on EPTF_LGenBase_Test_CT |
| return integer //fsmIdx |
| { |
| var charstring vl_bName:=tsp_EPTF_LGenBase_Test_behaviorTypeName&"_1"; |
| |
| var EPTF_LGenBase_CompactFsmTable vl_fsmTable := { |
| name:= "TestCompactFsmTableTraffic", |
| stateList:= {"idle", "busy"}, |
| timerList:= {{"Timer1",0.2}}, |
| table := { |
| { |
| eventToListen := {c_EPTF_LGenBase_bIdx,c_EPTF_LGenBase_inputIdx_testMgmt_startTC,fsm}, |
| cellRow := { |
| //state[0]==idle |
| { |
| { |
| {refers(f_EPTF_LGenBase_step_timerStart),{0}}, |
| {refers(f_EPTF_LGenBase_Test_step_reportTrafficCaseStarted),{0}} |
| //,{refers(f_EPTF_LGenBase_Test_logTrafficCaseStats),{0}} |
| }, |
| omit, |
| 1 |
| }, |
| //state[1]==busy |
| {omit, omit, omit} |
| } |
| }, |
| { |
| eventToListen := {c_EPTF_LGenBase_specialBIdx_timerTimeout,0,fsm}, |
| cellRow := { |
| //state[0]==idle |
| {omit , omit, 0}, |
| //state[1]==busy |
| { |
| { |
| {refers(f_EPTF_LGenBase_Test_step_reportTrafficCaseStopped),{0}}, |
| {refers(f_EPTF_LGenBase_step_entityStopped),{0}} |
| //,{refers(f_EPTF_LGenBase_Test_logTrafficCaseStats),{0}} |
| }, |
| omit, |
| 0 |
| } |
| } |
| }, |
| { |
| eventToListen := {c_EPTF_LGenBase_bIdx,c_EPTF_LGenBase_inputIdx_testMgmt_stopTC,fsm}, |
| cellRow := { |
| //state[0]==idle |
| { |
| omit, omit, 0 |
| }, |
| //state[1]==busy |
| {omit, omit, 0} |
| } |
| }, |
| { |
| eventToListen := {c_EPTF_LGenBase_bIdx,c_EPTF_LGenBase_inputIdx_testMgmt_abortTC,general}, |
| cellRow := { |
| //state[0]==idle |
| {omit, omit, 0}, |
| //state[0]==busy, goes into idle |
| { |
| {{refers(f_EPTF_LGenBase_Test_step_reportTrafficCaseAborted),{0}}}, omit, 0 |
| } |
| } |
| }, |
| { |
| eventToListen := {c_EPTF_LGenBase_bIdx, c_EPTF_LGenBase_inputIdx_testMgmt_entityStopped,general}, |
| cellRow := { |
| //state[0]==idle |
| {{{refers(f_EPTF_LGenBase_Test_step_reportEntityStopped),{0}}}, omit, 0}, |
| //state[0]==busy, goes into idle |
| { |
| {{refers(f_EPTF_LGenBase_Test_step_reportEntityStopped),{0}}}, omit, 0 |
| } |
| } |
| }, |
| { |
| eventToListen := {c_EPTF_LGenBase_bIdx, c_EPTF_LGenBase_inputIdx_testMgmt_entityAborted,general}, |
| cellRow := { |
| //state[0]==idle |
| {{{refers(f_EPTF_LGenBase_Test_step_reportEntityAborted),{0}}}, omit, 0}, |
| //state[0]==busy, goes into idle |
| { |
| {{refers(f_EPTF_LGenBase_Test_step_reportEntityAborted),{0}}}, omit, 0 |
| } |
| } |
| } |
| } |
| } |
| |
| var integer vl_fsmIdx := f_EPTF_LGenBase_declareCompactFsmTable(vl_fsmTable); |
| return vl_fsmIdx; |
| } |
| |
| //================================================== |
| // f_EPTF_LGenBase_Test_declareCompactFsmTableMixedResp (Dummy) |
| //================================================== |
| function f_EPTF_LGenBase_Test_declareCompactFsmTableMixedResp(in float pl_timer := 0.1) |
| runs on EPTF_LGenBase_Test_CT |
| return integer //fsmIdx |
| { |
| var charstring vl_bName:=tsp_EPTF_LGenBase_Test_behaviorTypeName&"_1"; |
| var EPTF_LGenBase_FsmEvent vl_input1:="TestFsmEvent1";//, vl_input2:="TestFsmEvent2"; |
| var integer vl_inputIdx1:=f_EPTF_LGenBase_declareFsmEvent( pl_bName:= vl_bName,pl_input:= vl_input1); |
| //var integer vl_inputIdx2:=f_EPTF_LGenBase_declareFsmEvent( pl_bName:= vl_bName,pl_input:= vl_input2); |
| |
| var EPTF_LGenBase_CompactFsmTable vl_fsmTable := { |
| name:= "TestCompactFsmTable", |
| stateList:= {"idle", "busy"}, |
| timerList:= { {"Timer1",pl_timer},{"Timer2", 2.0},{"Timer3", 2.0}}, |
| table := { |
| { |
| eventToListen := {c_EPTF_LGenBase_bIdx,c_EPTF_LGenBase_inputIdx_testMgmt_startTC,fsm}, |
| cellRow := { |
| //state[0]==idle |
| { |
| { |
| {refers(f_EPTF_LGenBase_step_timerStart),{0}}, |
| {refers(f_EPTF_LGenBase_Test_step_reportTrafficCaseStarted),{0}} |
| //{refers(f_EPTF_LGenBase_Test_logTrafficCaseStats),{0}} |
| }, |
| omit, |
| 1 |
| }, |
| //state[1]==busy |
| {omit, omit, omit} |
| } |
| }, |
| { |
| eventToListen := {c_EPTF_LGenBase_specialBIdx_timerTimeout,0,fsm}, |
| cellRow := { |
| //state[0]==idle |
| {omit , omit, 0}, |
| //state[1]==busy |
| { |
| { |
| {refers(f_EPTF_LGenBase_Test_step_reportTrafficCaseMixedRet),{0}} //calls this: f_EPTF_LGenBase_Test_step_reportTrafficCaseMixedRet |
| //,{refers(f_EPTF_LGenBase_Test_logTrafficCaseStats),{0}} |
| }, |
| omit, |
| 0 |
| } |
| } |
| }, |
| { |
| eventToListen := {c_EPTF_LGenBase_bIdx,c_EPTF_LGenBase_inputIdx_testMgmt_stopTC,fsm}, |
| cellRow := { |
| //state[0]==idle |
| { |
| omit, omit, 0 |
| }, |
| //state[1]==busy |
| { |
| {{refers(f_EPTF_LGenBase_Test_step_reportTrafficCaseStopped),{0}}}, omit, 0 |
| } |
| } |
| }, |
| { |
| eventToListen := {c_EPTF_LGenBase_bIdx,c_EPTF_LGenBase_inputIdx_testMgmt_abortTC,general}, |
| cellRow := { |
| //state[0]==idle |
| {omit, omit, 0}, |
| //state[0]==busy, goes into idle |
| { |
| {{refers(f_EPTF_LGenBase_Test_step_reportTrafficCaseAborted),{0}}}, omit, 0 |
| } |
| } |
| }, |
| { |
| eventToListen:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdx1, eventType:= fsm}, |
| cellRow:= { |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy1),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=1 |
| }, |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy2),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=0 |
| } |
| } |
| } |
| } |
| } |
| |
| var integer vl_fsmIdx := f_EPTF_LGenBase_declareCompactFsmTable(vl_fsmTable); |
| return vl_fsmIdx; |
| } |
| //================================================== |
| // f_LGenBase_Test_createTcOfSc2 |
| //================================================== |
| function f_LGenBase_Test_createTcOfSc2(in charstring vl_tcTypeName) |
| return EPTF_LGenBase_TcMgmt_TcOfScenario2 |
| { |
| var EPTF_LGenBase_TcMgmt_TcOfScenario2 vl_tc:= tsp_tcOfSc2; |
| vl_tc.tcName := vl_tcTypeName; |
| return vl_tc; |
| } |
| }//group CreateDeclareFuncions |
| |
| group GetFunctions { |
| //================================================== |
| // f_LGenBase_Test_getTrafficCaseType |
| //================================================== |
| //================================================== |
| // f_LGenBase_Test_getScenarioType |
| //================================================== |
| //================================================== |
| // f_LGenBase_Test_getScenarioState |
| //================================================== |
| function f_LGenBase_Test_getScenarioState( |
| in integer pl_eGrpIdx, |
| in integer pl_scIdxInGrp) |
| runs on EPTF_LGenBase_Test_CT |
| return EPTF_LGenBase_tcState |
| { |
| return f_EPTF_LGenBase_getScState(pl_eGrpIdx, pl_scIdxInGrp) |
| } |
| //================================================== |
| // f_LGenBase_Test_getTrafficCaseState |
| //================================================== |
| function f_LGenBase_Test_getTrafficCaseState(in integer pl_tcIdx) |
| runs on EPTF_LGenBase_Test_CT |
| return EPTF_LGenBase_tcState |
| { |
| return f_EPTF_LGenBase_getTcState(pl_tcIdx) |
| } |
| |
| //************************************************** |
| // Get Statistic Data Functions |
| //************************************************** |
| |
| //================================================== |
| // f_LGenBase_Test_getNrOfStarts |
| //================================================== |
| function f_LGenBase_Test_getNrOfStarts(in integer pl_tcIdx) |
| runs on EPTF_LGenBase_Test_CT |
| return integer |
| { |
| return f_EPTF_LGenBase_getTcStarts(pl_tcIdx) |
| } |
| |
| //================================================== |
| // f_LGenBase_Test_getNrOfSuccesses |
| //================================================== |
| function f_LGenBase_Test_getNrOfSuccesses(in integer pl_tcIdx) |
| runs on EPTF_LGenBase_Test_CT |
| return integer |
| { |
| return f_EPTF_LGenBase_getTcSuccesses(pl_tcIdx) |
| } |
| |
| //================================================== |
| // f_LGenBase_Test_getNrOfFails |
| //================================================== |
| function f_LGenBase_Test_getNrOfFails(in integer pl_tcIdx) |
| runs on EPTF_LGenBase_Test_CT |
| return integer |
| { |
| return f_EPTF_LGenBase_getTcFails(pl_tcIdx) |
| } |
| |
| //================================================== |
| // f_LGenBase_Test_getNrOfAllEntities |
| //================================================== |
| function f_LGenBase_Test_getNrOfAllEntities(in integer pl_tcIdx) |
| runs on EPTF_LGenBase_Test_CT |
| return integer |
| { |
| return f_EPTF_LGenBase_getTcAllEntities(pl_tcIdx) |
| } |
| |
| //================================================== |
| // f_LGenBase_Test_getNrOfAvailableEntities |
| //================================================== |
| function f_LGenBase_Test_getNrOfAvailableEntities(in integer pl_tcIdx) |
| runs on EPTF_LGenBase_Test_CT |
| return integer |
| { |
| return f_EPTF_LGenBase_getTcAvailable(pl_tcIdx) |
| } |
| |
| //================================================== |
| // f_LGenBase_Test_getNrOfNotFinishedEntities |
| //================================================== |
| function f_LGenBase_Test_getNrOfNotFinishedEntities(in integer pl_tcIdx) |
| runs on EPTF_LGenBase_Test_CT |
| return integer |
| { |
| return f_EPTF_LGenBase_getTcNotFinishedEntities(pl_tcIdx) |
| } |
| |
| //================================================== |
| // f_LGenBase_Test_getNrOfRunningEntities |
| //================================================== |
| function f_LGenBase_Test_getNrOfRunningEntities(in integer pl_tcIdx) |
| runs on EPTF_LGenBase_Test_CT |
| return integer |
| { |
| return f_EPTF_LGenBase_getTcRunningEntities(pl_tcIdx) |
| } |
| |
| |
| }// group GetFunctions |
| |
| //=== Complex test functions === |
| //================================================== |
| // Name: f_LGenBase_Test_timerTest4NotWeightedSc |
| // Description: - |
| // Used by: tc_EPTF_LGenBase_Test_timer |
| //================================================== |
| function f_LGenBase_Test_timerTest4NotWeightedSc(in integer pl_nrOfEntities,in float pl_execTime, in float pl_cps) |
| runs on EPTF_LGenBase_Test_CT |
| { |
| //=== Prepare === |
| var EPTF_LGenBase_EntityGroup vl_expectedEG:= f_EPTF_LGenBase_Test_createEntityGroup4Measurement(pl_nrOfEntities); |
| v_dummyInt := f_EPTF_LGenBase_declareFunction("evalSuccess2",{evaluateSuccess4EntityAtEntityGroup2 := refers(f_LGenBase_Test_evalSuccess2) }); |
| var integer vl_fsmIdx := f_EPTF_LGenBase_Test_declareCompactFsmTable4TrafficSuccessTest();//TC specific !!! |
| var charstring vl_tcTypeName := "TrafficCaseName"; |
| var EPTF_LGenBase_TcMgmt_tcTypeDeclarator2 vl_tcTypeDecl := { |
| name:=vl_tcTypeName, |
| fsmName := "TestCompactFsmTableTraffic", |
| entityType := "TestEntityType", |
| customEntitySucc := "evalSuccess2" |
| } |
| v_dummyInt := f_EPTF_LGenBase_declareTcType2(vl_tcTypeDecl); |
| |
| var EPTF_LGenBase_TcMgmt_TcOfScenario2 vl_tcOfSc:= f_LGenBase_Test_createTcOfSc2(vl_tcTypeName); |
| vl_tcOfSc.entityFinishConditions := { |
| nrOfExecStart := omit, |
| nrOfSuccesses := omit, |
| nrOfFails := omit, |
| customFinishCondition := omit |
| }; |
| |
| vl_tcOfSc.cpsToReach := pl_cps; |
| |
| var EPTF_LGenBase_TcMgmt_ScenarioDeclarator2 vl_scType := { |
| name:="Sc1", |
| tcList := { vl_tcOfSc} |
| } |
| var integer vl_scIdx:=f_EPTF_LGenBase_declareScenarioType2( vl_scType); |
| var EPTF_LGenBase_Scenario2Grp vl_sc := { |
| eGrpName:= vl_expectedEG.name, |
| scenarioName:="Sc1" |
| } |
| |
| var integer vl_eIdx:=0; //dummy data |
| |
| var EPTF_LGenBase_TestStepArgs vl_ptr:={ |
| eIdx:= vl_eIdx, |
| refContext:= { |
| fCtxIdx:= vl_fsmIdx, |
| fRefArgs:= { 0 } //timerIdx |
| }, |
| stepArgs:={} |
| } |
| |
| timer Tl_external:= pl_execTime * 10.0; |
| Tl_external.start; |
| //log("======>Altstep started at ", Tl_external.read, " <================="); |
| timer Tl:= pl_execTime; |
| Tl.start; |
| |
| f_EPTF_LGenBase_createScenario2EntityGroup(pl_scenarioDesc:=vl_sc, pl_autoStart:=true); |
| |
| alt{ |
| [] Tl.timeout {}; |
| } |
| //log("======>Altstep stopped at ", Tl_external.read, " <================="); |
| |
| |
| //f_EPTF_LGenBase_Test_logTrafficCaseStats(vl_ptr); |
| |
| var float vl_elapsedTime := Tl_external.read; |
| Tl_external.stop; |
| var float vl_expected:= vl_elapsedTime*pl_cps; |
| var integer vl_tcAbsIdx:=f_EPTF_LGenBase_tcIdxOfStep(vl_ptr); |
| var float vl_measuredNrOfStarts := int2float(f_LGenBase_Test_getNrOfStarts(vl_tcAbsIdx)) |
| |
| //The regression tests run in debug mode. We do not guarantee high precision in debug mode |
| if(vl_measuredNrOfStarts < vl_expected*0.9 or vl_expected*1.1 < vl_measuredNrOfStarts) |
| { |
| log("Expected calls: ", vl_expected," measured: ", vl_measuredNrOfStarts); |
| setverdict ( fail ); |
| }else{ |
| setverdict ( pass ); |
| } |
| //log("Number of Entities : ", pl_nrOfEntities); |
| //log("Measured value (nrOfStarts) : ", vl_measuredNrOfStarts); |
| //log("Expected value (elapsed time * cps) : ", vl_expected); |
| //log("Expected cps : ", pl_cps); |
| |
| if(tsp_EPTF_LGenBaseTestDebug){ |
| if(vl_expected>0.0) { |
| log("Measured cps (nrOfStarts/elapsed time): ",vl_measuredNrOfStarts/vl_elapsedTime); |
| log("Relative Error (dX/X) : ", (vl_measuredNrOfStarts-vl_expected)/vl_expected); |
| action("=>>>Entities/Time/Expected_call/Measured_calls/Expected_cps/Measured_cps/SignedRelativeError:\t", |
| pl_nrOfEntities,"\t", |
| vl_elapsedTime,"\t", |
| float2int(vl_expected+0.5),"\t", |
| vl_measuredNrOfStarts,"\t", |
| float2int(pl_cps),"\t", |
| float2int(vl_measuredNrOfStarts/vl_elapsedTime+0.5),"\t", |
| (vl_measuredNrOfStarts-vl_expected)/vl_expected ); |
| } |
| else { |
| log("Signed Relative Error (dX/X) cannot be calculated because X=0"); |
| } |
| } |
| f_EPTF_Base_cleanup_CT(); |
| }//f_LGenBase_Test_timerTest4NotWeightedSc |
| |
| //================================================== |
| // Name: f_LGenBase_Test_timerTest4WeightedSc_internal |
| // Description: - |
| // Used by: tc_EPTF_LGenBase_Test_setScenarioCPS |
| //================================================== |
| function f_LGenBase_Test_timerTest4WeightedSc_internal(in integer pl_nrOfEntities,in float pl_execTime, in float pl_cps) |
| runs on EPTF_LGenBase_Test_CT |
| return EPTF_FloatList |
| { |
| //=== Prepare === |
| var EPTF_LGenBase_EntityGroup vl_expectedEG:= f_EPTF_LGenBase_Test_createEntityGroup4Measurement(pl_nrOfEntities); |
| v_dummyInt := f_EPTF_LGenBase_declareFunction("evalSuccess2",{evaluateSuccess4EntityAtEntityGroup2 := refers(f_LGenBase_Test_evalSuccess2) }); |
| var integer vl_fsmIdx := f_EPTF_LGenBase_Test_declareCompactFsmTable4TrafficSuccessTest();//TC specific !!! |
| var charstring vl_tcTypeName := "TrafficCaseName"; |
| var EPTF_LGenBase_TcMgmt_tcTypeDeclarator2 vl_tcTypeDecl := { |
| name:=vl_tcTypeName, |
| fsmName := "TestCompactFsmTableTraffic", |
| entityType := "TestEntityType", |
| customEntitySucc := "evalSuccess2" |
| } |
| v_dummyInt := f_EPTF_LGenBase_declareTcType2(vl_tcTypeDecl); |
| |
| var EPTF_LGenBase_TcMgmt_TcOfWeightedScenario vl_tcOfSc := { |
| tcName := vl_tcTypeName, |
| tcWeight := 1.0, |
| enableEntities:=true, |
| enable:=true, |
| ranges:= omit, |
| params:= omit, |
| groupFinishConditions:=omit, |
| entityFinishConditions:={ |
| nrOfExecStart := omit, |
| nrOfSuccesses := omit, |
| nrOfFails := omit, |
| customFinishCondition := omit |
| }, |
| entityFinishActions:=omit, |
| tcFinishActions:=omit |
| } |
| |
| var EPTF_LGenBase_TcMgmt_WeightedScenarioDeclarator vl_scType := { |
| name:= "Sc1", |
| enabled:=true, |
| cpsToReach:= 10.0, |
| lockCPS:=false, |
| weightedScData :={ deterministicMix:=true }, |
| tcList := {vl_tcOfSc} |
| }; |
| |
| v_dummyInt := f_EPTF_LGenBase_declareWeightedScenarioType( vl_scType); |
| |
| var EPTF_LGenBase_Scenario2Grp vl_sc := { |
| eGrpName:= vl_expectedEG.name, |
| scenarioName:="Sc1" |
| } |
| |
| var integer vl_eIdx:=0; //dummy data |
| |
| var EPTF_LGenBase_TestStepArgs vl_ptr:={ |
| eIdx:= vl_eIdx, |
| refContext:= { |
| fCtxIdx:= vl_fsmIdx, |
| fRefArgs:= { 0 } //timerIdx |
| }, |
| stepArgs:={} |
| } |
| |
| f_EPTF_LGenBase_createScenario2EntityGroup(pl_scenarioDesc:=vl_sc, pl_autoStart:=false); |
| |
| //===feature to be tested:=== |
| v_dummyFloat := f_EPTF_LGenBase_setScenarioCPS( vl_expectedEG.name, "Sc1", pl_cps); |
| |
| f_EPTF_LGenBase_startWeightedScenario(vl_sc.eGrpName,vl_sc.scenarioName); |
| timer Tl_external:=pl_execTime*10.0 |
| Tl_external.start; |
| //log("==>Altstep started at ", Tl_external.read, " <=="); |
| timer Tl:=tsp_execTime; |
| Tl.start; |
| |
| alt{ |
| [] Tl.timeout {}; |
| } |
| //log("==>Altstep stopped at ", Tl_external.read, " <=="); |
| |
| //f_EPTF_LGenBase_Test_logTrafficCaseStats(vl_ptr); |
| |
| var float vl_elapsedTime := Tl_external.read; |
| Tl_external.stop; |
| //var float vl_expectedCps:= vl_elapsedTime*pl_cps; |
| var integer vl_tcAbsIdx:=f_EPTF_LGenBase_tcIdxOfStep(vl_ptr); |
| var float vl_measuredNrOfStarts := int2float(f_EPTF_LGenBase_getTcStarts(vl_tcAbsIdx)); |
| |
| |
| var EPTF_FloatList vl_measResults := { vl_elapsedTime,vl_measuredNrOfStarts } |
| //log(">>>DEBUG: ",vl_elapsedTime," ",vl_measuredNrOfStarts); |
| f_EPTF_Base_cleanup_CT(); |
| //log(">>>DEBUG:",v_LGenBase_entities) |
| |
| return vl_measResults; |
| }//f_LGenBase_Test_timerTest4WeightedSc |
| |
| //================================================== |
| // Name: f_LGenBase_Test_timerTest4WeightedSc |
| // Description: - |
| // Used by: tc_EPTF_LGenBase_Test_setScenarioCPS |
| //================================================== |
| function f_LGenBase_Test_timerTest4WeightedSc(in integer pl_nrOfEntities,in float pl_execTime, in float pl_cps) |
| runs on EPTF_LGenBase_Test_CT |
| { |
| |
| if(pl_cps<=0.0 ) { return } |
| if(tsp_nrOfRepeat<1) {return} |
| |
| var float vl_elapsedTime:=0.0 |
| var float vl_measuredNrOfStarts:=0.0; |
| var EPTF_FloatList vl_measResults:= {}; |
| |
| var integer vl_nrOfRepeat:=tsp_nrOfRepeat; |
| |
| if(pl_nrOfEntities>10000) {vl_nrOfRepeat:=1} //????? |
| |
| for(var integer i:=0; i<tsp_nrOfRepeat; i:=i+1) { |
| f_EPTF_SchedulerComp_initEventQueue(); |
| vl_measResults:= f_LGenBase_Test_timerTest4WeightedSc_internal(pl_nrOfEntities, pl_execTime, pl_cps); |
| vl_elapsedTime := vl_elapsedTime+ vl_measResults[0]; |
| vl_measuredNrOfStarts := vl_measuredNrOfStarts+ vl_measResults[1]; |
| }//for |
| |
| vl_elapsedTime:=vl_elapsedTime/int2float(tsp_nrOfRepeat); |
| vl_measuredNrOfStarts := vl_measuredNrOfStarts/int2float(tsp_nrOfRepeat); |
| var float vl_expectedCps:= vl_elapsedTime*pl_cps; |
| |
| f_EPTF_LGenBase_Test_setVerdictFromBool( vl_expectedCps*0.9 <vl_measuredNrOfStarts); |
| f_EPTF_LGenBase_Test_setVerdictFromBool( vl_expectedCps*1.1 >vl_measuredNrOfStarts);//too quick |
| |
| //Result in one line: |
| action("=>>>Entities/Time/Expected_call/Measured_calls/Expected_cps/Measured_cps/SignedRelativeError:\t", |
| pl_nrOfEntities,"\t", |
| vl_elapsedTime,"\t", |
| float2int(vl_expectedCps+0.5),"\t", |
| float2int(vl_measuredNrOfStarts),"\t", |
| float2int(pl_cps),"\t", |
| float2int(vl_measuredNrOfStarts/vl_elapsedTime+0.5),"\t", |
| (vl_measuredNrOfStarts-vl_expectedCps)/vl_expectedCps ); |
| }//function |
| |
| function f_EPTF_LGenBase_TestFinished(in integer pl_idx) |
| runs on EPTF_LGenBase_Test_CT{ |
| log("------Finished function called.") |
| v_LGenBase_testFinished := true; |
| } |
| |
| function f_EPTF_LGenBase_wait4TestFinished( |
| in float pl_duration := 15.0, |
| in boolean pl_setverdict := true) |
| runs on EPTF_LGenBase_Test_CT |
| return boolean{ |
| timer T_1 |
| timer T_2 |
| T_1.start( 0.0 ) |
| T_2.start( pl_duration ) |
| alt{ |
| [v_LGenBase_testFinished] T_1.timeout{ |
| T_2.stop |
| v_LGenBase_testFinished := false |
| log("----Finished") |
| return true |
| } |
| [] T_2.timeout { |
| if(pl_setverdict){ |
| setverdict(fail, "timeout in "&%definitionId); |
| } |
| v_LGenBase_testFinished := false |
| return false |
| } |
| } |
| return false |
| } |
| |
| altstep as_EPTF_LGenBase_Test_guard() |
| runs on EPTF_LGenBase_Test_CT{ |
| [] T_LGenBase_Test_guard.timeout{f_EPTF_Base_stop()} |
| } |
| |
| function f_EPTF_LGenBase_Test_setGuard(in float pl_execTime := tsp_execTime) |
| runs on EPTF_LGenBase_Test_CT{ |
| T_LGenBase_Test_guard.start(pl_execTime) |
| activate(as_EPTF_LGenBase_Test_guard()) |
| } |
| |
| function f_EPTF_LGenBase_checkVarEqualForInt( in EPTF_LGenBase_TestStepArgs pl_ptr) |
| runs on EPTF_LGenBase_CT{ |
| var integer vl_varId |
| var EPTF_Var_DirectContent vl_param |
| f_EPTF_LGenBase_fsmVarParamsFromStep(pl_ptr, vl_varId, vl_param) |
| var EPTF_Var_DirectContent vl_varContent |
| f_EPTF_Var_getContent(vl_varId, vl_varContent) |
| //action("Param : " &log2str(vl_param.intVal)); |
| if(not match(vl_param,vl_varContent)){ |
| log("The variables don't match") |
| log(match(vl_param.intVal,vl_varContent.intVal)) |
| setverdict(fail) |
| }else{ |
| setverdict(pass) |
| } |
| } |
| |
| function f_EPTF_LGenBase_TestFinishedNow(in EPTF_LGenBase_TestStepArgs pl_ptr) |
| runs on EPTF_LGenBase_Test_CT{ |
| log("------Finished function called.") |
| v_LGenBase_testFinished := true; |
| } |
| |
| function f_EPTF_LGenBase_TestFinishedFail(in EPTF_LGenBase_TestStepArgs pl_ptr) |
| runs on EPTF_LGenBase_Test_CT{ |
| log("------Finished function called, but failed.") |
| setverdict(fail,"FSM went to a wrong state, fail"); |
| v_LGenBase_testFinished := true; |
| } |
| |
| group LGenBase_DataSource_tests{ |
| type component EPTF_LGenBase_DataSourceTest_CT extends EPTF_LGenBase_VarAndStatTest_CT, EPTF_DataSource_CT { |
| var boolean v_startBecauseDSIsReady := false; |
| } |
| |
| function f_EPTF_LGenBase_ownDispatch(in EPTF_LGenBase_TestStepArgs pl_ptr) |
| runs on EPTF_LGenBase_DataSourceTest_CT{ |
| log("------Dispatch") |
| f_EPTF_LGenBase_dispatchEvent({{v_LGenBase_VarAndStatTest_behav,1,{0,0},omit},{}}) |
| } |
| |
| function f_EPTF_LGenBase_Test_DataSourceClientReady( |
| in charstring pl_source, |
| in charstring pl_ptcName) |
| runs on EPTF_LGenBase_DataSourceTest_CT{ |
| v_startBecauseDSIsReady := true; |
| } |
| |
| |
| function f_LGenBase_Test_DataSource(in EPTF_LGenBase_FsmTableDeclarator pl_fsm, in integer pl_declareEGSCTC := 2) |
| runs on EPTF_LGenBase_DataSourceTest_CT{ |
| |
| f_EPTF_DataSource_init_CT("tc_LGenBase_Test_fsmVariables"); |
| f_EPTF_DataSource_registerReadyCallback(refers(f_EPTF_LGenBase_Test_DataSourceClientReady )); |
| |
| f_EPTF_LGenBase_init("tc_LGenBase_Test_fsmVariables",0, "", tsp_LGenBase_BustCalcMethod, tsp_LGenBase_extTemplLoadList, null, self ); |
| v_LGenBase_VarAndStatTest_behav := f_EPTF_LGenBase_declareBehaviorType("b1", -1, null, null, null); |
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input1"); |
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input2"); |
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input3"); |
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input4"); |
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("et1", {"b1"}); |
| v_dummyInt := f_EPTF_LGenBase_declareFunction("checkFSMVar1", {testStepFunction:= refers(f_LGenBase_Test_checkFSMVar1)}); |
| v_dummyInt := f_EPTF_LGenBase_declareFunction("checkFSMVar2", {testStepFunction:= refers(f_LGenBase_Test_checkFSMVar2)}); |
| v_dummyInt := f_EPTF_LGenBase_declareFunction("checkFSMVar3", {testStepFunction:= refers(f_LGenBase_Test_checkFSMVar3)}); |
| v_dummyInt := f_EPTF_LGenBase_declareFunction("checkFSMVar4", {testStepFunction:= refers(f_LGenBase_Test_checkFSMVar4)}); |
| v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"Finished",refers( f_EPTF_LGenBase_TestFinishedNow)}); |
| v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"FinishedFail",refers( f_EPTF_LGenBase_TestFinishedFail)}); |
| v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"checkVarEqual",refers( f_EPTF_LGenBase_checkVarEqualForInt)}); |
| v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"owndispatch",refers( f_EPTF_LGenBase_ownDispatch)}); |
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable( pl_fsm ); |
| |
| if(pl_declareEGSCTC > 0){ |
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({"eg1", "et1", 3}); |
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({"eg2", "et1", 3}); |
| v_dummyInt := f_EPTF_LGenBase_declareTrafficCaseType({ |
| "TC1", |
| "fsmtimer0_FSM", |
| "et1", |
| {} |
| }); |
| if(pl_declareEGSCTC > 1){ |
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3( |
| { "SC1", |
| { |
| {"TC1",{ |
| {target := {cpsToReach := 1.0}} |
| } |
| } |
| }, |
| {} |
| }); |
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3( |
| { "SC2", |
| { |
| {"TC1",{ |
| {target := {cpsToReach := 1.0}} |
| } |
| } |
| }, |
| {} |
| }); |
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false); |
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC2"},false); |
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg2","SC2"},false); |
| |
| f_EPTF_LGenBase_dispatchEvent({{v_LGenBase_VarAndStatTest_behav,0,{0,0},omit},{}}); |
| } |
| } |
| |
| timer T_guard, T_alt; |
| T_guard.start( 100.0 ); |
| T_alt.start( 0.0 ); |
| alt{ |
| [] T_guard.timeout{ |
| setverdict(fail,"Timeout during config"); |
| f_EPTF_Base_stopAll(); |
| } |
| [v_startBecauseDSIsReady] T_alt.timeout{} |
| }; |
| |
| if(pl_declareEGSCTC > 1){ |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_iteratorEntityGroups, {"eg1", "eg2"}); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_iteratorScenarios, {"SC1","SC2"}, {{c_LGenBase_paramNameEntityGroup, "eg1"}}); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_iteratorScenarios, {"SC2"}, {{c_LGenBase_paramNameEntityGroup, "eg2"}}); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_iteratorTrafficCases, {"TC1"}, {{c_LGenBase_paramNameEntityGroup, "eg1"}, {c_LGenBase_paramNameScenario, "SC1"}}); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_iteratorTrafficCases, {"TC1"}, {{c_LGenBase_paramNameEntityGroup, "eg1"}, {c_LGenBase_paramNameScenario, "SC2"}}); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_iteratorTrafficCases, {"TC1"}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}}); |
| |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementTcNrOfStarts, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}, {c_LGenBase_paramNameTrafficCase, "TC1"}}, true, "0"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementTcNrOfSuccesses, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}, {c_LGenBase_paramNameTrafficCase, "TC1"}}, true, "0"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementTcNrOfFails, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}, {c_LGenBase_paramNameTrafficCase, "TC1"}}, true, "0"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementTcNrOfNotFinishedEntities, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}, {c_LGenBase_paramNameTrafficCase, "TC1"}}, true, "3"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementTcNrOfAllEntities, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}, {c_LGenBase_paramNameTrafficCase, "TC1"}}, true, "3"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementTcNrOfRunningEntities, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}, {c_LGenBase_paramNameTrafficCase, "TC1"}}, true, "0"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementTcNrOfAvailableEntities, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}, {c_LGenBase_paramNameTrafficCase, "TC1"}}, true, "0"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementTcState, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}, {c_LGenBase_paramNameTrafficCase, "TC1"}}, true, "0"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementTcStateName, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}, {c_LGenBase_paramNameTrafficCase, "TC1"}}, true, "Idle"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementTcUserData, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}, {c_LGenBase_paramNameTrafficCase, "TC1"}}, true, ""); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementTcSentMessages, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}, {c_LGenBase_paramNameTrafficCase, "TC1"}}, true, "0"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementTcReceivedAnswers, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}, {c_LGenBase_paramNameTrafficCase, "TC1"}}, true, "0"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementTcRangeLoops, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}, {c_LGenBase_paramNameTrafficCase, "TC1"}}, true, "0"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementTcCpsToReach, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}, {c_LGenBase_paramNameTrafficCase, "TC1"}}, true, "1.000000"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementTcLastCps, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}, {c_LGenBase_paramNameTrafficCase, "TC1"}}, true, "0.000000"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementTcName, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}, {c_LGenBase_paramNameTrafficCase, "TC1"}}, true, "TC1"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementTcUniqueName, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}, {c_LGenBase_paramNameTrafficCase, "TC1"}}, true, "eg2.SC2.TC1"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementTcEnabled, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}, {c_LGenBase_paramNameTrafficCase, "TC1"}}, true, "false"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementTcMinAvailable, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}, {c_LGenBase_paramNameTrafficCase, "TC1"}}, true, "0"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementTcMaxRunning, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}, {c_LGenBase_paramNameTrafficCase, "TC1"}}, true, "0"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementTcMaxBusy, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}, {c_LGenBase_paramNameTrafficCase, "TC1"}}, true, "0"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementTcWeight, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}, {c_LGenBase_paramNameTrafficCase, "TC1"}}, true, "0.000000"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementTcTrafficType, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}, {c_LGenBase_paramNameTrafficCase, "TC1"}}, true, "originating"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementTcNrOfErrors, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}, {c_LGenBase_paramNameTrafficCase, "TC1"}}, true, "0"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementTcNrOfTimeouts, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}, {c_LGenBase_paramNameTrafficCase, "TC1"}}, true, "0"); |
| |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementScName, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}}, true, "eg2.SC2"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementScEnabled, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}}, true, "true"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementScState, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}}, true, "0"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementScStateName, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}}, true, "Idle"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementScLockCPS, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}}, true, "false"); |
| |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementTcStartBtn, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}, {c_LGenBase_paramNameTrafficCase, "TC1"}}, true, "false"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementTcStopBtn, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}, {c_LGenBase_paramNameTrafficCase, "TC1"}}, true, "false"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementTcAbortBtn, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}, {c_LGenBase_paramNameTrafficCase, "TC1"}}, true, "false"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementTcRestoreBtn, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}, {c_LGenBase_paramNameTrafficCase, "TC1"}}, true, "false"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementTcPauseBtn, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}, {c_LGenBase_paramNameTrafficCase, "TC1"}}, true, "false"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementTcSingleShotBtn, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}, {c_LGenBase_paramNameTrafficCase, "TC1"}}, true, "false"); |
| |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementScStartBtn, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}}, true, "0"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementScStopBtn, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}}, true, "0"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementScAbortBtn, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}}, true, "0"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementScRestoreBtn, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}}, true, "0"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementScPauseBtn, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}}, true, "0"); |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementScSingleShotBtn, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"}, {c_LGenBase_paramNameScenario, "SC2"}}, true, "0"); |
| |
| f_EPTF_LGenBase_Test_requestConditionAndCheck( c_LGenBase_conditionIsWeightedSc, {{c_LGenBase_paramNameEntityGroup, "eg2"},{c_LGenBase_paramNameScenario, "SC2"}}, false); |
| |
| f_EPTF_LGenBase_Test_requestConditionAndCheck( c_LGenBase_conditionIsScPresent, {{c_LGenBase_paramNameEntityGroup, "eg2"},{c_LGenBase_paramNameScenario, "SC2"}}, true); |
| f_EPTF_LGenBase_Test_requestConditionAndCheck( c_LGenBase_conditionIsScPresent, {{c_LGenBase_paramNameEntityGroup, "eg2"},{c_LGenBase_paramNameScenario, "SC_unknow"}}, false); |
| |
| f_EPTF_LGenBase_Test_requestConditionAndCheck( c_LGenBase_conditionIsTcPresent, {{c_LGenBase_paramNameEntityGroup, "eg2"},{c_LGenBase_paramNameScenario, "SC2"}, {c_LGenBase_paramNameTrafficCase, "TC1"}}, true); |
| f_EPTF_LGenBase_Test_requestConditionAndCheck( c_LGenBase_conditionIsTcPresent, {{c_LGenBase_paramNameEntityGroup, "eg2"},{c_LGenBase_paramNameScenario, "SC2"}, {c_LGenBase_paramNameTrafficCase, "TC_unknow"}}, false); |
| |
| f_EPTF_LGenBase_Test_requestConditionAndCheck( c_LGenBase_conditionHasActiveTc, {}, true); |
| |
| f_EPTF_LGenBase_Test_requestDataAndCheck( c_LGenBase_dataElementTcEnabledAtStartup, {}, {{c_LGenBase_paramNameEntityGroup, "eg2"},{c_LGenBase_paramNameScenario, "SC2"}, {c_LGenBase_paramNameTrafficCase, "TC1"}}, true, "false"); |
| } else { |
| f_EPTF_LGenBase_Test_requestConditionAndCheck( c_LGenBase_conditionHasActiveTc, {}, false); |
| setverdict(pass); |
| v_LGenBase_testFinished := true; |
| } |
| v_dummyBool := f_EPTF_LGenBase_wait4TestFinished(); |
| f_EPTF_Base_cleanup_CT(); |
| } |
| |
| const EPTF_LGenBase_FsmTableDeclarator c_fsm1 := { |
| name := "fsmtimer0_FSM", |
| fsmParams := { |
| {timerList := {{"time",3.27},{"time2",0.0}}}, |
| {stateList := {"start","end"}}, |
| {varList := |
| { |
| { |
| name := "TCvarA", |
| initValue := {intVal := 0}, |
| scope := TC |
| } |
| } |
| }, |
| {statMeasStatList := { }} |
| }, |
| table := { |
| classicTable := { |
| {eventToListen := {"b1","input1",fsm}, |
| cellRow := { |
| //state[0]==start |
| { |
| { |
| //{c_EPTF_LGenBase_stepName_setTCHealth,{charstringValue := "Undefined"}}, |
| {c_EPTF_LGenBase_stepName_timerStart,{timerName := "time"}}, |
| {c_EPTF_LGenBase_stepName_timerStart,{timerName := "time2"}}, |
| {"checkVarEqual",{varParams := {"TCvarA",{intVal := 0}}}} |
| }, |
| omit, "end" |
| }, |
| //state[1]==end |
| { |
| { |
| {"FinishedFail", omit} |
| }, |
| omit, omit |
| } |
| } |
| }, |
| {eventToListen := {c_EPTF_LGenBase_specialBName_timerTimeout,"time2",fsm}, |
| cellRow := { |
| { |
| { |
| {"FinishedFail", omit} |
| }, |
| omit, omit |
| }, |
| { |
| { |
| {"checkVarEqual",{varParams := {"TCvarA",{intVal := 0}}}}, |
| {"LGenBase: Increment variable",{varParams := {"TCvarA",{intVal := 1}}}} |
| //, {c_EPTF_LGenBase_stepName_setTCHealth,{charstringValue := "OK"}} |
| }, |
| omit, omit |
| } |
| } |
| }, |
| {eventToListen := {c_EPTF_LGenBase_specialBName_timerTimeout,"time",fsm}, |
| cellRow := { |
| { |
| { |
| {"FinishedFail", omit} |
| }, |
| omit, omit |
| }, |
| { |
| { //ha ide ertunk, mar a time2 lekattant es allapotatmenet is kellett legyen |
| {"checkVarEqual",{varParams := {"TCvarA",{intVal := 1}}}}, |
| //{c_EPTF_LGenBase_stepName_setTCHealth,{charstringValue := "Error"}}, |
| {"Finished", omit} |
| }, |
| omit, omit |
| } |
| } |
| } |
| |
| } |
| } |
| } |
| |
| |
| function f_EPTF_LGenBase_Test_requestDataAndCheck( in charstring pl_elementName, |
| in EPTF_CharstringList pl_result, |
| in EPTF_DataSource_Params pl_params := {}, |
| in boolean pl_dataElement := false, |
| in charstring pl_dataElementResult := "" |
| ) runs on EPTF_LGenBase_DataSourceTest_CT { |
| |
| var charstring vl_varName; |
| var charstring vl_dataProviderName := c_LGenBase_DataSource_sourceId; |
| |
| var integer vl_retCode := 0; |
| vl_retCode :=f_EPTF_DataSource_getData( |
| pl_dataVarName := vl_varName, |
| pl_source := vl_dataProviderName, |
| pl_ptcName := "tc_LGenBase_Test_fsmVariables", |
| pl_element := pl_elementName, |
| pl_params := pl_params |
| ); |
| |
| if (pl_dataElement == false){ |
| if (0!=vl_retCode) { |
| setverdict(fail,"Cannot get iterator for dataSource := "&vl_dataProviderName&", ptcName :=", f_EPTF_Base_selfName() & ", element := " & pl_elementName); |
| return; |
| }; |
| var integer vl_varIdx := f_EPTF_Var_getId(vl_varName); |
| var EPTF_CharstringList vl_iList := f_EPTF_Var_getCharstringlistValue(vl_varIdx); |
| |
| if (sizeof(vl_iList) != sizeof(pl_result)){ |
| setverdict(fail, pl_elementName & ": Result is: " & log2str(pl_result) & " instead of "& log2str(vl_iList)); |
| return; |
| } |
| |
| var integer vl_bool := 0; |
| |
| for(var integer i := 0; i < sizeof(vl_iList); i := i + 1){ |
| vl_bool := 0; |
| |
| for(var integer j := 0; j < sizeof(pl_result); j := j + 1){ |
| if (vl_iList[i] == pl_result[j]){ |
| vl_bool := vl_bool + 1; |
| continue; |
| } |
| |
| } |
| if(vl_bool != 1){ |
| for(var integer k := 0; k < sizeof(vl_iList); k := k + 1){ |
| if(vl_iList[i] == vl_iList[k]){ vl_bool := vl_bool - 1;} |
| } |
| if(vl_bool != 0){ |
| setverdict(fail,pl_elementName & ": Result is: " & log2str(vl_iList) & " instead of "& log2str(pl_result)); |
| return; |
| } |
| } |
| } |
| } else { |
| if (0!=vl_retCode) { |
| setverdict(fail,"Cannot get dataElement for dataSource := "&vl_dataProviderName&", ptcName :=", f_EPTF_Base_selfName() & ", element := " & pl_elementName); |
| return; |
| }; |
| |
| var integer vl_varIdx := f_EPTF_Var_getId(vl_varName); |
| var EPTF_Var_DirectContent vl_content; |
| f_EPTF_Var_getContent(vl_varIdx, vl_content) |
| if(ischosen(vl_content.floatVal)){ |
| if(pl_dataElementResult != log2str(vl_content.floatVal)){ |
| setverdict(fail,pl_elementName & ": Result is: " & log2str(vl_content.floatVal) & " instead of "& pl_dataElementResult); |
| return; |
| } |
| } |
| if(ischosen(vl_content.charstringVal)){ |
| if(pl_dataElementResult != vl_content.charstringVal){ |
| setverdict(fail,pl_elementName & ": Result is: " & vl_content.charstringVal & " instead of "& pl_dataElementResult); |
| return; |
| } |
| } |
| if(ischosen(vl_content.intVal)){ |
| if(pl_dataElementResult != log2str(vl_content.intVal)){ |
| setverdict(fail,pl_elementName & ": Result is: " & log2str(vl_content.intVal) & " instead of "& pl_dataElementResult); |
| return; |
| } |
| } |
| if(ischosen(vl_content.boolVal)){ |
| if(pl_dataElementResult != log2str(vl_content.boolVal)){ |
| setverdict(fail,pl_elementName & ": Result is: " & log2str(vl_content.boolVal) & " instead of "& pl_dataElementResult); |
| return; |
| } |
| } |
| if(ischosen(vl_content.statusLEDVal)){ |
| if(pl_dataElementResult != log2str(vl_content.statusLEDVal)){ |
| setverdict(fail,pl_elementName & ": Result is: " & log2str(vl_content.statusLEDVal) & " instead of "& pl_dataElementResult); |
| return; |
| } |
| } |
| } |
| |
| } |
| |
| |
| function f_EPTF_LGenBase_Test_requestConditionAndCheck( in charstring pl_method, |
| in EPTF_DataSource_Params pl_params := {}, |
| in boolean pl_expectedResult |
| ) runs on EPTF_LGenBase_DataSourceTest_CT { |
| |
| var boolean vl_conditionResult; |
| var charstring vl_dataProviderName := c_LGenBase_DataSource_sourceId; |
| |
| var integer vl_retCode := 0; |
| vl_retCode := f_EPTF_DataSource_getCondition( |
| pl_conditionValue := vl_conditionResult, |
| pl_source := vl_dataProviderName, |
| pl_ptcName := "", |
| pl_method := pl_method, |
| pl_params := pl_params |
| ); |
| if (0!=vl_retCode) { |
| setverdict(fail,"Cannot get condition for dataSource := "&vl_dataProviderName&", ptcName :=", f_EPTF_Base_selfName() & ", method := " & pl_method); |
| return; |
| }; |
| |
| if(vl_conditionResult != pl_expectedResult){ |
| setverdict(fail,pl_method & ": Result is: " & log2str(vl_conditionResult) & " instead of "& log2str(pl_expectedResult)); |
| return; |
| } |
| |
| } |
| |
| function f_LGenBase_Test_wrongDataRequest( |
| in EPTF_LGenBase_FsmTableDeclarator pl_fsm, |
| in charstring pl_elementName, |
| in EPTF_DataSource_Params pl_params := {}) |
| runs on EPTF_LGenBase_DataSourceTest_CT{ |
| |
| f_EPTF_DataSource_init_CT("tc_LGenBase_Test_fsmVariables"); |
| f_EPTF_DataSource_registerReadyCallback(refers(f_EPTF_LGenBase_Test_DataSourceClientReady )); |
| |
| f_EPTF_LGenBase_init("tc_LGenBase_Test_fsmVariables",0, "", tsp_LGenBase_BustCalcMethod, tsp_LGenBase_extTemplLoadList, null, self ); |
| v_LGenBase_VarAndStatTest_behav := f_EPTF_LGenBase_declareBehaviorType("b1", -1, null, null, null); |
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input1"); |
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input2"); |
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input3"); |
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input4"); |
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("et1", {"b1"}); |
| v_dummyInt := f_EPTF_LGenBase_declareFunction("checkFSMVar1", {testStepFunction:= refers(f_LGenBase_Test_checkFSMVar1)}); |
| v_dummyInt := f_EPTF_LGenBase_declareFunction("checkFSMVar2", {testStepFunction:= refers(f_LGenBase_Test_checkFSMVar2)}); |
| v_dummyInt := f_EPTF_LGenBase_declareFunction("checkFSMVar3", {testStepFunction:= refers(f_LGenBase_Test_checkFSMVar3)}); |
| v_dummyInt := f_EPTF_LGenBase_declareFunction("checkFSMVar4", {testStepFunction:= refers(f_LGenBase_Test_checkFSMVar4)}); |
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({"eg1", "et1", 3}); |
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({"eg2", "et1", 3}); |
| |
| v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"Finished",refers( f_EPTF_LGenBase_TestFinishedNow)}); |
| v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"FinishedFail",refers( f_EPTF_LGenBase_TestFinishedFail)}); |
| v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"checkVarEqual",refers( f_EPTF_LGenBase_checkVarEqualForInt)}); |
| v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"owndispatch",refers( f_EPTF_LGenBase_ownDispatch)}); |
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable( pl_fsm ); |
| v_dummyInt := f_EPTF_LGenBase_declareTrafficCaseType({ |
| "TC1", |
| "fsmtimer0_FSM", |
| "et1", |
| {} |
| }); |
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3( |
| { "SC1", |
| { |
| {"TC1",{ |
| {target := {cpsToReach := 1.0}} |
| } |
| } |
| }, |
| {} |
| }); |
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3( |
| { "SC2", |
| { |
| {"TC1",{ |
| {target := {cpsToReach := 1.0}} |
| } |
| } |
| }, |
| {} |
| }); |
| |
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false); |
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC2"},false); |
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg2","SC2"},false); |
| |
| f_EPTF_LGenBase_dispatchEvent({{v_LGenBase_VarAndStatTest_behav,0,{0,0},omit},{}}); |
| |
| timer T_guard, T_alt; |
| T_guard.start( 100.0 ); |
| T_alt.start( 0.0 ); |
| alt{ |
| [] T_guard.timeout{ |
| setverdict(fail,"Timeout during config"); |
| f_EPTF_Base_stopAll(); |
| } |
| [v_startBecauseDSIsReady] T_alt.timeout{} |
| }; |
| |
| //Send wrong entitygroup name - kene olyan is, ahol maga a nev van elcseszve |
| |
| var charstring vl_varName; |
| |
| var integer vl_retCode := 0; |
| vl_retCode :=f_EPTF_DataSource_getData( |
| pl_dataVarName := vl_varName, |
| pl_source := c_LGenBase_DataSource_sourceId, |
| pl_ptcName := "", |
| pl_element := pl_elementName, |
| pl_params := pl_params |
| ); |
| |
| if (0!=vl_retCode) { |
| setverdict(pass, "DataSource query failed as expected with wrong data, dataSource := "&c_LGenBase_DataSource_sourceId& ", element := " & pl_elementName); |
| }else |
| { |
| setverdict(fail, "DataSource query was succesfull but it shouldn't have been with these values , |
| dataSource := "&c_LGenBase_DataSource_sourceId& ", element := " & pl_elementName& ", params := "&log2str(pl_params)); |
| } |
| |
| |
| timer T_g2; |
| T_g2.start( 2.0 ); |
| T_g2.timeout; |
| |
| v_dummyBool := f_EPTF_LGenBase_wait4TestFinished(); |
| f_EPTF_Base_cleanup_CT(); |
| } |
| |
| |
| function f_LGenBase_Test_wrongConditionRequest( |
| in EPTF_LGenBase_FsmTableDeclarator pl_fsm, |
| in charstring pl_elementName, |
| in EPTF_DataSource_Params pl_params := {}) |
| runs on EPTF_LGenBase_DataSourceTest_CT{ |
| |
| f_EPTF_DataSource_init_CT("tc_LGenBase_Test_fsmVariables"); |
| f_EPTF_DataSource_registerReadyCallback(refers(f_EPTF_LGenBase_Test_DataSourceClientReady )); |
| |
| f_EPTF_LGenBase_init("tc_LGenBase_Test_fsmVariables",0, "", tsp_LGenBase_BustCalcMethod, tsp_LGenBase_extTemplLoadList, null, self ); |
| v_LGenBase_VarAndStatTest_behav := f_EPTF_LGenBase_declareBehaviorType("b1", -1, null, null, null); |
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input1"); |
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input2"); |
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input3"); |
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input4"); |
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("et1", {"b1"}); |
| v_dummyInt := f_EPTF_LGenBase_declareFunction("checkFSMVar1", {testStepFunction:= refers(f_LGenBase_Test_checkFSMVar1)}); |
| v_dummyInt := f_EPTF_LGenBase_declareFunction("checkFSMVar2", {testStepFunction:= refers(f_LGenBase_Test_checkFSMVar2)}); |
| v_dummyInt := f_EPTF_LGenBase_declareFunction("checkFSMVar3", {testStepFunction:= refers(f_LGenBase_Test_checkFSMVar3)}); |
| v_dummyInt := f_EPTF_LGenBase_declareFunction("checkFSMVar4", {testStepFunction:= refers(f_LGenBase_Test_checkFSMVar4)}); |
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({"eg1", "et1", 3}); |
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({"eg2", "et1", 3}); |
| |
| v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"Finished",refers( f_EPTF_LGenBase_TestFinishedNow)}); |
| v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"FinishedFail",refers( f_EPTF_LGenBase_TestFinishedFail)}); |
| v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"checkVarEqual",refers( f_EPTF_LGenBase_checkVarEqualForInt)}); |
| v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"owndispatch",refers( f_EPTF_LGenBase_ownDispatch)}); |
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable( pl_fsm ); |
| v_dummyInt := f_EPTF_LGenBase_declareTrafficCaseType({ |
| "TC1", |
| "fsmtimer0_FSM", |
| "et1", |
| {} |
| }); |
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3( |
| { "SC1", |
| { |
| {"TC1",{ |
| {target := {cpsToReach := 1.0}} |
| } |
| } |
| }, |
| {} |
| }); |
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3( |
| { "SC2", |
| { |
| {"TC1",{ |
| {target := {cpsToReach := 1.0}} |
| } |
| } |
| }, |
| {} |
| }); |
| |
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false); |
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC2"},false); |
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg2","SC2"},false); |
| |
| f_EPTF_LGenBase_dispatchEvent({{v_LGenBase_VarAndStatTest_behav,0,{0,0},omit},{}}); |
| |
| timer T_guard, T_alt; |
| T_guard.start( 100.0 ); |
| T_alt.start( 0.0 ); |
| alt{ |
| [] T_guard.timeout{ |
| setverdict(fail,"Timeout during config"); |
| f_EPTF_Base_stopAll(); |
| } |
| [v_startBecauseDSIsReady] T_alt.timeout{} |
| }; |
| |
| //Send wrong entitygroup name - kene olyan is, ahol maga a nev van elcseszve |
| |
| var boolean vl_varName; |
| |
| var integer vl_retCode := 0; |
| vl_retCode :=f_EPTF_DataSource_getCondition( |
| pl_conditionValue := vl_varName, |
| pl_source := c_LGenBase_DataSource_sourceId, |
| pl_ptcName := "", |
| pl_method := pl_elementName, |
| pl_params := pl_params |
| ); |
| |
| if (0!=vl_retCode) { |
| setverdict(pass, "DataSource query failed as expected with wrong data, dataSource := "&c_LGenBase_DataSource_sourceId& ", element := " & pl_elementName); |
| }else |
| { |
| setverdict(fail, "DataSource query was succesfull but it shouldn't have been with these values , |
| dataSource := "&c_LGenBase_DataSource_sourceId& ", element := " & pl_elementName& ", params := "&log2str(pl_params)); |
| } |
| |
| |
| timer T_g2; |
| T_g2.start( 2.0 ); |
| T_g2.timeout; |
| |
| v_dummyBool := f_EPTF_LGenBase_wait4TestFinished(); |
| f_EPTF_Base_cleanup_CT(); |
| } |
| function EPTF_LGenBase_TestTimerStartOrRestart_logPreamble(in charstring pl_logRow) runs on EPTF_LGenBase_Test_CT |
| { |
| if(-1 != f_strstr(pl_logRow, "Start has been requested for a running FSM timer:")) |
| {setverdict(fail)} |
| } |
| |
| function EPTF_LGenBase_TestTimerCancelIfRunning_logPreamble(in charstring pl_logRow) runs on EPTF_LGenBase_Test_CT |
| { |
| if(-1 != f_strstr(pl_logRow, "Cancelling not running timer")) |
| {setverdict(fail)} |
| } |
| |
| } |
| |
| //========================================================================= |
| // ILog Functions |
| //========================================================================= |
| |
| /////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ILog_Test_msgStep |
| // |
| // Purpose: Message step FSM |
| // |
| // |
| // Parameters: |
| // pl_ptr - *in* <EPTF_LGenBase_TestStepArgs> - arguments list |
| // |
| /////////////////////////////////////////////////////////// |
| function f_EPTF_ILog_Test_msgStep (EPTF_LGenBase_TestStepArgs pl_ptr) |
| runs on EPTF_LGenBase_Test_CT{ |
| action("f_EPTF_ILog_Test_msgStep:",pl_ptr); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Function: f_logHeader_first_short |
| // |
| // Purpose: First Log header for test, short chain |
| // |
| // |
| // Parameters: |
| // pl_chainId - *in* *integer* - chain Id |
| // pl_paramList - *in* <EPTF_IntegerList> - parameters list |
| // |
| /////////////////////////////////////////////////////////// |
| function f_logHeader_first_short( |
| in integer pl_chainId, |
| in EPTF_IntegerList pl_paramList |
| ) |
| runs on EPTF_LGenBase_Test_CT { |
| var charstring vl_chainName := f_EPTF_ILog_getName(pl_chainId); |
| var charstring vl_logStr := "<<[FIRST:short] ILogHeader: "&int2str(pl_chainId)&" - "&vl_chainName&" - "&int2str(pl_paramList[0])&">>"; |
| log(vl_logStr); |
| f_EPTF_ILog_Test_logStr(vl_logStr,0); // LOG STR |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Function: f_logHeader_first_detailed |
| // |
| // Purpose: First Log header for test, detailed chain |
| // |
| // |
| // Parameters: |
| // pl_chainId - *in* *integer* - chain Id |
| // pl_paramList - *in* <EPTF_IntegerList> - parameters list |
| // |
| /////////////////////////////////////////////////////////// |
| function f_logHeader_first_detailed( |
| in integer pl_chainId, |
| in EPTF_IntegerList pl_paramList |
| ) |
| runs on EPTF_LGenBase_Test_CT { |
| var charstring vl_chainName := f_EPTF_ILog_getName(pl_chainId); |
| var charstring vl_logStr := "<<[FIRST:detailed] ILogHeader: "&int2str(pl_chainId)&" - "&vl_chainName&" - "&int2str(pl_paramList[0])&">>"; |
| log(vl_logStr); |
| f_EPTF_ILog_Test_logStr(vl_logStr,0); // LOG STR |
| } |
| |
| |
| /////////////////////////////////////////////////////////// |
| // Function: f_logHeader_second_short |
| // |
| // Purpose: Second Log header for test, short chain |
| // |
| // |
| // Parameters: |
| // pl_chainId - *in* *integer* - chain Id |
| // pl_paramList - *in* <EPTF_IntegerList> - parameters list |
| // |
| /////////////////////////////////////////////////////////// |
| function f_logHeader_second_short( |
| in integer pl_chainId, |
| in EPTF_IntegerList pl_paramList |
| ) |
| runs on EPTF_LGenBase_Test_CT { |
| var charstring vl_chainName := f_EPTF_ILog_getName(pl_chainId); |
| var charstring vl_logStr := "<<[SECOND:short] ILogHeader: "&int2str(pl_chainId)&" - "&vl_chainName&" - "&int2str(pl_paramList[0])&">>"; |
| log(vl_logStr); |
| f_EPTF_ILog_Test_logStr(vl_logStr,1); // LOG STR |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Function: f_logHeader_second_detailed |
| // |
| // Purpose: First Log header for test, detailed chain |
| // |
| // |
| // Parameters: |
| // pl_chainId - *in* *integer* - chain Id |
| // pl_paramList - *in* <EPTF_IntegerList> - parameters list |
| // |
| /////////////////////////////////////////////////////////// |
| function f_logHeader_second_detailed( |
| in integer pl_chainId, |
| in EPTF_IntegerList pl_paramList |
| ) |
| runs on EPTF_LGenBase_Test_CT { |
| var charstring vl_chainName := f_EPTF_ILog_getName(pl_chainId); |
| var charstring vl_logStr := "<<[SECOND:detailed] ILogHeader: "&int2str(pl_chainId)&" - "&vl_chainName&" - "&int2str(pl_paramList[0])&">>"; |
| log(vl_logStr); |
| f_EPTF_ILog_Test_logStr(vl_logStr,1); // LOG STR |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ILog_Test_logItem |
| // |
| // Purpose: |
| // This function logs out the content of a chain. |
| // |
| // Parameters: |
| // pl_elementIdx - *in* *integer* - the index of the log item in the database |
| // pl_dbId - *in* *integer* - the id of the database, which contains the element that is logged out |
| // pl_chainId - *in* *integer* - the id of the chain, which is logged out |
| // pl_paramList - *in* <EPTF_IntegerList> - user defined parameter list |
| // |
| /////////////////////////////////////////////////////////// |
| function f_EPTF_ILog_Test_logItem(in integer pl_elementIdx, in integer pl_dbId, in integer pl_chainId, in EPTF_IntegerList pl_param) |
| runs on EPTF_LGenBase_Test_CT { |
| var integer vl_idxDB := 0; |
| if(pl_dbId != v_EPTF_ILog_Test_logItems_dbIds[0]) {vl_idxDB := 1;} |
| var charstring vl_logStr := "{EPTF_ILog_Test: Event in chain#" & log2str(pl_chainId) & " - " & log2str(pl_dbId) & " [" & log2str(pl_elementIdx) & "]: " & f_EPTF_ILog_getName(pl_chainId) & " (" & log2str(pl_param) & "): " & v_EPTF_ILog_Test_logItems[vl_idxDB][pl_elementIdx] & "}"; |
| action(vl_logStr); |
| f_EPTF_ILog_Test_logStr(vl_logStr,vl_idxDB); // LOG STR |
| |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ILog_Test_adToDB |
| // |
| // Purpose: |
| // This function add data to test DB |
| // |
| // Parameters: |
| // pl_elementIdx - *in* *integer* - the index of the log item in the database |
| // pl_dbId - *in* *integer* - the id of the database, which contains the element that is logged out |
| // |
| /////////////////////////////////////////////////////////// |
| function f_EPTF_ILog_Test_adToDB(in integer pl_elementIdx, in integer pl_dbId) |
| runs on EPTF_LGenBase_Test_CT { |
| if(0 <= pl_elementIdx) { |
| var charstring vl_dbStr := "addToILog[" & int2str(pl_dbId) & ", " & int2str(pl_elementIdx) & "]"; |
| v_EPTF_ILog_Test_logItems[pl_dbId][pl_elementIdx] := vl_dbStr; |
| action("f_EPTF_ILog_Test_adToDB#", vl_dbStr); |
| } |
| } |
| |
| |
| /////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ILog_Test_resetDB |
| // |
| // Purpose: |
| // Reset the test DB |
| // |
| /////////////////////////////////////////////////////////// |
| function f_EPTF_ILog_Test_resetDB() |
| runs on EPTF_LGenBase_Test_CT { |
| v_EPTF_ILog_Test_logItems := {{""}, {""}}; |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ILog_Test_logStr |
| // |
| // Purpose: |
| // Build up the test log string |
| // |
| // Parameters: |
| // pl_elementIdx - *in* *integer* - the index of the log item in the database |
| // pl_dbId - *in* *integer* - the id of the database, which contains the element that is logged out |
| // |
| /////////////////////////////////////////////////////////// |
| function f_EPTF_ILog_Test_logStr(in charstring pl_logStr, in integer pl_dbId) |
| runs on EPTF_LGenBase_Test_CT { |
| v_EPTF_ILog_Test_loggedStr[pl_dbId] := v_EPTF_ILog_Test_loggedStr[pl_dbId] & pl_logStr; |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ILog_Test_resetLog |
| // |
| // Purpose: |
| // Reset the test log string |
| // |
| /////////////////////////////////////////////////////////// |
| function f_EPTF_ILog_Test_resetLog() |
| runs on EPTF_LGenBase_Test_CT { |
| v_EPTF_ILog_Test_loggedStr :={"", ""}; |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ILog_Test_getLogStr |
| // |
| // Purpose: |
| // Get the test log string |
| // |
| // Parameters: |
| // pl_dbId - *in* *integer* - the id of the database, which contains the element that is logged out |
| // |
| /////////////////////////////////////////////////////////// |
| function f_EPTF_ILog_Test_getLogStr(in integer pl_dbId) |
| runs on EPTF_LGenBase_Test_CT |
| return charstring { |
| return (v_EPTF_ILog_Test_loggedStr[pl_dbId]); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Function: f_EPTF_ILog_Test_getCheckChainId |
| // |
| // Purpose: |
| // Get and check the chan Ids |
| // |
| // Parameters: |
| // pl_eAbsIdx - *in* integer - entity absolute index |
| // pl_fsmCtx - *in* integer - FSM ctx index |
| // pl_checkedIdx - *in* integer - checked index |
| // |
| /////////////////////////////////////////////////////////// |
| function f_EPTF_ILog_Test_getCheckChainId( |
| in integer pl_eAbsIdx, |
| in integer pl_fsmCtx, |
| in integer pl_checkedIdx |
| ) |
| runs on EPTF_LGenBase_Test_CT { |
| v_ILog_checkIdx := v_ILog_checkIdx+1; |
| var boolean vl_checkOK := true; |
| // Returns an element of the application data assigned to the FSM context |
| v_dummyInt := f_EPTF_LGenBase_ILog_getChainId(pl_eAbsIdx, pl_fsmCtx, short); |
| vl_checkOK := (pl_checkedIdx == v_dummyInt or pl_checkedIdx+1 == v_dummyInt); |
| action("idx.short[",v_ILog_checkIdx,"]=",v_dummyInt); |
| if(vl_checkOK == true){ |
| v_dummyInt := f_EPTF_LGenBase_ILog_getChainId(pl_eAbsIdx, pl_fsmCtx, detailed); |
| vl_checkOK := (pl_checkedIdx == v_dummyInt or pl_checkedIdx+1 == v_dummyInt); |
| action("idx.detailed[",v_ILog_checkIdx,"]=",v_dummyInt); |
| } |
| if(vl_checkOK == false) { |
| setverdict(fail,"Chain ID error (" & int2str(v_dummyInt) & " expected base " & int2str(pl_checkedIdx) & ")!"); |
| } |
| } |
| |
| |
| |
| }//module |