| /////////////////////////////////////////////////////////////////////////////// |
| // // |
| // Copyright (c) 2000-2018 Ericsson Telecom AB // |
| // // |
| // All rights reserved. This program and the accompanying materials // |
| // are made available under the terms of the Eclipse Public License v2.0 // |
| // which accompanies this distribution, and is available at // |
| // https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html // |
| /////////////////////////////////////////////////////////////////////////////// |
| |
| /////////////////////////////////////////////////////////// |
| // Module: EPTF_LGenBase_Test_Testcases |
| // |
| // Purpose: |
| // This module provides functions for testing LGenBase |
| // |
| // Module depends on: |
| // - |
| // |
| // Current Owner: |
| // Attila Jen� Balask� (ETHBAAT) |
| // |
| // Last Review Date: |
| // - |
| // |
| // Detailed Comments: |
| // Provide definitions to test |
| // |
| // |
| /////////////////////////////////////////////////////////////// |
| |
| //Failed Testcases: |
| // tc_EPTF_LGenBase_Test_reportEvent4Entity_2EventListeners4Entity |
| // tc_EPTF_LGenBase_Test_reportEvent4Fsm |
| // tc_EPTF_LGenBase_Test_dispatchEvent_DuplicatedEventToBeListenedInFsm_fsm |
| // tc_EPTF_LGenBase_Test_dispatchEvent_DuplicatedEventToBeListenedInFsm_entity |
| // tc_EPTF_LGenBase_Test_cpsTest4WeightedScenario |
| // tc_EPTF_LGenBase_Test_cpsTest4WeightedScenario_exp |
| // tc_EPTF_LGenBase_Test_cpsTest4WeightedScenario_entityLimit |
| // tc_EPTF_LGenBase_Test_cpsTest4NotWeightedScenario |
| // tc_EPTF_LGenBase_Test_cpsTest4NotWeightedScenario_searchEntityLimit |
| |
| module EPTF_LGenBase_Test_Testcases |
| { |
| import from EPTF_CLL_Common_Definitions all; |
| import from EPTF_CLL_DataSource_Definitions all; |
| import from EPTF_CLL_DataSource_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_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_LGenBase_Test_Definitions all; |
| import from EPTF_LGenBase_Test_Functions all; |
| import from EPTF_LGenBase_Test_Templates all; |
| import from EPTF_CLL_HashMapStr2Int_Functions all; |
| import from EPTF_CLL_HashMapInt2Int_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_Base_Functions all; |
| //import from EPTF_CLL_LGenBase_ObsoleteConfigDefinitions all; |
| //import from EPTF_CLL_LGenBase_ObsoleteConfigFunctions all; |
| //================ Testcases =============== |
| |
| //======================================== |
| // Name: tc_EPTF_LGenBase_Test_init |
| // Subject: function f_EPTF_LGenBase_init |
| //======================================== |
| //================================= |
| // function f_EPTF_LGenBase_setBurstCalcMode - NotPublic_NotTested |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_setBurstCalcFunctions - NotPublic_NotTested |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_getBurstCalcMode - NotPublic_NotTested |
| //================================== |
| |
| //=============================================== |
| // Name: tc_EPTF_LGenBase_Test_cleanup |
| // Subject: function f_EPTF_Base_cleanup_CT |
| // Status: Ready, Passed TR: MTTSM00016162 resolved |
| //=============================================== |
| //============================================= |
| // Name: tc_EPTF_LGenBase_Test_declareBehaviorType |
| // Subject: function f_EPTF_LGenBase_declareBehaviorType |
| // Status: Ready, passed |
| //============================================= |
| |
| //============================================== |
| // Name: tc_EPTF_LGenBase_Test_declareStep |
| // Subject: function f_EPTF_LGenBase_declareStep |
| // Status: Ready, passed |
| //============================================== |
| |
| //========================================= |
| // Name: tc_EPTF_LGenBase_Test_declareFsmEvent |
| // Subject: function f_EPTF_LGenBase_declareFsmEvent |
| // |
| //========================================= |
| testcase tc_EPTF_LGenBase_Test_declareFsmEvent() runs on EPTF_LGenBase_Test_CT { |
| var charstring vl_bName:=tsp_EPTF_LGenBase_Test_behaviorTypeName; |
| f_EPTF_LGenBase_Test_init(vl_bName, imst2); |
| |
| log("=============== Part 'Declare FsmEvent' starts ============"); |
| var EPTF_LGenBase_FsmEvent vl_input:="TestFsmEvent"; |
| |
| var integer vl_inputIdx:=f_EPTF_LGenBase_declareFsmEvent( |
| pl_bName:=vl_bName, |
| pl_input:= vl_input); |
| |
| log("=============== Part 'Check FsmEvent' starts ============"); |
| //Ambiguous: It would be better a real function test for this: create an event, dispatch it and check the result in a real fsm ???? |
| var integer vl_bIdx :=-1, vl_i:=-1/*, vl_eventListenerHashMapRef :=-1*/; |
| |
| //checks v_LGenBase_fsmEventsBehaviorHashMap |
| var EPTF_LGenBase_ReportableEventDescriptor vl_eventD:= c_EPTF_LGenBase_emptyReportableEventDescriptor |
| vl_eventD.bIdx := v_myBCtxIdx |
| vl_eventD.iIdx:= vl_inputIdx |
| v_dummyInt := f_EPTF_LGenBase_addGenericEventListener( |
| pl_event:= vl_eventD, |
| pl_descr:={ name:="LGenBaseTest:DummyGenericEventListenerFunction", fn:=refers(f_EPTF_LGenBase_Test_DummyGenericEventListener), args:={}} ); |
| //If it passed without assertion, it's OK |
| setverdict ( pass ); |
| f_EPTF_Base_cleanup_CT(); |
| }//tc |
| |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_addGenericEventListener |
| // Subject: function f_EPTF_LGenBase_addGenericEventListener |
| //Description: 1.adds a generic event listener |
| // 2.dispatch the event |
| // 3. checks if the event handler function is called |
| // Remark:check of other event handler is not called - see at test of f_EPTF_LGenBase_dispatchEvent |
| //================================== |
| testcase tc_EPTF_LGenBase_Test_addGenericEventListener() runs on EPTF_LGenBase_Test_CT { |
| var charstring vl_bName:=tsp_EPTF_LGenBase_Test_behaviorTypeName; |
| f_EPTF_LGenBase_Test_init(vl_bName, imst2); |
| |
| log("=============== Part 'Declare FsmEvent' starts ============"); |
| var EPTF_LGenBase_FsmEvent vl_input:="TestFsmEvent"; |
| |
| var integer vl_inputIdx:=f_EPTF_LGenBase_declareFsmEvent( |
| pl_bName:=vl_bName, |
| pl_input:= vl_input); |
| |
| var EPTF_LGenBase_ReportableEventDescriptor vl_eventD:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdx, target:=omit, source := omit}; |
| |
| //add generic eventListener |
| v_dummyInt := f_EPTF_LGenBase_addGenericEventListener( |
| pl_event:= vl_eventD, |
| pl_descr:={ name:="LGenBaseTest:DummyGenericEventListenerFunction", fn:=refers(f_EPTF_LGenBase_Test_DummyGenericEventListener), args:={}} ); |
| |
| //dispatch generic event |
| f_EPTF_LGenBase_dispatchEvent( |
| pl_event:= { |
| event:=vl_eventD, |
| reportedArgs:={} |
| }) |
| |
| //check if the function is called: |
| f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isDummyGenericEventListenerCalled()); |
| f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isDummyEntityEventListenerCalled()==false); |
| |
| f_EPTF_Base_cleanup_CT(); |
| } |
| |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_removeGenericEventListener |
| // function f_EPTF_LGenBase_removeGenericEventListener |
| // Status: Ready, passed. TR:16203 |
| //================================== |
| testcase tc_EPTF_LGenBase_Test_removeGenericEventListener() runs on EPTF_LGenBase_Test_CT { |
| var charstring vl_bName:=tsp_EPTF_LGenBase_Test_behaviorTypeName; |
| f_EPTF_LGenBase_Test_init(vl_bName, imst2); |
| |
| log("=============== Part 'Declare FsmEvent' starts ============"); |
| var EPTF_LGenBase_FsmEvent vl_input:="TestFsmEvent"; |
| |
| var integer vl_inputIdx:=f_EPTF_LGenBase_declareFsmEvent( |
| pl_bName:=vl_bName, |
| pl_input:= vl_input); |
| |
| var EPTF_LGenBase_ReportableEventDescriptor vl_eventD:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdx, target:=omit, source := omit}; |
| //add generic eventListener |
| var integer vl_idxAdded:= f_EPTF_LGenBase_addGenericEventListener( |
| pl_event:=vl_eventD, |
| pl_descr:={ name:="LGenBaseTest:DummyGenericEventListenerFunction", fn:=refers(f_EPTF_LGenBase_Test_DummyGenericEventListener), args:={}} ); |
| |
| //dispatch generic event |
| f_EPTF_LGenBase_dispatchEvent( |
| pl_event:= { |
| event:=vl_eventD, |
| reportedArgs:={} |
| }) |
| |
| //check if the function is called: |
| f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isDummyGenericEventListenerCalled()); |
| f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isDummyEntityEventListenerCalled()==false); |
| |
| f_EPTF_LGenBase_removeGenericEventListener( |
| pl_bIdx:=v_myBCtxIdx, pl_iIdx:= vl_inputIdx, pl_idx2Remove:= vl_idxAdded) |
| |
| //try to dispatch/trigger the removed eventListener: |
| f_EPTF_LGenBase_Test_resetDummyGenericEventListenerCalled(); |
| f_EPTF_LGenBase_Test_resetDummyEntityEventListenerCalled(); |
| |
| f_EPTF_LGenBase_dispatchEvent( |
| pl_event:= { |
| event:=vl_eventD, |
| reportedArgs:={} |
| }) |
| f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isDummyGenericEventListenerCalled()==false); |
| f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isDummyEntityEventListenerCalled()==false); |
| |
| f_EPTF_Base_cleanup_CT(); |
| } |
| |
| |
| //================================================ |
| // Name: tc_EPTF_LGenBase_Test_addEntityEventListener |
| // Subject: f_EPTF_LGenBase_addEntityEventListener |
| // State: Ready, passed |
| //================================================ |
| testcase tc_EPTF_LGenBase_Test_addEntityEventListener() runs on EPTF_LGenBase_Test_CT { |
| var charstring vl_bName:=tsp_EPTF_LGenBase_Test_behaviorTypeName; |
| f_EPTF_LGenBase_Test_init(vl_bName, imst2); |
| |
| log("=============== Part 'Declare FsmEvent' starts ============"); |
| var EPTF_LGenBase_FsmEvent vl_input:="TestFsmEvent"; |
| |
| var integer vl_inputIdx:=f_EPTF_LGenBase_declareFsmEvent( |
| pl_bName:=vl_bName, |
| pl_input:= vl_input); |
| |
| var integer vl_myEntityIdx := 0; |
| var EPTF_LGenBase_ReportableEventDescriptor vl_eventD:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdx, target:={vl_myEntityIdx, omit}, source := omit} |
| //add entity eventListener |
| v_dummyInt := f_EPTF_LGenBase_addEntityEventListener( |
| pl_event:= vl_eventD, |
| pl_descr:={ name:="LGenBaseTest:DummyEntityEventListenerFunction", fn:=refers(f_EPTF_LGenBase_Test_DummyEntityEventListener), args:={}} ); |
| |
| //dispatch generic event |
| f_EPTF_LGenBase_dispatchEvent( |
| pl_event:= { |
| event:= vl_eventD, |
| reportedArgs:={} |
| }) |
| |
| //check if the function is called: |
| f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isDummyGenericEventListenerCalled()==false); |
| f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isDummyEntityEventListenerCalled()); |
| |
| f_EPTF_Base_cleanup_CT(); |
| } |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_removeEntityEventListener |
| // Subject: function f_EPTF_LGenBase_removeEntityEventListener |
| // State: Ready, Passed |
| //================================== |
| testcase tc_EPTF_LGenBase_Test_removeEntityEventListener() runs on EPTF_LGenBase_Test_CT { |
| var charstring vl_bName:=tsp_EPTF_LGenBase_Test_behaviorTypeName; |
| f_EPTF_LGenBase_Test_init(vl_bName, imst2); |
| |
| log("=============== Part 'Declare FsmEvent' starts ============"); |
| var EPTF_LGenBase_FsmEvent vl_input:="TestFsmEvent"; |
| |
| var integer vl_inputIdx:=f_EPTF_LGenBase_declareFsmEvent( |
| pl_bName:=vl_bName, |
| pl_input:= vl_input); |
| |
| var integer vl_myEntityIdx := 0; |
| var EPTF_LGenBase_ReportableEventDescriptor vl_eventD:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdx, target:= {vl_myEntityIdx, omit}, source := omit}; |
| //add generic eventListener |
| var integer vl_eIdxAdded:= f_EPTF_LGenBase_addEntityEventListener( |
| pl_event:=vl_eventD, |
| pl_descr:={ name:="LGenBaseTest:DummyEntityEventListenerFunction", fn:=refers(f_EPTF_LGenBase_Test_DummyEntityEventListener), args:={}} ); |
| |
| //dispatch entity event |
| f_EPTF_LGenBase_dispatchEvent( |
| pl_event:= { |
| event:=vl_eventD, |
| reportedArgs:={} |
| }); |
| |
| //check if the function is called: |
| f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isDummyGenericEventListenerCalled()==false); |
| f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isDummyEntityEventListenerCalled()); |
| |
| f_EPTF_LGenBase_removeEntityEventListener( |
| pl_bIdx:=v_myBCtxIdx, pl_iIdx:= vl_inputIdx, pl_eIdx:= vl_eIdxAdded); |
| |
| //try to dispatch/trigger the removed eventListener: |
| f_EPTF_LGenBase_Test_resetDummyGenericEventListenerCalled(); |
| f_EPTF_LGenBase_Test_resetDummyEntityEventListenerCalled(); |
| |
| f_EPTF_LGenBase_dispatchEvent( |
| pl_event:= { |
| event:=vl_eventD, |
| reportedArgs:={} |
| }) |
| f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isDummyGenericEventListenerCalled()==false); |
| f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isDummyEntityEventListenerCalled()==false); |
| |
| f_EPTF_Base_cleanup_CT(); |
| } |
| |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_declareCompactFsmTable |
| // Subject: f_EPTF_LGenBase_declareCompactFsmTable |
| // Status: Ready, passed |
| //================================== |
| // |
| |
| testcase tc_EPTF_LGenBase_Test_declareCompactFsmTable() runs on EPTF_LGenBase_Test_CT { |
| var charstring vl_bName:=tsp_EPTF_LGenBase_Test_behaviorTypeName; |
| f_EPTF_LGenBase_Test_init(vl_bName, imst2); |
| |
| 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.1},{"Timer2", 2.0},{"Timer2", 2.0}}, |
| table := { |
| { |
| eventToListen:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdx1, eventType:= fsm}, |
| cellRow:= { |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy1),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| }, |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy2),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| } |
| } |
| } |
| } |
| } |
| |
| var integer vl_tIdx := f_EPTF_LGenBase_declareCompactFsmTable(vl_fsmTable); |
| setverdict(pass) |
| f_EPTF_Base_cleanup_CT(); |
| }//tc_ |
| |
| |
| /* |
| //================================= |
| // function f_EPTF_LGenBase_fsmTimerIdx - NotPublic_NotTested |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_declareParamedFsmTable -- Not Planned to Test Yet |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_TcMgmt_declareCompactFsmTables -- Not Planned to Test Yet |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_TcMgmt_declareIndexedFsmTables -- Not Planned to Test Yet |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_TcMgmt_declareEntityGroups -- Not Planned to Test Yet |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_TcMgmt_declareTrafficCases -- Not Planned to Test Yet |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_TcMgmt_declareScenarios -- Not Planned to Test Yet |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_TcMgmt_createScenarios2EntityGroup -- Not Planned to Test Yet |
| //================================== |
| //================================================================== |
| // function f_EPTF_LGenBase_declareEntityTypes - Obsolete, removed |
| //=================================================================== |
| */ |
| |
| |
| //================================================================== |
| //Name: tc_EPTF_LGenBase_Test_declareIndexedCompactFsmTable |
| //Subject: f_EPTF_LGenBase_declareIndexedCompactFsmTable |
| //Status: Passed, ready |
| //=================================================================== |
| //FIXME depends on internal structure |
| testcase tc_EPTF_LGenBase_Test_declareIndexedCompactFsmTable() runs on EPTF_LGenBase_Test_CT { |
| var charstring vl_bName:=tsp_EPTF_LGenBase_Test_behaviorTypeName; |
| f_EPTF_LGenBase_Test_init(vl_bName, imst2); |
| |
| 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_TestStepDescriptor vl_testStep1:= |
| { name:="f_EPTF_LGenBase_Test_step_Dummy1",step:= refers(f_EPTF_LGenBase_Test_step_Dummy1)}; |
| var EPTF_LGenBase_TestStepDescriptor vl_testStep2:= |
| { name:="f_EPTF_LGenBase_Test_step_Dummy2",step:= refers(f_EPTF_LGenBase_Test_step_Dummy2)}; |
| |
| var integer vl_testStepIndex1:=f_EPTF_LGenBase_declareStep(vl_bName,vl_testStep1 ); |
| var integer vl_testStepIndex2:=f_EPTF_LGenBase_declareStep(vl_bName,vl_testStep2 ); |
| |
| var EPTF_LGenBase_IndexedCompactFsmTable vl_fsmICTable:= { |
| name:= "TestCompactFsmTable", |
| stateList:= {"idle", "busy"}, |
| timerList:= { {"Timer1",0.1},{"Timer2", 2.0},{"Timer2", 2.0}}, |
| table := { |
| { |
| eventToListen:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdx1, eventType:= fsm}, |
| cellRow := { |
| //idle |
| { |
| actionList :={ |
| {step:={v_myBCtxIdx,vl_testStepIndex1},stepContextArgs:={}}, |
| {step:={v_myBCtxIdx,vl_testStepIndex2},stepContextArgs:={}} |
| }, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| }, |
| //busy |
| { |
| actionList :={ |
| {step:={v_myBCtxIdx,vl_testStepIndex2},stepContextArgs:={}}, |
| {step:={v_myBCtxIdx,vl_testStepIndex1},stepContextArgs:={}} |
| }, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| } |
| } |
| } |
| }//table |
| }//vl_fsmICTable |
| |
| var EPTF_LGenBase_CompactFsmTable vl_fsmCTable :={ |
| name:= "TestCompactFsmTable2", |
| stateList:= {"idle", "busy"}, |
| timerList:= { {"Timer1",0.1},{"Timer2", 2.0},{"Timer2", 2.0}}, |
| table := { |
| { |
| eventToListen := { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdx1, eventType:= fsm}, |
| cellRow:= { |
| //idle |
| { |
| actionList :={ |
| { step:= refers(f_EPTF_LGenBase_Test_step_Dummy1),stepContextArgs:={}}, |
| { step:= refers(f_EPTF_LGenBase_Test_step_Dummy2),stepContextArgs:={}} |
| }, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| }, |
| //busy |
| { |
| actionList :={ |
| { step:= refers(f_EPTF_LGenBase_Test_step_Dummy2),stepContextArgs:={}}, |
| { step:= refers(f_EPTF_LGenBase_Test_step_Dummy1),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| } |
| } |
| } |
| } |
| } |
| var integer vl_tIdx := f_EPTF_LGenBase_declareIndexedCompactFsmTable(vl_fsmICTable); |
| var integer vl_tCIdx := f_EPTF_LGenBase_declareCompactFsmTable(vl_fsmCTable); |
| setverdict(pass) |
| f_EPTF_Base_cleanup_CT(); |
| //f_EPTF_Base_registerCleanup(refers(f_EPTF_Base_cleanup_CT)); |
| } |
| |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_declareEntityType |
| // Subject: f_EPTF_LGenBase_declareEntityType |
| // State: Ready, passed |
| //================================== |
| testcase tc_EPTF_LGenBase_Test_declareEntityType() 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:= imst2); |
| const integer c_maxCountB1 := 3 |
| const integer c_maxCountB2 := 4 |
| const charstring c_bName1 := "TestBehavior1" |
| const charstring c_bName2 := "TestBehavior2" |
| var integer vl_myBCtxIdx1:=f_EPTF_LGenBase_declareBehaviorType( |
| pl_name:= c_bName1, |
| pl_maxCount:= c_maxCountB1, |
| pl_resetFn := refers(f_EPTF_LGenBase_Test_contextReset), |
| pl_bindFn := refers(f_EPTF_LGenBase_Test_contextBind), |
| pl_unbindFn:= refers(f_EPTF_LGenBase_Test_contextUnbind)); |
| |
| var integer vl_myBCtxIdx2:=f_EPTF_LGenBase_declareBehaviorType( |
| pl_name:= c_bName2, |
| pl_maxCount:= c_maxCountB2, |
| pl_resetFn := refers(f_EPTF_LGenBase_Test_contextReset), |
| pl_bindFn := refers(f_EPTF_LGenBase_Test_contextBind), |
| pl_unbindFn:= refers(f_EPTF_LGenBase_Test_contextUnbind)); |
| |
| //===Create===== |
| const charstring c_eTypeName := "TestEntityType" |
| var integer vl_etIdx:= f_EPTF_LGenBase_declareEntityType( |
| pl_name:=c_eTypeName, |
| pl_behaviorTypeList:= {c_bName1,c_bName2}); |
| |
| //====Check===== |
| //log("EntityTypes:", v_LGenBase_entityTypes); |
| //log("Declared entity Type:", f_EPTF_LGenBase_Test_getEntityType(vl_etIdx)); |
| if( match( f_EPTF_LGenBase_getETypeName(vl_etIdx), c_eTypeName )){ |
| setverdict ( pass ) |
| }else{ |
| setverdict ( fail, log2str(match( f_EPTF_LGenBase_getETypeName(vl_etIdx), c_eTypeName ))) |
| } |
| //The maximal count must be the less of the max count of the behaviors |
| if( match( f_EPTF_LGenBase_getETypeMaxCountByName(c_eTypeName), c_maxCountB1 )){ |
| setverdict ( pass ) |
| }else{ |
| setverdict ( fail, log2str(match( f_EPTF_LGenBase_getETypeMaxCountByName(c_eTypeName), c_maxCountB1 ))) |
| } |
| |
| //Once more: |
| vl_etIdx:= f_EPTF_LGenBase_declareEntityType( |
| pl_name:="TestEntityType2", |
| pl_behaviorTypeList:= {c_bName2}); |
| |
| //====Check===== |
| const charstring c_eTypeName2 := "TestEntityType2" |
| if( match( f_EPTF_LGenBase_getETypeName(vl_etIdx), c_eTypeName2 )){ |
| setverdict ( pass ) |
| }else{ |
| setverdict ( fail, log2str( match( f_EPTF_LGenBase_getETypeMaxCountByName(c_eTypeName2), c_maxCountB2 ))) |
| } |
| |
| f_EPTF_Base_cleanup_CT(); |
| //f_EPTF_Base_registerCleanup(refers(f_EPTF_Base_cleanup_CT)); |
| }//tc_ |
| |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_entityTypeNameIndex |
| // Subject: f_EPTF_LGenBase_entityTypeNameIndex |
| // State: Ready, passed |
| //================================== |
| testcase tc_EPTF_LGenBase_Test_entityTypeNameIndex() 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:= imst2); |
| |
| var integer vl_myBCtxIdx1:=f_EPTF_LGenBase_declareBehaviorType( |
| pl_name:= tsp_EPTF_LGenBase_Test_behaviorTypeName&"_1", |
| pl_maxCount:= 3, |
| pl_resetFn := refers(f_EPTF_LGenBase_Test_contextReset), |
| pl_bindFn := refers(f_EPTF_LGenBase_Test_contextBind), |
| pl_unbindFn:= refers(f_EPTF_LGenBase_Test_contextUnbind)); |
| |
| var integer vl_myBCtxIdx2:=f_EPTF_LGenBase_declareBehaviorType( |
| pl_name:= tsp_EPTF_LGenBase_Test_behaviorTypeName&"_2", |
| pl_maxCount:= 4, |
| pl_resetFn := refers(f_EPTF_LGenBase_Test_contextReset), |
| pl_bindFn := refers(f_EPTF_LGenBase_Test_contextBind), |
| pl_unbindFn:= refers(f_EPTF_LGenBase_Test_contextUnbind)); |
| |
| //===Create===== |
| var integer vl_etIdx1:= f_EPTF_LGenBase_declareEntityType( |
| pl_name:="TestEntityType1", |
| pl_behaviorTypeList:= {tsp_EPTF_LGenBase_Test_behaviorTypeName&"_1",tsp_EPTF_LGenBase_Test_behaviorTypeName&"_2"}); |
| |
| var integer vl_etIdx2:= f_EPTF_LGenBase_declareEntityType( |
| pl_name:="TestEntityType2", |
| pl_behaviorTypeList:= {tsp_EPTF_LGenBase_Test_behaviorTypeName&"_1",tsp_EPTF_LGenBase_Test_behaviorTypeName&"_2"}); |
| |
| var integer vl_etIdx3:= f_EPTF_LGenBase_declareEntityType( |
| pl_name:="TestEntityType3", |
| pl_behaviorTypeList:= {tsp_EPTF_LGenBase_Test_behaviorTypeName&"_1",tsp_EPTF_LGenBase_Test_behaviorTypeName&"_2"}); |
| |
| f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_entityTypeNameIndex("TestEntityType2")==vl_etIdx2); |
| f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_entityTypeNameIndex("TestEntityType1")==vl_etIdx1); |
| f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_entityTypeNameIndex("TestEntityType3")==vl_etIdx3); |
| |
| f_EPTF_Base_cleanup_CT(); |
| //f_EPTF_Base_registerCleanup(refers(f_EPTF_Base_cleanup_CT)); |
| }//tc_ |
| |
| |
| //================================= |
| // function f_EPTF_LGenBase_initEntityCtxs -- not planned, internal function |
| // see at f_EPTF_LGenBase_createEntityGroup |
| //================================== |
| |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_createEntityGroup |
| // Subject: f_EPTF_LGenBase_createEntityGroup |
| // Status: Ready, Passed |
| //================================== |
| |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_entityGrpNameIndex |
| // Subject: f_EPTF_LGenBase_entityGrpNameIndex |
| // Status: Ready, Passed |
| //================================== |
| testcase tc_EPTF_LGenBase_Test_entityGrpNameIndex() runs on EPTF_LGenBase_Test_CT { |
| |
| 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:= 50, |
| pl_resetFn := refers(f_EPTF_LGenBase_Test_contextReset), |
| pl_bindFn := refers(f_EPTF_LGenBase_Test_contextBind), |
| pl_unbindFn:= refers(f_EPTF_LGenBase_Test_contextUnbind)); |
| |
| var integer vl_myBCtxIdx2:=f_EPTF_LGenBase_declareBehaviorType( |
| pl_name:= tsp_EPTF_LGenBase_Test_behaviorTypeName&"_2", |
| pl_maxCount:= 70, |
| pl_resetFn := null, |
| pl_bindFn := null, |
| pl_unbindFn:= null) |
| |
| var integer vl_myBCtxIdx3:=f_EPTF_LGenBase_declareBehaviorType( |
| pl_name:= tsp_EPTF_LGenBase_Test_behaviorTypeName&"_3", |
| pl_maxCount:= 60, |
| pl_resetFn := null, |
| pl_bindFn := null, |
| pl_unbindFn:= null) |
| |
| |
| 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_eg1:={ name:="TestEntityGroup1",eType:="TestEntityType",eCount:=6 }, |
| vl_eg2:={ name:="TestEntityGroup2",eType:="TestEntityType",eCount:=3 }, |
| vl_eg3:={ name:="TestEntityGroup3",eType:="TestEntityType",eCount:=20 }; |
| |
| //Create groups |
| var integer vl_eOffs:=-1, vl_egOffs1:=0, |
| vl_egOffs2:=f_EPTF_LGenBase_createEntityGroup(vl_eg1)+vl_egOffs1, |
| vl_egOffs3:=f_EPTF_LGenBase_createEntityGroup(vl_eg2)+vl_egOffs2, |
| vl_egOffs4:=f_EPTF_LGenBase_createEntityGroup(vl_eg3)+vl_egOffs3; |
| |
| //===Check=== |
| f_EPTF_LGenBase_Test_setVerdictFromBool(f_EPTF_LGenBase_entityGrpNameIndex("TestEntityGroup3")==2); |
| f_EPTF_LGenBase_Test_setVerdictFromBool(f_EPTF_LGenBase_entityGrpNameIndex("TestEntityGroup1")==0); |
| f_EPTF_LGenBase_Test_setVerdictFromBool(f_EPTF_LGenBase_entityGrpNameIndex("TestEntityGroup2")==1); |
| |
| f_EPTF_Base_cleanup_CT(); |
| } |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_removeEntityGroup |
| // Subject: f_EPTF_LGenBase_removeEntityGroup |
| // Status: Ready, Passed |
| //================================== |
| |
| //================================= |
| // function f_EPTF_LGenBase_removeEntityGroupByIdx --see tc_EPTF_LGenBase_Test_removeEntityGroup |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_addConvertedTcGroupFinishActions --not planned, internal f. |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_convertTcEntityFinishActions --not planned, internal f. |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_setGroupFinishConditions |
| //================================== |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_setGroupFinishConditions_empty |
| // Subject: f_EPTF_LGenBase_setGroupFinishConditions |
| // Description: |
| // |
| // Status: Ready, passed |
| //================================== |
| //They are internal functions, shouldn't be tested |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_setGroupFinishConditions_emptyStr4CustomFinishCondition |
| // Subject: f_EPTF_LGenBase_setGroupFinishConditions |
| // Description: |
| // |
| // Status: Ready, Passed, TR:MTTSM00016626 solved |
| //================================== |
| |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_setGroupFinishConditions_notEmptyFinishConditions |
| // Subject: f_EPTF_LGenBase_setGroupFinishConditions |
| // Description: |
| // |
| // Status: Ready |
| //================================== |
| |
| //================================= |
| // function f_EPTF_LGenBase_setEntityFinishConditions . |
| //================================== |
| |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_setEntityFinishConditions_empty |
| // Subject: f_EPTF_LGenBase_setEntityFinishConditions |
| // Description: - |
| // |
| // Status: Ready, Passed |
| //================================== |
| |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_setEntityFinishConditions_emptyStr4CustomFinishCondition |
| // Subject: f_EPTF_LGenBase_setEntityFinishConditions |
| // Description: |
| // |
| // Status: Ready, Passed, TR:MTTSM00016627 solved |
| //================================== |
| |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_setEntityFinishConditions_notEmptyFinishConditions |
| // Subject: f_EPTF_LGenBase_setEntityFinishConditions |
| // Description: |
| // |
| // Status: Ready |
| //================================== |
| |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_declareTcType |
| // Subject: f_EPTF_LGenBase_declareTcType -- perhaps obsolete???? |
| // State: Ready, passed |
| //================================== |
| |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_declareScenarioType |
| // Subject: f_EPTF_LGenBase_declareScenarioType |
| // State: Ready, Failed, TR:16374 |
| //================================== |
| |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_declareTcType2 |
| // Subject: f_EPTF_LGenBase_declareTcType2 |
| // State: Ready, passed |
| //================================== |
| |
| //================================= |
| // function f_EPTF_LGenBase_filltcType2 --internal function, tested by tc_EPTF_LGenBase_Test_declareTcType2 |
| //================================== |
| |
| |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_declareScenarioType2 |
| // Subject: f_EPTF_LGenBase_declareScenarioType2 |
| // State: Ready, passed |
| //================================== |
| |
| // commented - f_EPTF_LGenBase_convertTcMgmtEntityFinishConditions2Internal is private |
| /*testcase tc_EPTF_LGenBase_Test_declareScenarioType2() runs on EPTF_LGenBase_Test_CT { |
| var EPTF_LGenBase_EntityGroup vl_expectedEG:=f_EPTF_LGenBase_Test_createEntityGroup(); |
| v_dummyInt := f_EPTF_LGenBase_declareFunction("evalSuccess2",{evaluateSuccess4EntityAtEntityGroup2 := refers(f_LGenBase_Test_evalSuccess2) }); |
| v_dummyInt := f_EPTF_LGenBase_Test_declareCompactFsmTable(); |
| var EPTF_LGenBase_TcMgmt_tcCustomParamDeclaratorList vl_params:={{"A","P","V"}}; |
| var charstring vl_tcTypeName := "TrafficCaseName"; |
| var EPTF_LGenBase_TcMgmt_tcTypeDeclarator2 vl_tcTypeDecl := { |
| name:=vl_tcTypeName, |
| fsmName := "TestCompactFsmTable", |
| entityType := "TestEntityType", |
| customEntitySucc := "evalSuccess2" |
| } |
| var integer vl_tcIdx:=f_EPTF_LGenBase_declareTcType2(vl_tcTypeDecl); |
| log("TC: ",f_LGenBase_Test_getTrafficCaseType(vl_tcIdx)); |
| |
| //Scenario dependent TC information part: |
| var EPTF_LGenBase_TcMgmt_TcOfScenario2 vl_tcOfSc:= f_LGenBase_Test_createTcOfSc2(vl_tcTypeName); |
| |
| var EPTF_LGenBase_TcMgmt_ScenarioDeclarator2 vl_sc := { |
| name:="Sc1", |
| tcList := { vl_tcOfSc} |
| } |
| var integer vl_scIdx:=f_EPTF_LGenBase_declareScenarioType2( vl_sc); |
| log(" Scenario Type created: ", f_LGenBase_Test_getScenarioType(vl_scIdx)); |
| |
| //==Check=== |
| var template EPTF_LGenBase_ScenarioType tr_expectedSc := c_EPTF_LGenBase_emptyScenarioType; |
| tr_expectedSc.name:="Sc1"; |
| tr_expectedSc.enabled:=true; |
| //cpsToReach:=omit, |
| //lockCPS:=omit, |
| //tr_expectedSc.phaseList := omit, |
| //tr_expectedSc.weightedScData:=omit, |
| tr_expectedSc.tcList[0] := c_EPTF_LGenBase_emptyTcOfScenarioInternalDeclarator; |
| tr_expectedSc.tcList[0].tcTypeName := v_LGenBase_trafficCaseTypes[vl_tcIdx].name |
| tr_expectedSc.tcList[0].tcPrivateName := v_LGenBase_trafficCaseTypes[vl_tcIdx].name |
| tr_expectedSc.tcList[0].startDelay := vl_tcOfSc.startDelay; |
| tr_expectedSc.tcList[0].target := { |
| cpsToReach := vl_tcOfSc.cpsToReach |
| }; |
| //scheduler := omit, |
| tr_expectedSc.tcList[0].enableEntities := vl_tcOfSc.enableEntities; |
| tr_expectedSc.tcList[0].enable := vl_tcOfSc.enable; |
| tr_expectedSc.tcList[0].ranges := vl_tcOfSc.ranges; |
| tr_expectedSc.tcList[0].params := vl_params; |
| var EPTF_LGenBase_TrafficStartFinishConditionsInternalDeclarator vl_sfc; |
| var EPTF_LGenBase_TcMgmt_GroupActionsList vl_tfa := {}; |
| f_EPTF_LGenBase_convertTcMgmtGroupFinishConditions22Internal( |
| vl_tcOfSc.groupFinishConditions, |
| vl_tcOfSc.tcFinishActions, |
| vl_sfc, |
| vl_tfa) |
| tr_expectedSc.tcList[0].trafficStartFinishConditionsAndActions := vl_sfc |
| tr_expectedSc.tcList[0].trafficFinishedActions := vl_tfa |
| var EPTF_LGenBase_EntityFinishConditionsInternalDeclarator vl_ec |
| f_EPTF_LGenBase_convertTcMgmtEntityFinishConditions2Internal( |
| vl_tcOfSc.entityFinishConditions, |
| vl_ec) |
| tr_expectedSc.tcList[0].entityFinishConditions := vl_ec |
| tr_expectedSc.tcList[0].entityFinishActions := vl_tcOfSc.entityFinishActions; |
| //templateSetIdx := -1 |
| |
| if( match(f_LGenBase_Test_getScenarioType(vl_scIdx),tr_expectedSc)) |
| { |
| setverdict(pass); |
| } else |
| { |
| log(f_LGenBase_Test_getScenarioType(vl_scIdx),tr_expectedSc); |
| log(match(f_LGenBase_Test_getScenarioType(vl_scIdx),tr_expectedSc)); |
| setverdict(fail); |
| } |
| |
| f_EPTF_Base_cleanup_CT(); |
| }//tc_ |
| */ |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_declareWeightedScenarioType |
| // Subject: f_EPTF_LGenBase_declareWeightedScenarioType |
| // State: Ready, passed |
| //================================== |
| // commented - f_EPTF_LGenBase_convertTcMgmtEntityFinishConditions2Internal is private |
| /*testcase tc_EPTF_LGenBase_Test_declareWeightedScenarioType() runs on EPTF_LGenBase_Test_CT { |
| var EPTF_LGenBase_EntityGroup vl_expectedEG:=f_EPTF_LGenBase_Test_createEntityGroup(); |
| v_dummyInt := f_EPTF_LGenBase_declareFunction("evalSuccess2",{evaluateSuccess4EntityAtEntityGroup2 := refers(f_LGenBase_Test_evalSuccess2) }); |
| var integer vl_fsmIdx := f_EPTF_LGenBase_Test_declareCompactFsmTable(); |
| var EPTF_LGenBase_TcMgmt_tcCustomParamDeclaratorList vl_params:={{"A","P","V"}}; |
| var charstring vl_tcTypeName := tsp_tcTypeName; |
| var EPTF_LGenBase_TcMgmt_tcTypeDeclarator2 vl_tcTypeDecl := { |
| name:=vl_tcTypeName, |
| fsmName := "TestCompactFsmTable", |
| entityType := "TestEntityType", |
| customEntitySucc := "evalSuccess2" |
| } |
| var integer vl_tcIdx:=f_EPTF_LGenBase_declareTcType2(vl_tcTypeDecl); |
| log("TC: ",f_LGenBase_Test_getTrafficCaseType(vl_tcIdx)); |
| |
| var EPTF_LGenBase_TcMgmt_TcOfWeightedScenario vl_tcOfSc:= tsp_tcOfSc; |
| var EPTF_LGenBase_TcMgmt_WeightedScenarioDeclarator vl_sc:= { |
| name:="Sc1", |
| enabled:=false, |
| cpsToReach:=1000.0, |
| lockCPS:= true, |
| weightedScData:={deterministicMix:=false}, |
| tcList := { vl_tcOfSc} |
| } |
| var integer vl_scIdx:=f_EPTF_LGenBase_declareWeightedScenarioType( vl_sc); |
| log(" Scenario Type created: ", f_LGenBase_Test_getScenarioType(vl_scIdx) ); |
| |
| //==Check=== |
| var template EPTF_LGenBase_ScenarioType tr_expectedSc := c_EPTF_LGenBase_emptyScenarioType; |
| tr_expectedSc.name:="Sc1"; |
| tr_expectedSc.enabled:=vl_sc.enabled; |
| //cpsToReach:=vl_sc.cpsToReach; |
| //lockCPS:=vl_sc.lockCPS; |
| //phaseList := omit; |
| //weightedScData:=omit; //vl_sc.weightedScData; |
| tr_expectedSc.tcList[0] := c_EPTF_LGenBase_emptyTcOfScenarioInternalDeclarator; |
| tr_expectedSc.tcList[0].tcTypeName := v_LGenBase_trafficCaseTypes[vl_tcIdx].name |
| tr_expectedSc.tcList[0].tcPrivateName := v_LGenBase_trafficCaseTypes[vl_tcIdx].name |
| //startDelay := omit; |
| tr_expectedSc.tcList[0].target := { trafficWeight:= vl_tcOfSc.tcWeight}; |
| //scheduler := omit; |
| tr_expectedSc.tcList[0].enableEntities := vl_tcOfSc.enableEntities; |
| tr_expectedSc.tcList[0].enable := vl_tcOfSc.enable; |
| tr_expectedSc.tcList[0].ranges := vl_tcOfSc.ranges; |
| tr_expectedSc.tcList[0].params := vl_params; |
| var EPTF_LGenBase_TrafficStartFinishConditionsInternalDeclarator vl_sfc; |
| var EPTF_LGenBase_TcMgmt_GroupActionsList vl_tfa := {}; |
| f_EPTF_LGenBase_convertTcMgmtGroupFinishConditions22Internal( |
| vl_tcOfSc.groupFinishConditions, |
| vl_tcOfSc.tcFinishActions, |
| vl_sfc, |
| vl_tfa) |
| tr_expectedSc.tcList[0].trafficStartFinishConditionsAndActions := vl_sfc |
| tr_expectedSc.tcList[0].trafficFinishedActions := vl_tfa |
| var EPTF_LGenBase_EntityFinishConditionsInternalDeclarator vl_ec |
| f_EPTF_LGenBase_convertTcMgmtEntityFinishConditions2Internal( |
| vl_tcOfSc.entityFinishConditions, |
| vl_ec) |
| tr_expectedSc.tcList[0].entityFinishConditions := vl_ec |
| tr_expectedSc.tcList[0].entityFinishActions := vl_tcOfSc.entityFinishActions; |
| //templateSetIdx := -1 |
| tr_expectedSc.weightedScData := c_EPTF_LGenBase_emptyWeightedScData; |
| tr_expectedSc.weightedScData.cpsToReach := 1000.0; |
| tr_expectedSc.weightedScData.lockCPS := true; |
| tr_expectedSc.weightedScData.deterministicMix := false; |
| tr_expectedSc.weightedScData.scheduler.preDefinedName := cs; |
| log(tr_expectedSc) |
| log(f_LGenBase_Test_getScenarioType(vl_scIdx)) |
| if( match(f_LGenBase_Test_getScenarioType(vl_scIdx),tr_expectedSc)) |
| { |
| setverdict(pass); |
| } else |
| { |
| log(f_LGenBase_Test_getScenarioType(vl_scIdx),tr_expectedSc); |
| log(match(f_LGenBase_Test_getScenarioType(vl_scIdx),tr_expectedSc)); |
| setverdict(fail); |
| } |
| |
| f_EPTF_Base_cleanup_CT(); |
| }//tc_ |
| */ |
| //================================= |
| // function f_EPTF_LGenBase_getEnabledWeightListFromScenario - internal, not planned to test |
| //================================== |
| |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_createScenario2EntityGroup_AutoStartOff |
| // Subject: f_EPTF_LGenBase_createScenario2EntityGroup |
| // Status: Ready |
| //================================== |
| testcase tc_EPTF_LGenBase_Test_createScenario2EntityGroup_AutoStartOff() runs on EPTF_LGenBase_Test_CT { |
| var integer vl_eGroupIdx:=0; |
| //=== Prepare === |
| var EPTF_LGenBase_EntityGroup vl_expectedEG:= f_EPTF_LGenBase_Test_createEntityGroup(); |
| v_dummyInt := f_EPTF_LGenBase_declareFunction("evalSuccess2",{evaluateSuccess4EntityAtEntityGroup2 := refers(f_LGenBase_Test_evalSuccess2) }); |
| var integer vl_fsmIdx := f_EPTF_LGenBase_Test_declareCompactFsmTable(); |
| var charstring vl_tcTypeName := "TrafficCaseName"; |
| var EPTF_LGenBase_TcMgmt_tcTypeDeclarator2 vl_tcTypeDecl := { |
| name:=vl_tcTypeName, |
| fsmName := "TestCompactFsmTable", |
| entityType := "TestEntityType", |
| customEntitySucc := "evalSuccess2" |
| } |
| var integer vl_tcIdx:=f_EPTF_LGenBase_declareTcType2(vl_tcTypeDecl); |
| |
| var EPTF_LGenBase_TcMgmt_TcOfScenario2 vl_tcOfSc:= f_LGenBase_Test_createTcOfSc2(vl_tcTypeName); |
| |
| var EPTF_LGenBase_TcMgmt_ScenarioDeclarator2 vl_scType := { |
| name:="Sc1", |
| tcList := { vl_tcOfSc} |
| } |
| var integer vl_scIdx:=f_EPTF_LGenBase_declareScenarioType2( vl_scType); |
| |
| //===Create == |
| var EPTF_LGenBase_Scenario2Grp vl_sc := { |
| eGrpName:= vl_expectedEG.name, |
| scenarioName:="Sc1" |
| } |
| |
| f_EPTF_LGenBase_Test_resetDummyTestStep1Called(); |
| |
| //******* The tested function: *********** |
| f_EPTF_LGenBase_createScenario2EntityGroup(pl_scenarioDesc:=vl_sc, pl_autoStart:=false); |
| |
| //===Check:=== |
| vl_expectedEG.scenarios[0] := c_EPTF_LGenBase_emptyScenarioOfGrp; |
| vl_expectedEG.scenarios[0].name := "Sc1"; |
| vl_expectedEG.scenarios[0].weightedScData := omit; |
| vl_expectedEG.scenarios[0].schedulerData := omit; |
| vl_expectedEG.scenarios[0].trafficMixData := omit; |
| vl_expectedEG.scenarios[0].enabled := true; |
| vl_expectedEG.scenarios[0].startedTcs := 0; |
| vl_expectedEG.scenarios[0].tcIdxList := {vl_tcIdx}; |
| vl_expectedEG.scenarios[0].state := 0; |
| vl_expectedEG.scenarios[0].lockCPS := false; |
| vl_expectedEG.scenarios[0].uniqueName := "TestEntityGroup.Sc1"; |
| vl_expectedEG.scenarios[0].absIdx := 0; |
| |
| //======== Check if "not started" but activated Fsm:========== |
| |
| //check scenarioState (already checked...) |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getScenarioState(vl_eGroupIdx,vl_scIdx)==c_EPTF_LGenBase_tcStateIdle); |
| |
| //check trafficCase state(already checked...) |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getTrafficCaseState(pl_tcIdx:=0)==c_EPTF_LGenBase_tcStateIdle); |
| |
| //Check "Not started": |
| f_EPTF_LGenBase_Test_setVerdictFromBool(not f_EPTF_LGenBase_Test_isTrafficCaseStarted()); |
| |
| //Check "activated fsm" |
| //if it was "started, it would be in state "idle": |
| f_EPTF_LGenBase_Test_setVerdictFromBool(not f_EPTF_LGenBase_Test_isDummyTestStep1Called()); |
| |
| //===if it is in state "idle", this event should be logged:=== |
| f_EPTF_LGenBase_dispatchEvent( |
| pl_event:={ |
| event:={ bIdx:= v_myBCtxIdx, iIdx:= 0, target:= {eIdx:=0, fsmCtxIdx:=0}, source := omit}, |
| reportedArgs:={} |
| }); |
| f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isDummyTestStep1Called()); |
| |
| f_EPTF_Base_cleanup_CT(); |
| |
| }//tc_ |
| |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_createScenario2EntityGroup_AutoStartOn |
| // Subject: f_EPTF_LGenBase_createScenario2EntityGroup |
| // Status: Ready |
| //================================== |
| testcase tc_EPTF_LGenBase_Test_createScenario2EntityGroup_AutoStartOn() runs on EPTF_LGenBase_Test_CT { |
| |
| //=== Prepare === |
| var template EPTF_LGenBase_EntityGroup vl_expectedEG:= f_EPTF_LGenBase_Test_createEntityGroup(); |
| v_dummyInt := f_EPTF_LGenBase_declareFunction("evalSuccess2",{evaluateSuccess4EntityAtEntityGroup2 := refers(f_LGenBase_Test_evalSuccess2) }); |
| var integer vl_fsmIdx := f_EPTF_LGenBase_Test_declareCompactFsmTable(); |
| //var EPTF_LGenBase_TcMgmt_tcCustomParamDeclaratorList vl_params:={{"A","P","V"}}; |
| var charstring vl_tcTypeName := "TrafficCaseName"; |
| var EPTF_LGenBase_TcMgmt_tcTypeDeclarator2 vl_tcTypeDecl := { |
| name:=vl_tcTypeName, |
| fsmName := "TestCompactFsmTable", |
| entityType := "TestEntityType", |
| customEntitySucc := "evalSuccess2" |
| } |
| var integer vl_tcIdx:=f_EPTF_LGenBase_declareTcType2(vl_tcTypeDecl); |
| |
| var EPTF_LGenBase_TcMgmt_TcOfScenario2 vl_tcOfSc:= f_LGenBase_Test_createTcOfSc2(vl_tcTypeName); |
| |
| var EPTF_LGenBase_TcMgmt_ScenarioDeclarator2 vl_scType := { |
| name:="Sc1", |
| tcList := { vl_tcOfSc} |
| } |
| var integer vl_scIdx:=f_EPTF_LGenBase_declareScenarioType2( vl_scType); |
| |
| //===Create == |
| var EPTF_LGenBase_Scenario2Grp vl_sc := { |
| eGrpName:= valueof(vl_expectedEG.name), |
| scenarioName:="Sc1" |
| } |
| |
| //f_EPTF_LGenBase_Test_resetDummyTestStep1Called(); |
| |
| f_EPTF_LGenBase_createScenario2EntityGroup(pl_scenarioDesc:=vl_sc, pl_autoStart:=true); |
| |
| timer vl_T:=5.0; |
| vl_T.start; |
| var integer vl_eGroupIdx := 0; |
| f_EPTF_LGenBase_Test_setVerdictFromBool(f_LGenBase_Test_getScenarioState(vl_eGroupIdx,vl_scIdx)==c_EPTF_LGenBase_tcStateRunning); |
| f_EPTF_LGenBase_Test_setVerdictFromBool(f_LGenBase_Test_getTrafficCaseState(pl_tcIdx:=0)==c_EPTF_LGenBase_tcStateRunning); |
| alt{ |
| [] vl_T.timeout {}; |
| } |
| //======== Check if activated Fsm and "started TC" and StoppedTC executed at least once========== |
| //Check "startedTC": |
| f_EPTF_LGenBase_Test_setVerdictFromBool(f_EPTF_LGenBase_Test_isTrafficCaseStarted()); |
| //f_EPTF_LGenBase_Test_setVerdictFromBool(f_EPTF_LGenBase_Test_isTrafficCaseStopped()); |
| |
| f_EPTF_Base_cleanup_CT(); |
| |
| }//tc_ |
| //================================= |
| // function f_EPTF_LGenBase_addScenarioCreatedCallback - internal (???) |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_removeScenarioCreatedCallback -internal (???) |
| //================================== |
| |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_enableScenarioOnEntityGroup |
| // Subject: f_EPTF_LGenBase_enableScenarioOnEntityGroup |
| // Status: Cancelled. Reason: Internal function |
| // See tc_EPTF_LGenBase_Test_createScenario2EntityGroup_AutoStartOn |
| // and tc_EPTF_LGenBase_Test_createScenario2EntityGroup_AutoStartOff |
| //================================== |
| |
| //================================= |
| // function f_EPTF_LGenBase_checkName -internal |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_getNamePrefix -internal |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBaseStats_getTCName - not planned |
| //================================== |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_restoreScenario |
| // Subject: f_EPTF_LGenBase_restoreScenario |
| // Status: Ready, passed |
| // Expected result: The statistic variables of TrafficCases[i] shall be zero after the function call but not before it |
| // nrOfStarts |
| // nrOfSuccesses |
| // nrOfFails |
| // The following variables of v_LGenBase_TrafficCases[i] shall be positive |
| // nrOfRunningEntities |
| // nrOfAllEntities |
| // nrOfAvailableEntities |
| // nrOfNotFinishedEntities |
| //================================== |
| testcase tc_EPTF_LGenBase_Test_restoreScenario() runs on EPTF_LGenBase_Test_CT { |
| //=== Prepare === |
| //var integer vl_eGroupIdx:=0; |
| const integer c_nofExec := 30 |
| var template EPTF_LGenBase_EntityGroup vl_expectedEG:= f_EPTF_LGenBase_Test_createEntityGroup(); |
| v_dummyInt := f_EPTF_LGenBase_declareFunction("evalSuccess2",{evaluateSuccess4EntityAtEntityGroup2 := refers(f_LGenBase_Test_evalSuccess2) }); |
| v_dummyInt := f_EPTF_LGenBase_declareFunction("Finished",{customFinishFunction := refers(f_EPTF_LGenBase_TestFinished)}); |
| var integer vl_fsmIdx := f_EPTF_LGenBase_Test_declareCompactFsmTable(); |
| //var EPTF_LGenBase_TcMgmt_tcCustomParamDeclaratorList vl_params:={{"A","P","V"}}; |
| var charstring vl_tcTypeName1 := "TrafficCaseName1", vl_tcTypeName2 := "TrafficCaseName2"; |
| var EPTF_LGenBase_TcMgmt_tcTypeDeclarator2 vl_tcTypeDecl1 := { |
| name:=vl_tcTypeName1, |
| fsmName := "TestCompactFsmTable", |
| entityType := "TestEntityType", |
| customEntitySucc := "evalSuccess2" |
| }, |
| vl_tcTypeDecl2 := { |
| name:=vl_tcTypeName2, |
| fsmName := "TestCompactFsmTable", |
| entityType := "TestEntityType", |
| customEntitySucc := "evalSuccess2" |
| } |
| var integer vl_tcIdx1:=f_EPTF_LGenBase_declareTcType2(vl_tcTypeDecl1); |
| var integer vl_tcIdx2:=f_EPTF_LGenBase_declareTcType2(vl_tcTypeDecl2); |
| |
| var EPTF_LGenBase_TcMgmt_TcOfScenario2 vl_tcOfSc1:= f_LGenBase_Test_createTcOfSc2(vl_tcTypeName1); |
| vl_tcOfSc1.entityFinishConditions := { |
| nrOfExecStart := 7, |
| nrOfSuccesses := 6, |
| nrOfFails := 5, |
| customFinishCondition := omit |
| }; |
| var EPTF_LGenBase_TcMgmt_TcOfScenario2 vl_tcOfSc2:= f_LGenBase_Test_createTcOfSc2(vl_tcTypeName2); |
| vl_tcOfSc2.entityFinishConditions := { |
| nrOfExecStart := 7, |
| nrOfSuccesses := 6, |
| nrOfFails := 5, |
| customFinishCondition := omit |
| }; |
| vl_tcOfSc1.groupFinishConditions.nrOfExecStart := c_nofExec |
| vl_tcOfSc1.tcFinishActions[sizeof(vl_tcOfSc1.tcFinishActions)] := { |
| actionsType := onGroupFinishCondition, |
| actions := {{enableTc := {tcName := vl_tcTypeName2, aMode := noChange}}} |
| } |
| vl_tcOfSc2.enable := false |
| vl_tcOfSc2.groupFinishConditions.nrOfExecStart := c_nofExec |
| vl_tcOfSc2.tcFinishActions[sizeof(vl_tcOfSc2.tcFinishActions)] := { |
| actionsType := onGroupFinishCondition, |
| actions := {{customFinishFunction := "Finished"}} |
| } |
| var EPTF_LGenBase_TcMgmt_ScenarioDeclarator2 vl_scType := { |
| name:="Sc1", |
| tcList := { vl_tcOfSc1, vl_tcOfSc2} |
| } |
| log(%definitionId, vl_scType) |
| var integer vl_scIdx:=f_EPTF_LGenBase_declareScenarioType2( vl_scType); |
| |
| //===Create == |
| var EPTF_LGenBase_Scenario2Grp vl_sc := { |
| eGrpName:= valueof(vl_expectedEG.name), |
| scenarioName:="Sc1" |
| } |
| |
| f_EPTF_LGenBase_createScenario2EntityGroup(pl_scenarioDesc:=vl_sc, pl_autoStart:=true); |
| |
| log(">>>DEBUG: scenario created and started. Traffic generation follows"); |
| |
| f_EPTF_LGenBase_wait4TestFinished() |
| |
| //Check if the counters are positive: |
| for( var integer i:=0;i<2; i:=i+1) |
| { |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getNrOfStarts(i)>0 and |
| f_LGenBase_Test_getNrOfSuccesses(i)>0 and |
| f_LGenBase_Test_getNrOfFails(i)>=0 and |
| f_LGenBase_Test_getNrOfAvailableEntities(i)>=0 and |
| f_LGenBase_Test_getNrOfAvailableEntities(i) < f_LGenBase_Test_getNrOfAllEntities(i) and |
| f_LGenBase_Test_getNrOfNotFinishedEntities(i)>=0 ); |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getNrOfStarts(i) == |
| f_LGenBase_Test_getNrOfSuccesses(i)+f_LGenBase_Test_getNrOfFails(i)+f_LGenBase_Test_getNrOfRunningEntities(i) ); |
| } |
| |
| //******* The tested function: ********** |
| if(not f_EPTF_LGenBase_restoreScenario(pl_eGrpName:=vl_sc.eGrpName,pl_scName:=vl_sc.scenarioName,pl_autoStart:=false)){f_EPTF_Base_stop()} |
| |
| for( var integer i:=0;i<2; i:=i+1) |
| { |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getNrOfStarts(i)==0 and |
| f_LGenBase_Test_getNrOfSuccesses(i)==0 and |
| f_LGenBase_Test_getNrOfFails(i)==0 and |
| f_LGenBase_Test_getNrOfAllEntities(i)>0 and |
| f_LGenBase_Test_getNrOfAvailableEntities(i) == f_LGenBase_Test_getNrOfAllEntities(i) and |
| f_LGenBase_Test_getNrOfNotFinishedEntities(i) == f_LGenBase_Test_getNrOfAllEntities(i) and |
| f_LGenBase_Test_getNrOfRunningEntities(i)==0); |
| /*/ This is checked above where all the values must be 0 |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| v_LGenBase_trafficCases[i].nrOfStarts == |
| v_LGenBase_trafficCases[i].nrOfSuccesses+v_LGenBase_trafficCases[i].nrOfFails+v_LGenBase_trafficCases[i].nrOfRunningEntities ); |
| */ |
| } |
| |
| f_EPTF_Base_cleanup_CT(); |
| |
| }//tc_ |
| |
| //================================= |
| // function f_EPTF_LGenBase_restoreScenarioByIdx - internal |
| //================================== |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_restoreTC |
| // Subject: f_EPTF_LGenBase_restoreTC |
| // Status: Ready, passed |
| // Description: Restores a traffic case of a scenario after finishing the scenario |
| // Expected result: The statistic variables of the restored TrafficCase shall be zero after the function call: |
| // nrOfStarts |
| // nrOfSuccesses |
| // nrOfFails |
| // The following variables of v_LGenBase_TrafficCases[i] shall be positive |
| // nrOfRunningEntities |
| // nrOfAllEntities |
| // nrOfAvailableEntities |
| // nrOfNotFinishedEntities |
| // The counters of the not restored TC shall be unchanged |
| //================================== |
| testcase tc_EPTF_LGenBase_Test_restoreTC() runs on EPTF_LGenBase_Test_CT { |
| //=== Prepare === |
| //var integer vl_eGroupIdx:=0; |
| const integer c_nofExec := 28 |
| var template EPTF_LGenBase_EntityGroup vl_expectedEG:= f_EPTF_LGenBase_Test_createEntityGroup(); |
| v_dummyInt := f_EPTF_LGenBase_declareFunction("evalSuccess2",{evaluateSuccess4EntityAtEntityGroup2 := refers(f_LGenBase_Test_evalSuccess2) }); |
| v_dummyInt := f_EPTF_LGenBase_declareFunction("Finished",{customFinishFunction := refers(f_EPTF_LGenBase_TestFinished)}); |
| v_dummyInt := f_EPTF_LGenBase_Test_declareCompactFsmTableMixedResp(); |
| //var EPTF_LGenBase_TcMgmt_tcCustomParamDeclaratorList vl_params:={{"A","P","V"}}; |
| var charstring vl_tcTypeName1 := "TrafficCaseName1", vl_tcTypeName2 := "TrafficCaseName2"; |
| var EPTF_LGenBase_TcMgmt_tcTypeDeclarator2 vl_tcTypeDecl1 := { |
| name:=vl_tcTypeName1, |
| fsmName := "TestCompactFsmTable", |
| entityType := "TestEntityType", |
| customEntitySucc := "evalSuccess2" |
| }, |
| vl_tcTypeDecl2 := { |
| name:=vl_tcTypeName2, |
| fsmName := "TestCompactFsmTable", |
| entityType := "TestEntityType", |
| customEntitySucc := "evalSuccess2" |
| } |
| var integer vl_tcIdx1:=f_EPTF_LGenBase_declareTcType2(vl_tcTypeDecl1); |
| var integer vl_tcIdx2:=f_EPTF_LGenBase_declareTcType2(vl_tcTypeDecl2); |
| |
| var EPTF_LGenBase_TcMgmt_TcOfScenario2 vl_tcOfSc1:= f_LGenBase_Test_createTcOfSc2(vl_tcTypeName1); |
| vl_tcOfSc1.entityFinishConditions := { |
| nrOfExecStart := 7, |
| nrOfSuccesses := 6, |
| nrOfFails := 5, |
| customFinishCondition := omit |
| }; |
| var EPTF_LGenBase_TcMgmt_TcOfScenario2 vl_tcOfSc2:= f_LGenBase_Test_createTcOfSc2(vl_tcTypeName2); |
| vl_tcOfSc2.entityFinishConditions := { |
| nrOfExecStart := 7, |
| nrOfSuccesses := 6, |
| nrOfFails := 5, |
| customFinishCondition := omit |
| }; |
| vl_tcOfSc1.groupFinishConditions.nrOfExecStart := c_nofExec |
| vl_tcOfSc1.tcFinishActions[sizeof(vl_tcOfSc1.tcFinishActions)] := { |
| actionsType := onGroupFinishCondition, |
| actions := {{enableTc := {tcName := vl_tcTypeName2, aMode := noChange}}} |
| } |
| vl_tcOfSc2.enable := false |
| vl_tcOfSc2.groupFinishConditions.nrOfExecStart := c_nofExec |
| vl_tcOfSc2.tcFinishActions[sizeof(vl_tcOfSc2.tcFinishActions)] := { |
| actionsType := onGroupFinishCondition, |
| actions := {{customFinishFunction := "Finished"}} |
| } |
| var EPTF_LGenBase_TcMgmt_ScenarioDeclarator2 vl_scType := { |
| name:="Sc1", |
| tcList := { vl_tcOfSc1, vl_tcOfSc2} |
| } |
| var integer vl_scIdx:=f_EPTF_LGenBase_declareScenarioType2( vl_scType); |
| |
| //===Create == |
| var EPTF_LGenBase_Scenario2Grp vl_sc := { |
| eGrpName:= valueof(vl_expectedEG.name), |
| scenarioName:="Sc1" |
| } |
| |
| f_EPTF_LGenBase_createScenario2EntityGroup(pl_scenarioDesc:=vl_sc, pl_autoStart:=true); |
| |
| //log(">>>DEBUG: scenario created and started. Traffic generation follows"); |
| |
| f_EPTF_LGenBase_wait4TestFinished() |
| |
| //Check if the counters are positive: |
| for( var integer i:=0;i<2; i:=i+1) |
| { |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getNrOfStarts(i)>0 and |
| f_LGenBase_Test_getNrOfSuccesses(i)>0 and |
| f_LGenBase_Test_getNrOfFails(i)>=0 and |
| f_LGenBase_Test_getNrOfAvailableEntities(i)>=0 and |
| f_LGenBase_Test_getNrOfAvailableEntities(i) < f_LGenBase_Test_getNrOfAllEntities(i) and |
| f_LGenBase_Test_getNrOfNotFinishedEntities(i)>=0 ); |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getNrOfStarts(i) == |
| f_LGenBase_Test_getNrOfSuccesses(i)+f_LGenBase_Test_getNrOfFails(i)+f_LGenBase_Test_getNrOfRunningEntities(i) ); |
| } |
| |
| //******* The tested function: ********** |
| f_EPTF_LGenBase_restoreTC(pl_eGrpName:=vl_sc.eGrpName,pl_scName:=vl_sc.scenarioName,pl_tcName:= vl_tcTypeName1); |
| |
| var integer i:= 0; //tc1 |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getNrOfStarts(i)==0 and |
| f_LGenBase_Test_getNrOfSuccesses(i)==0 and |
| f_LGenBase_Test_getNrOfFails(i)==0 and |
| f_LGenBase_Test_getNrOfAllEntities(i)>0 and |
| f_LGenBase_Test_getNrOfAvailableEntities(i) == f_LGenBase_Test_getNrOfAllEntities(i) and |
| f_LGenBase_Test_getNrOfNotFinishedEntities(i) == f_LGenBase_Test_getNrOfAllEntities(i) and |
| f_LGenBase_Test_getNrOfRunningEntities(i)==0); |
| |
| /* This is checked above where all the values must be 0 |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| v_LGenBase_trafficCases[i].nrOfStarts == |
| v_LGenBase_trafficCases[i].nrOfSuccesses+v_LGenBase_trafficCases[i].nrOfFails+v_LGenBase_trafficCases[i].nrOfRunningEntities ); |
| */ |
| |
| i:=1; //not restored tc: |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getNrOfStarts(i)>0 and |
| f_LGenBase_Test_getNrOfSuccesses(i)>0 and |
| f_LGenBase_Test_getNrOfFails(i)>0 and |
| f_LGenBase_Test_getNrOfAvailableEntities(i)==0 and |
| f_LGenBase_Test_getNrOfNotFinishedEntities(i) < f_LGenBase_Test_getNrOfAllEntities(i)); |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getNrOfStarts(i) == |
| f_LGenBase_Test_getNrOfSuccesses(i)+f_LGenBase_Test_getNrOfFails(i)+f_LGenBase_Test_getNrOfRunningEntities(i) ); |
| |
| f_EPTF_Base_cleanup_CT(); |
| |
| }//tc_ |
| //================================= |
| // function f_EPTF_LGenBase_restoreTCbyIdx - internal |
| //================================== |
| |
| //================================= |
| // function f_EPTF_LGenBase_areETypesCompatible |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_createTc2EntityGroup |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_declareFunction |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_declareReferredTcList |
| //================================== |
| |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_stopTrafficCase |
| // Subject: f_EPTF_LGenBase_stopTrafficCase |
| // Status: Ready, Passed |
| // Description: |
| // 1. Creates an entity group with all preparation |
| // 2. Creates 2 traffic case types (with the same fsm table and entity type) |
| // 3. Creates a scenario to the given entity group with autostart |
| // (f_EPTF_LGenBase_createScenario2EntityGroup(pl_scenarioDesc:=vl_sc, pl_autoStart:=true); |
| // 4. Stops the second traffic case and checks |
| // - if the state of the scenario is "running" |
| // - if the state if the second tc is "stopping" |
| // - if the event "TrafficCaseStopped" occured and |
| // the function "f_EPTF_LGenBase_Test_step_reportTrafficCaseStopped" has been called |
| // 5.Stops the first traffic case and checks |
| // - if the state of the scenario is "stopping" |
| // - if the state if the first and the second tc is in state "stopping" |
| // - if the event "TrafficCaseStopped" occured and |
| // the function "f_EPTF_LGenBase_Test_step_reportTrafficCaseStopped" has been called |
| //================================== |
| testcase tc_EPTF_LGenBase_Test_stopTrafficCase() runs on EPTF_LGenBase_Test_CT { |
| //=== Prepare === |
| var integer vl_eGroupIdx:=0; |
| var template EPTF_LGenBase_EntityGroup vl_expectedEG:= f_EPTF_LGenBase_Test_createEntityGroup(); |
| v_dummyInt := f_EPTF_LGenBase_declareFunction("evalSuccess2",{evaluateSuccess4EntityAtEntityGroup2 := refers(f_LGenBase_Test_evalSuccess2) }); |
| v_dummyInt := f_EPTF_LGenBase_Test_declareCompactFsmTableMixedResp(); |
| //var EPTF_LGenBase_TcMgmt_tcCustomParamDeclaratorList vl_params:={{"A","P","V"}}; |
| var charstring vl_tcTypeName1 := "TrafficCaseName1", vl_tcTypeName2 := "TrafficCaseName2"; |
| var EPTF_LGenBase_TcMgmt_tcTypeDeclarator2 vl_tcTypeDecl1 := { |
| name:=vl_tcTypeName1, |
| fsmName := "TestCompactFsmTable", |
| entityType := "TestEntityType", |
| customEntitySucc := "evalSuccess2" |
| }, |
| vl_tcTypeDecl2 := { |
| name:=vl_tcTypeName2, |
| fsmName := "TestCompactFsmTable", |
| entityType := "TestEntityType", |
| customEntitySucc := "evalSuccess2" |
| } |
| var integer vl_tcIdx1:=f_EPTF_LGenBase_declareTcType2(vl_tcTypeDecl1); |
| var integer vl_tcIdx2:=f_EPTF_LGenBase_declareTcType2(vl_tcTypeDecl2); |
| |
| var EPTF_LGenBase_TcMgmt_TcOfScenario2 vl_tcOfSc1:= f_LGenBase_Test_createTcOfSc2(vl_tcTypeName1); |
| var EPTF_LGenBase_TcMgmt_TcOfScenario2 vl_tcOfSc2:= f_LGenBase_Test_createTcOfSc2(vl_tcTypeName2); |
| |
| var EPTF_LGenBase_TcMgmt_ScenarioDeclarator2 vl_scType := { |
| name:="Sc1", |
| tcList := { vl_tcOfSc1, vl_tcOfSc2} |
| } |
| var integer vl_scIdx:=f_EPTF_LGenBase_declareScenarioType2( vl_scType); |
| |
| //===Create == |
| var EPTF_LGenBase_Scenario2Grp vl_sc := { |
| eGrpName:= valueof(vl_expectedEG.name), |
| scenarioName:="Sc1" |
| } |
| |
| f_EPTF_LGenBase_createScenario2EntityGroup(pl_scenarioDesc:=vl_sc, pl_autoStart:=true); |
| |
| //******* The tested function: *********** |
| f_EPTF_LGenBase_stopTrafficCase(vl_sc.eGrpName, vl_sc.scenarioName, vl_tcTypeName2) |
| |
| //log( ">>>DEBUG: v_LGenBase_trafficCases: ",v_LGenBase_trafficCases); |
| //check scenarioState: |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getScenarioState(vl_eGroupIdx,vl_scIdx)==c_EPTF_LGenBase_tcStateRunning); |
| |
| //check trafficCase state: |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getTrafficCaseState(pl_tcIdx:=vl_tcIdx1)==c_EPTF_LGenBase_tcStateRunning); |
| |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getTrafficCaseState(pl_tcIdx:=vl_tcIdx2)==c_EPTF_LGenBase_tcStateStopping); |
| |
| //******* The tested function: *********** |
| f_EPTF_LGenBase_stopTrafficCase(vl_sc.eGrpName, vl_sc.scenarioName, vl_tcTypeName1) |
| |
| //check scenarioState: |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getScenarioState(vl_eGroupIdx,vl_scIdx)==c_EPTF_LGenBase_tcStateStopping); |
| |
| //check trafficCase state: |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getTrafficCaseState(pl_tcIdx:=vl_tcIdx1)==c_EPTF_LGenBase_tcStateStopping); |
| |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getTrafficCaseState(pl_tcIdx:=vl_tcIdx2)==c_EPTF_LGenBase_tcStateStopping); |
| |
| //check if fsm event generated a test step: |
| //f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isTrafficCaseStopped()); |
| |
| f_EPTF_Base_cleanup_CT(); |
| } |
| //================================= |
| // function f_EPTF_LGenBase_stopTrafficCaseByIdx - internal |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_stopProcessTimedOut - internal |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_finishedStopTcListener |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_finishedAbortTcListener |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_isWeightedScenarioType |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_isWeightedScenario |
| //================================== |
| |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_startTrafficCase |
| // Subject: f_EPTF_LGenBase_startTrafficCase |
| // Status: |
| //================================== |
| testcase tc_EPTF_LGenBase_Test_startTrafficCase() runs on EPTF_LGenBase_Test_CT { |
| //=== Prepare === |
| var integer vl_eGroupIdx:=0; |
| var template EPTF_LGenBase_EntityGroup vl_expectedEG:= f_EPTF_LGenBase_Test_createEntityGroup(); |
| v_dummyInt := f_EPTF_LGenBase_declareFunction("evalSuccess2",{evaluateSuccess4EntityAtEntityGroup2 := refers(f_LGenBase_Test_evalSuccess2) }); |
| var integer vl_fsmIdx := f_EPTF_LGenBase_Test_declareCompactFsmTable(); |
| var EPTF_LGenBase_TcMgmt_tcCustomParamDeclaratorList vl_params:={{"A","P","V"}}; |
| var charstring vl_tcTypeName := "TrafficCaseName"; |
| var EPTF_LGenBase_TcMgmt_tcTypeDeclarator2 vl_tcTypeDecl := { |
| name:=vl_tcTypeName, |
| fsmName := "TestCompactFsmTable", |
| entityType := "TestEntityType", |
| customEntitySucc := "evalSuccess2" |
| } |
| var integer vl_tcIdx:=f_EPTF_LGenBase_declareTcType2(vl_tcTypeDecl); |
| |
| var EPTF_LGenBase_TcMgmt_TcOfScenario2 vl_tcOfSc:= f_LGenBase_Test_createTcOfSc2(vl_tcTypeName); |
| |
| var EPTF_LGenBase_TcMgmt_ScenarioDeclarator2 vl_scType := { |
| name:="Sc1", |
| tcList := { vl_tcOfSc} |
| } |
| var integer vl_scIdx:=f_EPTF_LGenBase_declareScenarioType2( vl_scType); |
| |
| //===Create == |
| var EPTF_LGenBase_Scenario2Grp vl_sc := { |
| eGrpName:= valueof(vl_expectedEG.name), |
| scenarioName:="Sc1" |
| } |
| |
| f_EPTF_LGenBase_createScenario2EntityGroup(pl_scenarioDesc:=vl_sc, pl_autoStart:= false); |
| |
| //== Before calling f_EPTF_LGenBase_stopScenarioByIdx === |
| |
| //check scenarioState: |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getScenarioState(vl_eGroupIdx,vl_scIdx)==c_EPTF_LGenBase_tcStateIdle); |
| |
| //check trafficCase state: |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getTrafficCaseState(pl_tcIdx:=0)==c_EPTF_LGenBase_tcStateIdle); |
| |
| //check if fsm event generated a test step: |
| f_EPTF_LGenBase_Test_setVerdictFromBool( not f_EPTF_LGenBase_Test_isTrafficCaseStarted()); |
| |
| |
| //******* The tested function: *********** |
| f_EPTF_LGenBase_startTrafficCase(vl_sc.eGrpName, vl_sc.scenarioName, vl_tcTypeName) |
| |
| timer vl_T:=5.0; |
| vl_T.start; |
| alt{ |
| [] vl_T.timeout {}; |
| } |
| |
| //check |
| //check scenarioState: |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getScenarioState(vl_eGroupIdx,vl_scIdx)!=c_EPTF_LGenBase_tcStateIdle); |
| |
| //check trafficCase state: |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getTrafficCaseState(pl_tcIdx:=0)!=c_EPTF_LGenBase_tcStateIdle); |
| |
| //check if fsm event generated a test step: |
| f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isTrafficCaseStarted()); |
| |
| f_EPTF_Base_cleanup_CT(); |
| } |
| //================================= |
| // function f_EPTF_LGenBase_startWeightedScenario |
| //================================== |
| //- |
| //================================= |
| // function f_EPTF_LGenBase_finishLaunchTC |
| //================================== |
| //- |
| //================================= |
| // function f_EPTF_LGenBase_setCPSByNames |
| //================================== |
| //- |
| //================================= |
| // function f_EPTF_LGenBase_setCpsOrWeightOfTcByNames |
| //================================== |
| //- |
| //================================= |
| // function f_EPTF_LGenBase_restartActionTimer |
| //================================== |
| //- |
| //================================= |
| // function f_EPTF_LGenBase_setCPS |
| //================================== |
| //- |
| //================================= |
| // function f_EPTF_LGenBase_setScenarioCPS |
| //================================== |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_setScenarioCPS |
| // Subject: f_EPTF_LGenBase_setScenarioCPS |
| // Description: |
| // Description: |
| // 1. Creates a weighted scenario with on traffic case and an entity group with 5 entities connected to the scenario. |
| // 2. Starts traffic case with the ordered cps |
| // 3. Checks the difference between the expected and the real started traffic cases. 3% error accepted. |
| // Status: Ready,passed |
| //================================== |
| testcase tc_EPTF_LGenBase_Test_setScenarioCPS() runs on EPTF_LGenBase_Test_CT { |
| const integer c_LGenBase_Test_timer_nrOfEntities := 300 |
| const float c_LGenBase_Test_timer_execTime := 60.0 |
| const float c_LGenBase_Test_timer_cps := 1000.0 |
| f_LGenBase_Test_timerTest4WeightedSc(c_LGenBase_Test_timer_nrOfEntities,c_LGenBase_Test_timer_execTime, c_LGenBase_Test_timer_cps) |
| }//tc_ |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_cpsTest4WeightedScenario |
| // Subject: cps test |
| // Description: |
| // Description: Repeats this steps for N=100,1000, 10000 entities, for cps=500,1000,...4000: |
| // 1. Creates a weighted scenario with on traffic case and an entity group with N entities connected to the scenario. |
| // 2. Starts traffic case with the ordered cps |
| // 3. Checks the difference between the expected and the real started traffic cases. 3% error accepted. |
| // Status: Ready |
| //================================== |
| testcase tc_EPTF_LGenBase_Test_cpsTest4WeightedScenario() runs on EPTF_LGenBase_Test_CT { |
| var integer vl_NrOfEntities :=-1; |
| //var float vl_execTime:= 10.0; |
| var float vl_cps := 0.0 |
| //for 10, 100,1000,10000 entities: |
| for( vl_NrOfEntities:=tsp_minNrOfEntities; vl_NrOfEntities<=tsp_maxNrOfEntities; vl_NrOfEntities:=vl_NrOfEntities*10) |
| { |
| for( vl_cps:=500.0; vl_cps<=tsp_cps;vl_cps:=vl_cps+500.0) |
| { |
| f_LGenBase_Test_timerTest4WeightedSc(vl_NrOfEntities,tsp_execTime, vl_cps) |
| } |
| } |
| log(">>>>>Cps test ready<<<<<<<<") |
| }//tc_ |
| |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_cpsTest4WeightedScenario_exp |
| // Subject: cps test |
| // Description: |
| // Description: Repeats this steps for N=10,100,1000, 10000 entities, for cps=500,1000,...4000: |
| // 1. Creates a weighted scenario with on traffic case and an entity group with N entities connected to the scenario. |
| // 2. Starts traffic case with the ordered cps |
| // 3. Checks the difference between the expected and the real started traffic cases. 3% error accepted. |
| // Status: Ready |
| //================================== |
| testcase tc_EPTF_LGenBase_Test_cpsTest4WeightedScenario_exp() runs on EPTF_LGenBase_Test_CT { |
| var integer vl_NrOfEntities :=-1; |
| //var float vl_execTime:= 10.0; |
| var float vl_cps := 0.0 |
| //for 10, 100,1000,10000 entities: |
| var float vl_maxCps :=10000.0 |
| for( vl_NrOfEntities:=tsp_minNrOfEntities; vl_NrOfEntities<= tsp_maxNrOfEntities; vl_NrOfEntities:=vl_NrOfEntities*2) |
| { |
| if(tsp_EPTF_cpsUpdateInterval>0.0 and 0.5*int2float(vl_NrOfEntities)/tsp_EPTF_cpsUpdateInterval<10000.0) { |
| vl_maxCps:=0.5*int2float(vl_NrOfEntities)/tsp_EPTF_cpsUpdateInterval; |
| } |
| |
| for( vl_cps:=10.0; vl_cps<=vl_maxCps;vl_cps:=vl_cps*2.0) |
| { |
| f_LGenBase_Test_timerTest4WeightedSc(vl_NrOfEntities,tsp_execTime, vl_cps) |
| } |
| } |
| log(">>>>>Cps test ready<<<<<<<<") |
| }//tc_ |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_cpsTest4WeightedScenario_entityLimit |
| // Subject: cps test |
| // Description: |
| // Description: Repeats this steps for N=10,100,1000, 10000 entities, for cps=500,1000,...4000: |
| // 1. Creates a weighted scenario with on traffic case and an entity group with N entities connected to the scenario. |
| // 2. Starts traffic case with the ordered cps |
| // 3. Checks the difference between the expected and the real started traffic cases. 3% error accepted. |
| // Status: Ready |
| //================================== |
| testcase tc_EPTF_LGenBase_Test_cpsTest4WeightedScenario_entityLimit() runs on EPTF_LGenBase_Test_CT { |
| var integer vl_NrOfEntities :=-1; |
| //var float vl_execTime:= 10.0; |
| var float vl_cps := 0.0 |
| //for 10, 100,1000,10000 entities: |
| for( vl_NrOfEntities:=tsp_minNrOfEntities; vl_NrOfEntities<=tsp_maxNrOfEntities; vl_NrOfEntities:=vl_NrOfEntities+1000) |
| { |
| for( vl_cps:=10.0; vl_cps<500.0;vl_cps:=vl_cps+100.0) |
| { |
| f_LGenBase_Test_timerTest4WeightedSc(vl_NrOfEntities,tsp_execTime, vl_cps) |
| } |
| for( vl_cps:=500.0; vl_cps<=7000.0;vl_cps:=vl_cps+500.0) |
| { |
| f_LGenBase_Test_timerTest4WeightedSc(vl_NrOfEntities,tsp_execTime, vl_cps) |
| } |
| } |
| log(">>>>>Cps test ready<<<<<<<<") |
| }//tc_ |
| |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_cpsTest4WeightedScenario_lowCps |
| // Subject: cps test |
| // Description: |
| // Description: Repeats this steps for N=1000,2000...10000 entities, for cps=10,40,70...360 |
| // 1. Creates a weighted scenario with on traffic case and an entity group with N entities connected to the scenario. |
| // 2. Starts traffic case with the ordered cps |
| // 3. Checks the difference between the expected and the real started traffic cases. 3% error accepted. |
| // Status: Ready |
| //================================== |
| testcase tc_EPTF_LGenBase_Test_cpsTest4WeightedScenario_lowCps() runs on EPTF_LGenBase_Test_CT { |
| var integer vl_NrOfEntities :=-1; |
| //var float vl_execTime:= 10.0; |
| var float vl_cps := 0.0 |
| //for 10, 100,1000,10000 entities: |
| for( vl_NrOfEntities:=tsp_minNrOfEntities; vl_NrOfEntities<=tsp_maxNrOfEntities; vl_NrOfEntities:=vl_NrOfEntities+1000) |
| { |
| f_LGenBase_Test_timerTest4WeightedSc(vl_NrOfEntities,tsp_execTime, 1.0) |
| for( vl_cps:=10.0; vl_cps<360.2;vl_cps:=vl_cps+30.0) |
| { |
| f_LGenBase_Test_timerTest4WeightedSc(vl_NrOfEntities,tsp_execTime, vl_cps) |
| } |
| } |
| log(">>>>>Cps test ready<<<<<<<<") |
| }//tc_ |
| //================================= |
| // function f_EPTF_LGenBase_setScenarioCPSByIdx --internal |
| //================================== |
| //- |
| //================================= |
| // function f_EPTF_LGenBase_setTcWeight |
| //================================== |
| //- |
| //================================= |
| // function f_EPTF_LGenBase_getCPSByNames |
| //================================== |
| //- |
| //================================= |
| // function f_EPTF_LGenBase_getCPS |
| //================================== |
| //- |
| |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_abortTrafficCase |
| // Subject: f_EPTF_LGenBase_abortTrafficCase |
| // Status: Ready, Passed |
| // Description: |
| // 1. Creates an entity group with all preparation |
| // 2. Creates 2 traffic case types (with the same fsm table and entity type) |
| // 3. Creates a scenario to the given entity group with autostart |
| // (f_EPTF_LGenBase_createScenario2EntityGroup(pl_scenarioDesc:=vl_sc, pl_autoStart:=true); |
| // 4. Aborts the second traffic case and checks |
| // - if the state of the scenario is "running" |
| // - if the state if the second tc is "aborting" |
| // - if the event TrafficCaseStopped and trafficCaseAborted occured |
| // 5. Aborts the first traffic case and checks |
| // - if the state of the scenario is "aborting" |
| // - if the state if the first and the second tc is in state "aborting" |
| // - if the event TrafficCaseStopped and trafficCaseAborted occured |
| //================================== |
| testcase tc_EPTF_LGenBase_Test_abortTrafficCase() runs on EPTF_LGenBase_Test_CT { |
| //=== Prepare === |
| var integer vl_eGroupIdx:=0; |
| var template EPTF_LGenBase_EntityGroup vl_expectedEG:= f_EPTF_LGenBase_Test_createEntityGroup(); |
| v_dummyInt := f_EPTF_LGenBase_declareFunction("evalSuccess2",{evaluateSuccess4EntityAtEntityGroup2 := refers(f_LGenBase_Test_evalSuccess2) }); |
| var integer vl_fsmIdx := f_EPTF_LGenBase_Test_declareCompactFsmTable(); |
| var EPTF_LGenBase_TcMgmt_tcCustomParamDeclaratorList vl_params:={{"A","P","V"}}; |
| var charstring vl_tcTypeName1 := "TrafficCaseName1", vl_tcTypeName2 := "TrafficCaseName2"; |
| var EPTF_LGenBase_TcMgmt_tcTypeDeclarator2 vl_tcTypeDecl1 := { |
| name:=vl_tcTypeName1, |
| fsmName := "TestCompactFsmTable", |
| entityType := "TestEntityType", |
| customEntitySucc := "evalSuccess2" |
| }, |
| vl_tcTypeDecl2 := { |
| name:=vl_tcTypeName2, |
| fsmName := "TestCompactFsmTable", |
| entityType := "TestEntityType", |
| customEntitySucc := "evalSuccess2" |
| } |
| var integer vl_tcIdx1:=f_EPTF_LGenBase_declareTcType2(vl_tcTypeDecl1); |
| var integer vl_tcIdx2:=f_EPTF_LGenBase_declareTcType2(vl_tcTypeDecl2); |
| |
| var EPTF_LGenBase_TcMgmt_TcOfScenario2 vl_tcOfSc1:= f_LGenBase_Test_createTcOfSc2(vl_tcTypeName1); |
| var EPTF_LGenBase_TcMgmt_TcOfScenario2 vl_tcOfSc2:= f_LGenBase_Test_createTcOfSc2(vl_tcTypeName2); |
| |
| var EPTF_LGenBase_TcMgmt_ScenarioDeclarator2 vl_scType := { |
| name:="Sc1", |
| tcList := { vl_tcOfSc1, vl_tcOfSc2} |
| } |
| var integer vl_scIdx:=f_EPTF_LGenBase_declareScenarioType2( vl_scType); |
| |
| //===Create == |
| var EPTF_LGenBase_Scenario2Grp vl_sc := { |
| eGrpName:= valueof(vl_expectedEG.name), |
| scenarioName:="Sc1" |
| } |
| |
| f_EPTF_LGenBase_createScenario2EntityGroup(pl_scenarioDesc:=vl_sc, pl_autoStart:=true); |
| f_EPTF_LGenBase_Test_resetTrafficCaseStopped(); |
| |
| //******* The tested function: *********** |
| f_EPTF_LGenBase_abortTrafficCase(vl_sc.eGrpName, vl_sc.scenarioName, vl_tcTypeName2) |
| |
| //log( ">>>DEBUG: v_LGenBase_trafficCases: ",v_LGenBase_trafficCases); |
| //check scenarioState: |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getScenarioState(vl_eGroupIdx,vl_scIdx)==c_EPTF_LGenBase_tcStateRunning); |
| |
| //check trafficCase state: |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getTrafficCaseState(pl_tcIdx:=vl_tcIdx1)==c_EPTF_LGenBase_tcStateRunning); |
| |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getTrafficCaseState(pl_tcIdx:=vl_tcIdx2)==c_EPTF_LGenBase_tcStateAborting); |
| |
| //This part is not working because the action handler is not called and therefore stopped and aborted is not working |
| //check if fsm event generated a test step: |
| //f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isTrafficCaseStopped()); |
| //f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isTrafficCaseAborted()); |
| |
| //once again: |
| //f_EPTF_LGenBase_Test_resetTrafficCaseStopped(); |
| //f_EPTF_LGenBase_Test_resetTrafficCaseAborted(); |
| |
| //******* The tested function: *********** |
| f_EPTF_LGenBase_abortTrafficCase(vl_sc.eGrpName, vl_sc.scenarioName, vl_tcTypeName1) |
| |
| // log( ">>>DEBUG: v_LGenBase_trafficCases: ",v_LGenBase_trafficCases); |
| // log( ">>>DEBUG: v_LGenBase_entityGroups: ",v_LGenBase_entityGroups); |
| // log(">>>DEBUG: v_LGenBase_fsmTables: ", v_LGenBase_fsmTables); |
| // //check scenarioState: |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getScenarioState(vl_eGroupIdx,vl_scIdx)==c_EPTF_LGenBase_tcStateAborting); |
| |
| //check trafficCase state: |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getTrafficCaseState(pl_tcIdx:=vl_tcIdx1)==c_EPTF_LGenBase_tcStateAborting); |
| |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getTrafficCaseState(pl_tcIdx:=vl_tcIdx2)==c_EPTF_LGenBase_tcStateAborting); |
| |
| //This part is not working because the action handler is not called and therefore stopped and aborted is not working |
| //check if fsm event generated a test step. |
| // f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isTrafficCaseStopped()); |
| // f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isTrafficCaseAborted()); |
| |
| f_EPTF_Base_cleanup_CT(); |
| } |
| //================================= |
| // function f_EPTF_LGenBase_stopWeightedScenarioByIdx |
| //================================== |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_stopScenarioByIdx |
| // Subject: f_EPTF_LGenBase_stopScenarioByIdx |
| // Status: Ready, passed |
| //================================== |
| testcase tc_EPTF_LGenBase_Test_stopScenarioByIdx () runs on EPTF_LGenBase_Test_CT { |
| //=== Prepare === |
| var template EPTF_LGenBase_EntityGroup vl_expectedEG:= f_EPTF_LGenBase_Test_createEntityGroup(); |
| v_dummyInt := f_EPTF_LGenBase_declareFunction("evalSuccess2",{evaluateSuccess4EntityAtEntityGroup2 := refers(f_LGenBase_Test_evalSuccess2) }); |
| var integer vl_fsmIdx := f_EPTF_LGenBase_Test_declareCompactFsmTable(); |
| var EPTF_LGenBase_TcMgmt_tcCustomParamDeclaratorList vl_params:={{"A","P","V"}}; |
| var charstring vl_tcTypeName := "TrafficCaseName"; |
| var EPTF_LGenBase_TcMgmt_tcTypeDeclarator2 vl_tcTypeDecl := { |
| name:=vl_tcTypeName, |
| fsmName := "TestCompactFsmTable", |
| entityType := "TestEntityType", |
| customEntitySucc := "evalSuccess2" |
| } |
| var integer vl_tcIdx:=f_EPTF_LGenBase_declareTcType2(vl_tcTypeDecl); |
| |
| var EPTF_LGenBase_TcMgmt_TcOfScenario2 vl_tcOfSc:= f_LGenBase_Test_createTcOfSc2(vl_tcTypeName); |
| |
| var EPTF_LGenBase_TcMgmt_ScenarioDeclarator2 vl_scType := { |
| name:="Sc1", |
| tcList := { vl_tcOfSc} |
| } |
| var integer vl_scIdx:=f_EPTF_LGenBase_declareScenarioType2( vl_scType); |
| |
| //===Create == |
| var EPTF_LGenBase_Scenario2Grp vl_sc := { |
| eGrpName:= valueof(vl_expectedEG.name), |
| scenarioName:="Sc1" |
| } |
| |
| //f_EPTF_LGenBase_Test_resetDummyTestStep1Called() |
| |
| f_EPTF_LGenBase_createScenario2EntityGroup(pl_scenarioDesc:=vl_sc, pl_autoStart:=true); |
| |
| timer vl_T:=0.4; |
| vl_T.start; |
| |
| alt{ |
| [] vl_T.timeout {}; |
| } |
| |
| var integer vl_eGroupIdx:=0; |
| |
| //== Before calling f_EPTF_LGenBase_stopScenarioByIdx === |
| |
| //check scenarioState: |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getScenarioState(vl_eGroupIdx,vl_scIdx)==c_EPTF_LGenBase_tcStateRunning); |
| |
| //check trafficCase state: |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getTrafficCaseState(pl_tcIdx:=0)==c_EPTF_LGenBase_tcStateRunning); |
| |
| //check if fsm event generated a test step: |
| f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isTrafficCaseStarted()); |
| |
| |
| //==create:== |
| //******* The tested function: *********** |
| f_EPTF_LGenBase_stopScenarioByIdx(vl_eGroupIdx,vl_scIdx); |
| |
| //==Check:== |
| //check scenario state: |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getScenarioState(vl_eGroupIdx,vl_scIdx)==c_EPTF_LGenBase_tcStateStopping); |
| |
| //check traffic case state: |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getTrafficCaseState(pl_tcIdx:=0)==c_EPTF_LGenBase_tcStateStopping ); |
| |
| //check if fsm event generated a test step: |
| f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isTrafficCaseStopped()); |
| |
| f_EPTF_Base_cleanup_CT(); |
| }//tc_ |
| //================================= |
| // function f_EPTF_LGenBase_abortWeightedScenarioByIdx - not planned but important |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_abortScenarioByIdx - not planned but important |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_abortTrafficCaseByIdx |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_enableTrafficCaseInternal - internal |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_enableWeightedScenarioInternal |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_startLaunchTC - internal |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_registerTcStartedCallback |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_registerScenarioStateChangedCallback |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_registerTcStateChangedCallback |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_checkTcState |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_setScNewState |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_startLaunchWeightedScenario |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_pauseWeightedScenario |
| //================================== |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_pauseScenario |
| // Subject: f_EPTF_LGenBase_pauseScenario |
| // Status: Ready, Passed |
| // Description: |
| // 1. Creates an entity group with all preparation |
| // 2. Creates 2 traffic case types (with the same fsm table and entity type) |
| // 3. Creates a scenario to the given entity group with autostart |
| // (f_EPTF_LGenBase_createScenario2EntityGroup(pl_scenarioDesc:=vl_sc, pl_autoStart:=true); |
| // 4. Pause the scenario and checks |
| // - if the state of the scenario is "paused" |
| // - if the state if its traffic cases are in state "paused" |
| //================================== |
| testcase tc_EPTF_LGenBase_Test_pauseScenario() runs on EPTF_LGenBase_Test_CT { |
| //=== Prepare === |
| var integer vl_eGroupIdx:=0; |
| var template EPTF_LGenBase_EntityGroup vl_expectedEG:= f_EPTF_LGenBase_Test_createEntityGroup(); |
| v_dummyInt := f_EPTF_LGenBase_declareFunction("evalSuccess2",{evaluateSuccess4EntityAtEntityGroup2 := refers(f_LGenBase_Test_evalSuccess2) }); |
| var integer vl_fsmIdx := f_EPTF_LGenBase_Test_declareCompactFsmTable(); |
| var EPTF_LGenBase_TcMgmt_tcCustomParamDeclaratorList vl_params:={{"A","P","V"}}; |
| var charstring vl_tcTypeName1 := "TrafficCaseName1", vl_tcTypeName2 := "TrafficCaseName2"; |
| var EPTF_LGenBase_TcMgmt_tcTypeDeclarator2 vl_tcTypeDecl1 := { |
| name:=vl_tcTypeName1, |
| fsmName := "TestCompactFsmTable", |
| entityType := "TestEntityType", |
| customEntitySucc := "evalSuccess2" |
| }, |
| vl_tcTypeDecl2 := { |
| name:=vl_tcTypeName2, |
| fsmName := "TestCompactFsmTable", |
| entityType := "TestEntityType", |
| customEntitySucc := "evalSuccess2" |
| } |
| var integer vl_tcIdx1:=f_EPTF_LGenBase_declareTcType2(vl_tcTypeDecl1); |
| var integer vl_tcIdx2:=f_EPTF_LGenBase_declareTcType2(vl_tcTypeDecl2); |
| |
| var EPTF_LGenBase_TcMgmt_TcOfScenario2 vl_tcOfSc1:= f_LGenBase_Test_createTcOfSc2(vl_tcTypeName1); |
| var EPTF_LGenBase_TcMgmt_TcOfScenario2 vl_tcOfSc2:= f_LGenBase_Test_createTcOfSc2(vl_tcTypeName2); |
| |
| var EPTF_LGenBase_TcMgmt_ScenarioDeclarator2 vl_scType := { |
| name:="Sc1", |
| tcList := { vl_tcOfSc1, vl_tcOfSc2} |
| } |
| var integer vl_scIdx:=f_EPTF_LGenBase_declareScenarioType2( vl_scType); |
| |
| //===Create == |
| var EPTF_LGenBase_Scenario2Grp vl_sc := { |
| eGrpName:= valueof(vl_expectedEG.name), |
| scenarioName:="Sc1" |
| } |
| |
| f_EPTF_LGenBase_createScenario2EntityGroup(pl_scenarioDesc:=vl_sc, pl_autoStart:=true); |
| |
| //******* The tested function: *********** |
| f_EPTF_LGenBase_pauseScenario(vl_eGroupIdx,vl_scIdx) |
| |
| //check scenarioState: |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getScenarioState(vl_eGroupIdx,vl_scIdx)==c_EPTF_LGenBase_tcStatePaused); |
| |
| //check trafficCase state: |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getTrafficCaseState(pl_tcIdx:=vl_tcIdx1)==c_EPTF_LGenBase_tcStatePaused); |
| |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getTrafficCaseState(pl_tcIdx:=vl_tcIdx2)==c_EPTF_LGenBase_tcStatePaused); |
| |
| //check if fsm event generated a test step: |
| //f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isTrafficCaseStopped()); |
| //no sign of pause |
| }//tc_ |
| |
| //================================= |
| // function f_EPTF_LGenBase_pauseTrafficCase |
| //================================== |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_stopTrafficCase |
| // Subject: f_EPTF_LGenBase_stopTrafficCase |
| // Status: Ready, Passed |
| // Description: |
| // 1. Creates an entity group with all preparation |
| // 2. Creates 2 traffic case types (with the same fsm table and entity type) |
| // 3. Creates a scenario to the given entity group with autostart |
| // (f_EPTF_LGenBase_createScenario2EntityGroup(pl_scenarioDesc:=vl_sc, pl_autoStart:=true); |
| // 4. Pauses the second traffic case and checks |
| // - if the state of the scenario is "running" |
| // - if the state if the second tc is "paused" |
| // 5. Pauses the first traffic case and checks |
| // - if the state of the scenario is "paused" |
| // - if the state if the first and the second tc is in state "paused" |
| //================================== |
| testcase tc_EPTF_LGenBase_Test_pauseTrafficCase() runs on EPTF_LGenBase_Test_CT { |
| //=== Prepare === |
| var integer vl_eGroupIdx:=0; |
| var template EPTF_LGenBase_EntityGroup vl_expectedEG:= f_EPTF_LGenBase_Test_createEntityGroup(); |
| v_dummyInt := f_EPTF_LGenBase_declareFunction("evalSuccess2",{evaluateSuccess4EntityAtEntityGroup2 := refers(f_LGenBase_Test_evalSuccess2) }); |
| var integer vl_fsmIdx := f_EPTF_LGenBase_Test_declareCompactFsmTable(); |
| var EPTF_LGenBase_TcMgmt_tcCustomParamDeclaratorList vl_params:={{"A","P","V"}}; |
| var charstring vl_tcTypeName1 := "TrafficCaseName1", vl_tcTypeName2 := "TrafficCaseName2"; |
| var EPTF_LGenBase_TcMgmt_tcTypeDeclarator2 vl_tcTypeDecl1 := { |
| name:=vl_tcTypeName1, |
| fsmName := "TestCompactFsmTable", |
| entityType := "TestEntityType", |
| customEntitySucc := "evalSuccess2" |
| }, |
| vl_tcTypeDecl2 := { |
| name:=vl_tcTypeName2, |
| fsmName := "TestCompactFsmTable", |
| entityType := "TestEntityType", |
| customEntitySucc := "evalSuccess2" |
| } |
| var integer vl_tcIdx1:=f_EPTF_LGenBase_declareTcType2(vl_tcTypeDecl1); |
| var integer vl_tcIdx2:=f_EPTF_LGenBase_declareTcType2(vl_tcTypeDecl2); |
| |
| var EPTF_LGenBase_TcMgmt_TcOfScenario2 vl_tcOfSc1:= f_LGenBase_Test_createTcOfSc2(vl_tcTypeName1); |
| var EPTF_LGenBase_TcMgmt_TcOfScenario2 vl_tcOfSc2:= f_LGenBase_Test_createTcOfSc2(vl_tcTypeName2); |
| |
| var EPTF_LGenBase_TcMgmt_ScenarioDeclarator2 vl_scType := { |
| name:="Sc1", |
| tcList := { vl_tcOfSc1, vl_tcOfSc2} |
| } |
| var integer vl_scIdx:=f_EPTF_LGenBase_declareScenarioType2( vl_scType); |
| |
| //===Create == |
| var EPTF_LGenBase_Scenario2Grp vl_sc := { |
| eGrpName:= valueof(vl_expectedEG.name), |
| scenarioName:="Sc1" |
| } |
| |
| f_EPTF_LGenBase_createScenario2EntityGroup(pl_scenarioDesc:=vl_sc, pl_autoStart:=true); |
| f_EPTF_LGenBase_Test_resetTrafficCaseStopped(); |
| |
| //******* The tested function: *********** |
| f_EPTF_LGenBase_pauseTrafficCase(vl_sc.eGrpName, vl_sc.scenarioName, vl_tcTypeName2) |
| |
| //log( ">>>DEBUG: v_LGenBase_trafficCases: ",v_LGenBase_trafficCases); |
| //check scenarioState: |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getScenarioState(vl_eGroupIdx,vl_scIdx)==c_EPTF_LGenBase_tcStateRunning); |
| |
| //check trafficCase state: |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getTrafficCaseState(pl_tcIdx:=vl_tcIdx1)==c_EPTF_LGenBase_tcStateRunning); |
| |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getTrafficCaseState(pl_tcIdx:=vl_tcIdx2)==c_EPTF_LGenBase_tcStatePaused); |
| |
| //check if fsm event generated a test step: |
| f_EPTF_LGenBase_Test_setVerdictFromBool( not f_EPTF_LGenBase_Test_isTrafficCaseStopped()); |
| |
| //******* The tested function: *********** |
| f_EPTF_LGenBase_pauseTrafficCase(vl_sc.eGrpName, vl_sc.scenarioName, vl_tcTypeName1) |
| |
| //check scenarioState: |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getScenarioState(vl_eGroupIdx,vl_scIdx)==c_EPTF_LGenBase_tcStatePaused); |
| |
| //check trafficCase state: |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getTrafficCaseState(pl_tcIdx:=vl_tcIdx1)==c_EPTF_LGenBase_tcStatePaused); |
| |
| f_EPTF_LGenBase_Test_setVerdictFromBool( |
| f_LGenBase_Test_getTrafficCaseState(pl_tcIdx:=vl_tcIdx2)==c_EPTF_LGenBase_tcStatePaused); |
| |
| //check if fsm event generated a test step: |
| f_EPTF_LGenBase_Test_setVerdictFromBool( not f_EPTF_LGenBase_Test_isTrafficCaseStopped()); |
| |
| f_EPTF_Base_cleanup_CT(); |
| } |
| //================================= |
| // function f_EPTF_LGenBase_pauseTrafficCaseByIdx |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_stopTcTimerInternal |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_stopScTimerInternal |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_disableTrafficCaseInternal |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_enableEntityInTrafficCase |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_disableEntityInTrafficCase |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_provisionTrafficCase |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_validateIdxList |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_validateScenarioType |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_scNameIndexInEG |
| //================================== |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_scNameIndexInEG |
| // Subject: f_EPTF_LGenBase_scNameIndexInEG |
| // Status: Ready, passed |
| //================================== |
| testcase tc_EPTF_LGenBase_Test_scNameIndexInEG() runs on EPTF_LGenBase_Test_CT { |
| //=== Prepare === |
| var EPTF_LGenBase_EntityGroup vl_expectedEG:= f_EPTF_LGenBase_Test_createEntityGroup(); |
| v_dummyInt := f_EPTF_LGenBase_declareFunction("evalSuccess2",{evaluateSuccess4EntityAtEntityGroup2 := refers(f_LGenBase_Test_evalSuccess2) }); |
| var integer vl_fsmIdx := f_EPTF_LGenBase_Test_declareCompactFsmTable(); |
| var charstring vl_tcTypeName := "TrafficCaseName"; |
| var EPTF_LGenBase_TcMgmt_tcTypeDeclarator2 vl_tcTypeDecl := { |
| name:=vl_tcTypeName, |
| fsmName := "TestCompactFsmTable", |
| entityType := "TestEntityType", |
| customEntitySucc := "evalSuccess2" |
| } |
| var integer vl_tcIdx:=f_EPTF_LGenBase_declareTcType2(vl_tcTypeDecl); |
| var EPTF_LGenBase_TcMgmt_TcOfScenario2 vl_tcOfSc:= f_LGenBase_Test_createTcOfSc2(vl_tcTypeName); |
| |
| var EPTF_LGenBase_TcMgmt_ScenarioDeclarator2 |
| vl_scType1 := { name:="Sc1",tcList := { vl_tcOfSc}}, |
| vl_scType2 := { name:="Sc2",tcList := { vl_tcOfSc}}, |
| vl_scType3 := { name:="Sc3",tcList := { vl_tcOfSc}}; |
| |
| var integer |
| vl_scIdx1:=f_EPTF_LGenBase_declareScenarioType2( vl_scType1), |
| vl_scIdx2:=f_EPTF_LGenBase_declareScenarioType2( vl_scType2), |
| vl_scIdx3:=f_EPTF_LGenBase_declareScenarioType2( vl_scType3); |
| |
| //===Create == |
| var EPTF_LGenBase_Scenario2Grp vl_sc; |
| |
| for( var integer i:=1; i<4; i:=i+1) |
| { |
| vl_sc := { eGrpName:= vl_expectedEG.name, scenarioName:="Sc" & int2str(i) }; |
| f_EPTF_LGenBase_createScenario2EntityGroup(pl_scenarioDesc:=vl_sc, pl_autoStart:=false); |
| } |
| |
| //===Check:=== |
| if(vl_scType1.name == f_EPTF_LGenBase_scenarioName(0, 0) and |
| vl_scType2.name == f_EPTF_LGenBase_scenarioName(0, 1) and |
| vl_scType3.name == f_EPTF_LGenBase_scenarioName(0, 2)){ |
| setverdict(pass); |
| } else { |
| setverdict(fail); |
| } |
| |
| //==== MAIN TEST:==== |
| for( var integer i:=0; i<3; i:=i+1) { |
| f_EPTF_LGenBase_Test_setVerdictFromBool(f_EPTF_LGenBase_scNameIndexInEG(0,"Sc" & int2str(i+1))== i); |
| } |
| |
| f_EPTF_Base_cleanup_CT(); |
| |
| }//tc_ |
| |
| //================================= |
| // function f_EPTF_LGenBase_scNameInEG |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_tcOfScenario |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_tcTypeNameIndex |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_tcDescNameIndex |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_fsmNameIndex |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_entityGrpNameIndex -ready |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_entityTypeNameIndex |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_behaviorTypeNameIndex |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_functionNameIndex |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_scenarioNameIndex |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_executeFsmCell |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_demoNextStateCalc |
| //================================== |
| //================================= |
| // function f_EPTF_LGenBase_dispatchEvent |
| //================================== |
| //================================= |
| // Name:tc_EPTF_LGenBase_Test_dispatchEvent |
| // Subject: f_EPTF_LGenBase_dispatchEvent |
| // State: Ready,Passed |
| // Description: Basic functionality test: |
| // 1. Create an fsm table having one fsm level event, one entity level event and one general level event |
| // 2. dispatch events on different levels |
| // 3. Check if the listener on the correct level gets the event. |
| //================================== |
| testcase tc_EPTF_LGenBase_Test_dispatchEvent() runs on EPTF_LGenBase_Test_CT { |
| var charstring vl_bName:=tsp_EPTF_LGenBase_Test_behaviorTypeName; |
| var integer vl_eIdx:=0; |
| f_EPTF_LGenBase_Test_init(vl_bName, imst2); |
| |
| var integer vl_inputIdxG:=f_EPTF_LGenBase_declareFsmEvent( pl_bName:= vl_bName,pl_input:= "TestFsmEventGeneric" ); |
| var integer vl_inputIdxE:=f_EPTF_LGenBase_declareFsmEvent( pl_bName:= vl_bName,pl_input:= "TestFsmEventEntity" ); |
| var integer vl_inputIdxF:=f_EPTF_LGenBase_declareFsmEvent( pl_bName:= vl_bName,pl_input:= "TestFsmEventFsm" ); |
| |
| var EPTF_LGenBase_CompactFsmTable vl_fsmTable := { |
| name:= "TestCompactFsmTable", |
| stateList:= {"idle", "busy"}, |
| timerList:= { {"Timer1",0.1},{"Timer2", 2.0},{"Timer2", 2.0}}, |
| table := { |
| { |
| eventToListen:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxG, eventType:= general}, |
| cellRow:= { |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy1),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| }, |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy1),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| } |
| } |
| }, |
| { |
| eventToListen:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxE, eventType:= entity}, |
| cellRow:= { |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy2),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| }, |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy2),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| } |
| } |
| }, |
| { |
| eventToListen:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxF, eventType:= fsm}, |
| cellRow:= { |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy3),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| }, |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy3),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| } |
| } |
| } |
| } |
| } |
| |
| var integer vl_tIdx := f_EPTF_LGenBase_declareCompactFsmTable(vl_fsmTable); |
| |
| var integer vl_fsmCtxIdx:=f_EPTF_LGenBase_activateFsm(pl_eIdx:= vl_eIdx, pl_tIdx:= vl_tIdx, pl_sIdx:=0, pl_tcIdx:= -1) |
| var EPTF_LGenBase_ReportedEventDescriptor vl_event:= |
| { |
| event:={ bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxF, target:={ vl_eIdx,vl_fsmCtxIdx}, source := omit}, |
| reportedArgs:= {} |
| } |
| |
| //=== Sub-Testcase 1: Fsm Level=== |
| f_EPTF_LGenBase_Test_resetAllDummyTestStepAndListenerFlag(); |
| |
| f_EPTF_LGenBase_dispatchEvent(vl_event); |
| |
| f_EPTF_LGenBase_Test_setVerdictFromBool(f_EPTF_LGenBase_Test_isDummyTestStep3Called()); |
| f_EPTF_LGenBase_Test_setVerdictFromBool(not f_EPTF_LGenBase_Test_isDummyTestStep1Called()); |
| f_EPTF_LGenBase_Test_setVerdictFromBool(not f_EPTF_LGenBase_Test_isDummyTestStep2Called()); |
| |
| //===Sub-Testcase2: Generic Level=== |
| f_EPTF_LGenBase_Test_resetAllDummyTestStepAndListenerFlag(); |
| |
| f_EPTF_LGenBase_dispatchEvent( { |
| event:={ bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxG, target:=omit, source := omit}, |
| reportedArgs:= {} |
| }); |
| |
| f_EPTF_LGenBase_Test_setVerdictFromBool(f_EPTF_LGenBase_Test_isDummyTestStep1Called()); |
| f_EPTF_LGenBase_Test_setVerdictFromBool(not f_EPTF_LGenBase_Test_isDummyTestStep2Called()); |
| f_EPTF_LGenBase_Test_setVerdictFromBool(not f_EPTF_LGenBase_Test_isDummyTestStep3Called()); |
| |
| //===Sub-Testcase3: Entity Level=== |
| f_EPTF_LGenBase_Test_resetAllDummyTestStepAndListenerFlag(); |
| |
| f_EPTF_LGenBase_dispatchEvent( { |
| event:={ bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxE, target:={ vl_eIdx,omit}, source := omit}, |
| reportedArgs:= {} |
| }); |
| |
| f_EPTF_LGenBase_Test_setVerdictFromBool(f_EPTF_LGenBase_Test_isDummyTestStep2Called()); |
| f_EPTF_LGenBase_Test_setVerdictFromBool(not f_EPTF_LGenBase_Test_isDummyTestStep1Called()); |
| f_EPTF_LGenBase_Test_setVerdictFromBool(not f_EPTF_LGenBase_Test_isDummyTestStep3Called()); |
| |
| f_EPTF_Base_cleanup_CT(); |
| }//tc_ |
| |
| //================================= |
| // Name:tc_EPTF_LGenBase_Test_dispatchEvent_3ListenersOnDifferentLevels_reportFsmEvent |
| // Subject: f_EPTF_LGenBase_dispatchEvent |
| // State: Ready,Passed |
| // Description: Test this statement: "An fsm level report defined by (b,i,e,fsm) shall be listened |
| // by general listener (b,i), entity listener (b,i,e) and by fsm listener (b,i,e,fsm)" |
| // |
| //================================== |
| testcase tc_EPTF_LGenBase_Test_dispatchEvent_3ListenersOnDifferentLevels_reportFsmEvent() runs on EPTF_LGenBase_Test_CT { |
| var charstring vl_bName:=tsp_EPTF_LGenBase_Test_behaviorTypeName; |
| var integer vl_eIdx:=0; |
| f_EPTF_LGenBase_Test_init(vl_bName, imst2); |
| |
| var integer vl_inputIdxG:=f_EPTF_LGenBase_declareFsmEvent( pl_bName:= vl_bName,pl_input:= "TestFsmEventGeneric" ); |
| //var integer vl_inputIdxE:=f_EPTF_LGenBase_declareFsmEvent( pl_bName:= vl_bName,pl_input:= "TestFsmEventEntity" ); |
| //var integer vl_inputIdxF:=f_EPTF_LGenBase_declareFsmEvent( pl_bName:= vl_bName,pl_input:= "TestFsmEventFsm" ); |
| |
| v_dummyInt := f_EPTF_LGenBase_addGenericEventListener( |
| pl_event:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxG, target:=omit, source := omit}, |
| pl_descr:={ name:="LGenBaseTest:DummyGenericEventListenerFunction", fn:=refers(f_EPTF_LGenBase_Test_DummyGenericEventListener), args:={}} ); |
| |
| v_dummyInt := f_EPTF_LGenBase_addEntityEventListener( |
| pl_event:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxG, target:={ vl_eIdx, omit}, source := omit}, |
| pl_descr:={ name:="LGenBaseTest:DummyEntityEventListenerFunction", fn:=refers(f_EPTF_LGenBase_Test_DummyEntityEventListener), args:={}} ); |
| |
| var EPTF_LGenBase_CompactFsmTable vl_fsmTable := { |
| name:= "TestCompactFsmTable", |
| stateList:= {"idle", "busy"}, |
| timerList:= { {"Timer1",0.1},{"Timer2", 2.0},{"Timer2", 2.0}}, |
| table := { |
| // { |
| // eventToListen:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxE, eventType:= general}, |
| // cellRow:= { |
| // { |
| // actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy1),stepContextArgs:={}}}, |
| // nextStateCalculation:=omit, |
| // nextState:=omit |
| // }, |
| // { |
| // actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy1),stepContextArgs:={}}}, |
| // nextStateCalculation:=omit, |
| // nextState:=omit |
| // } |
| // } |
| // }, |
| // { |
| // eventToListen:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxF, eventType:= entity}, |
| // cellRow:= { |
| // { |
| // actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy2),stepContextArgs:={}}}, |
| // nextStateCalculation:=omit, |
| // nextState:=omit |
| // }, |
| // { |
| // actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy2),stepContextArgs:={}}}, |
| // nextStateCalculation:=omit, |
| // nextState:=omit |
| // } |
| // } |
| // }, |
| { |
| eventToListen:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxG, eventType:= fsm}, |
| cellRow:= { |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy3),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| }, |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy3),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| } |
| } |
| } |
| } |
| } |
| |
| var integer vl_tIdx := f_EPTF_LGenBase_declareCompactFsmTable(vl_fsmTable); |
| |
| var integer vl_fsmCtxIdx:=f_EPTF_LGenBase_activateFsm(pl_eIdx:= vl_eIdx, pl_tIdx:= vl_tIdx, pl_sIdx:=0, pl_tcIdx:= 0) |
| var EPTF_LGenBase_ReportedEventDescriptor vl_event:= |
| { |
| event:={ bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxG, target:={ vl_eIdx,vl_fsmCtxIdx}, source := omit}, |
| reportedArgs:= {} |
| } |
| |
| f_EPTF_LGenBase_Test_resetAllDummyTestStepAndListenerFlag(); |
| |
| f_EPTF_LGenBase_dispatchEvent(vl_event); |
| |
| f_EPTF_LGenBase_Test_setVerdictFromBool(f_EPTF_LGenBase_Test_isDummyTestStep3Called()); //listener on fsm level |
| f_EPTF_LGenBase_Test_setVerdictFromBool(f_EPTF_LGenBase_Test_isDummyGenericEventListenerCalled()); |
| f_EPTF_LGenBase_Test_setVerdictFromBool(f_EPTF_LGenBase_Test_isDummyEntityEventListenerCalled()); |
| |
| f_EPTF_Base_cleanup_CT(); |
| }//tc_ |
| //================================= |
| // Name:tc_EPTF_LGenBase_Test_dispatchEvent_ListenersOnGeneralAndEntityLevel_reportfsmEvent |
| // Subject: f_EPTF_LGenBase_dispatchEvent |
| // State: Ready,Passed |
| // Description: Test this statement: "An fsm level report defined by (b,i,e,fsm) shall be listened |
| // by general listener (b,i), entity listener (b,i,e) and by by fsm listener (b,i,e,fsm) of fsm level" |
| // |
| //================================== |
| testcase tc_EPTF_LGenBase_Test_dispatchEvent_ListenersOnGeneralAndEntityLevel_reportfsmEvent() runs on EPTF_LGenBase_Test_CT { |
| var charstring vl_bName:=tsp_EPTF_LGenBase_Test_behaviorTypeName; |
| var integer vl_eIdx:=0; |
| f_EPTF_LGenBase_Test_init(vl_bName, imst2); |
| |
| var integer vl_inputIdxG:=f_EPTF_LGenBase_declareFsmEvent( pl_bName:= vl_bName,pl_input:= "TestFsmEventGeneric" ); |
| // var integer vl_inputIdxE:=f_EPTF_LGenBase_declareFsmEvent( pl_bName:= vl_bName,pl_input:= "TestFsmEventEntity" ); |
| // var integer vl_inputIdxF:=f_EPTF_LGenBase_declareFsmEvent( pl_bName:= vl_bName,pl_input:= "TestFsmEventFsm" ); |
| |
| v_dummyInt := f_EPTF_LGenBase_addGenericEventListener( |
| pl_event:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxG, target:=omit, source := omit}, |
| pl_descr:={ name:="LGenBaseTest:DummyGenericEventListenerFunction", fn:=refers(f_EPTF_LGenBase_Test_DummyGenericEventListener), args:={}} ); |
| |
| v_dummyInt := f_EPTF_LGenBase_addEntityEventListener( |
| pl_event:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxG, target:={ vl_eIdx, omit}, source := omit}, |
| pl_descr:={ name:="LGenBaseTest:DummyEntityEventListenerFunction", fn:=refers(f_EPTF_LGenBase_Test_DummyEntityEventListener), args:={}} ); |
| |
| var EPTF_LGenBase_CompactFsmTable vl_fsmTable := { |
| name:= "TestCompactFsmTable", |
| stateList:= {"idle", "busy"}, |
| timerList:= { {"Timer1",0.1},{"Timer2", 2.0},{"Timer2", 2.0}}, |
| table := { |
| // { |
| // eventToListen:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxE, eventType:= entity}, |
| // cellRow:= { |
| // { |
| // actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy1),stepContextArgs:={}}}, |
| // nextStateCalculation:=omit, |
| // nextState:=omit |
| // }, |
| // { |
| // actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy1),stepContextArgs:={}}}, |
| // nextStateCalculation:=omit, |
| // nextState:=omit |
| // } |
| // } |
| // }, |
| // { |
| // eventToListen:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxF, eventType:= entity}, |
| // cellRow:= { |
| // { |
| // actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy2),stepContextArgs:={}}}, |
| // nextStateCalculation:=omit, |
| // nextState:=omit |
| // }, |
| // { |
| // actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy2),stepContextArgs:={}}}, |
| // nextStateCalculation:=omit, |
| // nextState:=omit |
| // } |
| // } |
| // }, |
| { |
| eventToListen:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxG, eventType:= fsm}, |
| cellRow:= { |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy3),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| }, |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy3),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| } |
| } |
| } |
| } |
| } |
| |
| var integer vl_tIdx := f_EPTF_LGenBase_declareCompactFsmTable(vl_fsmTable); |
| |
| var integer vl_fsmCtxIdx:=f_EPTF_LGenBase_activateFsm(pl_eIdx:= vl_eIdx, pl_tIdx:= vl_tIdx, pl_sIdx:=0, pl_tcIdx:= 0) |
| var EPTF_LGenBase_ReportedEventDescriptor vl_event:= |
| { |
| event:={ bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxG, target:={ vl_eIdx,vl_fsmCtxIdx}, source := omit}, |
| reportedArgs:= {} |
| } |
| |
| f_EPTF_LGenBase_Test_resetAllDummyTestStepAndListenerFlag(); |
| |
| f_EPTF_LGenBase_dispatchEvent(vl_event); |
| |
| f_EPTF_LGenBase_Test_setVerdictFromBool(f_EPTF_LGenBase_Test_isDummyTestStep3Called()); //listener on fsm level |
| f_EPTF_LGenBase_Test_setVerdictFromBool(f_EPTF_LGenBase_Test_isDummyGenericEventListenerCalled()); |
| f_EPTF_LGenBase_Test_setVerdictFromBool(f_EPTF_LGenBase_Test_isDummyEntityEventListenerCalled()); |
| |
| f_EPTF_Base_cleanup_CT(); |
| }//tc_ |
| |
| //================================= |
| // Name:tc_EPTF_LGenBase_Test_dispatchEvent_ListenersOnGeneralAndEntityLevel_reportEntityEvent |
| // Subject: f_EPTF_LGenBase_dispatchEvent |
| // State: Ready, Failed at the first setverdict, TR: 16459 |
| // Description: Test this statement: "An entity level report defined by (b,i,e) shall be listened |
| // by general listener (b,i), entity listener (b,i,e) and by fsm listener (b,i,e,fsm)" |
| // |
| //================================== |
| testcase tc_EPTF_LGenBase_Test_dispatchEvent_ListenersOnGeneralAndEntityLevel_reportEntityEvent() runs on EPTF_LGenBase_Test_CT { |
| var charstring vl_bName:=tsp_EPTF_LGenBase_Test_behaviorTypeName; |
| var integer vl_eIdx:=0; |
| f_EPTF_LGenBase_Test_init(vl_bName, imst2); |
| |
| var integer vl_inputIdxG:=f_EPTF_LGenBase_declareFsmEvent( pl_bName:= vl_bName,pl_input:= "TestFsmEventG" ); |
| var integer vl_inputIdxE:=f_EPTF_LGenBase_declareFsmEvent( pl_bName:= vl_bName,pl_input:= "TestFsmEventE" ); |
| var integer vl_inputIdxF:=f_EPTF_LGenBase_declareFsmEvent( pl_bName:= vl_bName,pl_input:= "TestFsmEventF" ); |
| |
| v_dummyInt := f_EPTF_LGenBase_addGenericEventListener( |
| pl_event:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxG, target:=omit, source := omit}, |
| pl_descr:={ name:="LGenBaseTest:DummyGenericEventListenerFunction", fn:=refers(f_EPTF_LGenBase_Test_DummyGenericEventListener), args:={}} ); |
| |
| v_dummyInt := f_EPTF_LGenBase_addEntityEventListener( |
| pl_event:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxG, target:={ vl_eIdx, omit}, source := omit}, |
| pl_descr:={ name:="LGenBaseTest:DummyEntityEventListenerFunction", fn:=refers(f_EPTF_LGenBase_Test_DummyEntityEventListener), args:={}} ); |
| |
| var EPTF_LGenBase_CompactFsmTable vl_fsmTable := { |
| name:= "TestCompactFsmTable", |
| stateList:= {"idle", "busy"}, |
| timerList:= { {"Timer1",0.1},{"Timer2", 2.0},{"Timer2", 2.0}}, |
| table := { |
| { |
| eventToListen:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxE, eventType:= entity}, |
| cellRow:= { |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy1),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| }, |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy1),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| } |
| } |
| }, |
| { |
| eventToListen:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxF, eventType:= entity}, |
| cellRow:= { |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy2),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| }, |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy2),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| } |
| } |
| }, |
| { |
| eventToListen:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxG, eventType:= entity}, |
| cellRow:= { |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy3),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| }, |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy3),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| } |
| } |
| } |
| } |
| } |
| |
| var integer vl_tIdx := f_EPTF_LGenBase_declareCompactFsmTable(vl_fsmTable); |
| |
| var integer vl_fsmCtxIdx:=f_EPTF_LGenBase_activateFsm(pl_eIdx:= vl_eIdx, pl_tIdx:= vl_tIdx, pl_sIdx:=0, pl_tcIdx:= 0) |
| var EPTF_LGenBase_ReportedEventDescriptor vl_event:= |
| { |
| event:={ bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxG, target:={ vl_eIdx,omit} , source := omit}, |
| reportedArgs:= {} |
| } |
| |
| f_EPTF_LGenBase_Test_resetAllDummyTestStepAndListenerFlag(); |
| |
| f_EPTF_LGenBase_dispatchEvent(vl_event); |
| |
| f_EPTF_LGenBase_Test_setVerdictFromBool(f_EPTF_LGenBase_Test_isDummyTestStep3Called()); //fails: TR 16459 |
| f_EPTF_LGenBase_Test_setVerdictFromBool(f_EPTF_LGenBase_Test_isDummyGenericEventListenerCalled());//listener on generic level |
| f_EPTF_LGenBase_Test_setVerdictFromBool(f_EPTF_LGenBase_Test_isDummyEntityEventListenerCalled()); //listener on entity level |
| |
| f_EPTF_Base_cleanup_CT(); |
| }//tc_ |
| |
| //================================= |
| // Name:tc_EPTF_LGenBase_Test_dispatchEvent_ListenersOn2DifferentLevels_reportGenericEvent |
| // Subject: f_EPTF_LGenBase_dispatchEvent |
| // State: Ready,Passed |
| // Description: Tests this statement: "A generic level report defined by (b,i,e) shall be listened |
| // by general listener (b,i) of fsm table or defined by AddListener but not by entity listener(b,i,e)" |
| // |
| //================================== |
| testcase tc_EPTF_LGenBase_Test_dispatchEvent_ListenersOn2DifferentLevels_reportGenericEvent() runs on EPTF_LGenBase_Test_CT { |
| var charstring vl_bName:=tsp_EPTF_LGenBase_Test_behaviorTypeName; |
| var integer vl_eIdx:=0; |
| f_EPTF_LGenBase_Test_init(vl_bName, imst2); |
| |
| var integer vl_inputIdxG:=f_EPTF_LGenBase_declareFsmEvent( pl_bName:= vl_bName,pl_input:= "TestFsmEventG" ); |
| // var integer vl_inputIdxE:=f_EPTF_LGenBase_declareFsmEvent( pl_bName:= vl_bName,pl_input:= "TestFsmEventE" ); |
| // var integer vl_inputIdxF:=f_EPTF_LGenBase_declareFsmEvent( pl_bName:= vl_bName,pl_input:= "TestFsmEventF" ); |
| |
| v_dummyInt := f_EPTF_LGenBase_addGenericEventListener( |
| pl_event:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxG, target:=omit, source := omit}, |
| pl_descr:={ name:="LGenBaseTest:DummyGenericEventListenerFunction", fn:=refers(f_EPTF_LGenBase_Test_DummyGenericEventListener), args:={}} ); |
| |
| v_dummyInt := f_EPTF_LGenBase_addEntityEventListener( |
| pl_event:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxG, target:={ vl_eIdx, omit}, source := omit}, |
| pl_descr:={ name:="LGenBaseTest:DummyEntityEventListenerFunction", fn:=refers(f_EPTF_LGenBase_Test_DummyEntityEventListener), args:={}} ); |
| |
| var EPTF_LGenBase_CompactFsmTable vl_fsmTable := { |
| name:= "TestCompactFsmTable", |
| stateList:= {"idle", "busy"}, |
| timerList:= { {"Timer1",0.1},{"Timer2", 2.0},{"Timer2", 2.0}}, |
| table := { |
| // { |
| // eventToListen:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxE, eventType:= entity}, |
| // cellRow:= { |
| // { |
| // actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy1),stepContextArgs:={}}}, |
| // nextStateCalculation:=omit, |
| // nextState:=omit |
| // }, |
| // { |
| // actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy1),stepContextArgs:={}}}, |
| // nextStateCalculation:=omit, |
| // nextState:=omit |
| // } |
| // } |
| // }, |
| // { |
| // eventToListen:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxF, eventType:= entity}, |
| // cellRow:= { |
| // { |
| // actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy2),stepContextArgs:={}}}, |
| // nextStateCalculation:=omit, |
| // nextState:=omit |
| // }, |
| // { |
| // actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy2),stepContextArgs:={}}}, |
| // nextStateCalculation:=omit, |
| // nextState:=omit |
| // } |
| // } |
| // }, |
| { |
| eventToListen:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxG, eventType:= general}, |
| cellRow:= { |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy3),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| }, |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy3),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| } |
| } |
| } |
| } |
| } |
| |
| var integer vl_tIdx := f_EPTF_LGenBase_declareCompactFsmTable(vl_fsmTable); |
| |
| var integer vl_fsmCtxIdx:=f_EPTF_LGenBase_activateFsm(pl_eIdx:= vl_eIdx, pl_tIdx:= vl_tIdx, pl_sIdx:=0, pl_tcIdx:= 0) |
| var EPTF_LGenBase_ReportedEventDescriptor vl_event:= |
| { |
| event:={ bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxG, target:=omit, source := omit}, |
| reportedArgs:= {} |
| } |
| |
| f_EPTF_LGenBase_Test_resetAllDummyTestStepAndListenerFlag(); |
| |
| f_EPTF_LGenBase_dispatchEvent(vl_event); |
| |
| f_EPTF_LGenBase_Test_setVerdictFromBool(f_EPTF_LGenBase_Test_isDummyTestStep3Called()); //listener on generic level |
| f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isDummyGenericEventListenerCalled());//listener on generic level |
| f_EPTF_LGenBase_Test_setVerdictFromBool( not f_EPTF_LGenBase_Test_isDummyEntityEventListenerCalled()); //listener on entity level |
| |
| f_EPTF_Base_cleanup_CT(); |
| }//tc_ |
| |
| //================================= |
| // Name:tc_EPTF_LGenBase_Test_dispatchEvent_ListenersOnGenericAndFsmLevel_reportGenericEvent |
| // Subject: f_EPTF_LGenBase_dispatchEvent |
| // State: Ready,Passed |
| // Description: Tests this statement: "A generic level report defined by (b,i) shall be listened |
| // by general listener (b,i) but not by fsm listener (b,i,e,fsm)" |
| // |
| //================================== |
| testcase tc_EPTF_LGenBase_Test_dispatchEvent_ListenersOnGenericAndFsmLevel_reportGenericEvent() runs on EPTF_LGenBase_Test_CT { |
| var charstring vl_bName:=tsp_EPTF_LGenBase_Test_behaviorTypeName; |
| var integer vl_eIdx:=0; |
| f_EPTF_LGenBase_Test_init(vl_bName, imst2); |
| |
| var integer vl_inputIdxG:=f_EPTF_LGenBase_declareFsmEvent( pl_bName:= vl_bName,pl_input:= "TestFsmEventG" ); |
| // var integer vl_inputIdxE:=f_EPTF_LGenBase_declareFsmEvent( pl_bName:= vl_bName,pl_input:= "TestFsmEventE" ); |
| // var integer vl_inputIdxF:=f_EPTF_LGenBase_declareFsmEvent( pl_bName:= vl_bName,pl_input:= "TestFsmEventF" ); |
| |
| v_dummyInt := f_EPTF_LGenBase_addGenericEventListener( |
| pl_event:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxG, target:=omit, source := omit}, |
| pl_descr:={ name:="LGenBaseTest:DummyGenericEventListenerFunction", fn:=refers(f_EPTF_LGenBase_Test_DummyGenericEventListener), args:={}} ); |
| |
| // f_EPTF_LGenBase_addEntityEventListener( |
| // pl_event:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxG, target:={ vl_eIdx, omit}}, |
| // pl_descr:={ name:="LGenBaseTest:DummyEntityEventListenerFunction", fn:=refers(f_EPTF_LGenBase_Test_DummyEntityEventListener), args:={}} ); |
| |
| var EPTF_LGenBase_CompactFsmTable vl_fsmTable := { |
| name:= "TestCompactFsmTable", |
| stateList:= {"idle", "busy"}, |
| timerList:= { {"Timer1",0.1},{"Timer2", 2.0},{"Timer2", 2.0}}, |
| table := { |
| // { |
| // eventToListen:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxE, eventType:= entity}, |
| // cellRow:= { |
| // { |
| // actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy1),stepContextArgs:={}}}, |
| // nextStateCalculation:=omit, |
| // nextState:=omit |
| // }, |
| // { |
| // actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy1),stepContextArgs:={}}}, |
| // nextStateCalculation:=omit, |
| // nextState:=omit |
| // } |
| // } |
| // }, |
| // { |
| // eventToListen:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxF, eventType:= entity}, |
| // cellRow:= { |
| // { |
| // actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy2),stepContextArgs:={}}}, |
| // nextStateCalculation:=omit, |
| // nextState:=omit |
| // }, |
| // { |
| // actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy2),stepContextArgs:={}}}, |
| // nextStateCalculation:=omit, |
| // nextState:=omit |
| // } |
| // } |
| // }, |
| { |
| eventToListen:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxG, eventType:= fsm}, |
| cellRow:= { |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy3),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| }, |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy3),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| } |
| } |
| } |
| } |
| } |
| |
| var integer vl_tIdx := f_EPTF_LGenBase_declareCompactFsmTable(vl_fsmTable); |
| |
| var integer vl_fsmCtxIdx:=f_EPTF_LGenBase_activateFsm(pl_eIdx:= vl_eIdx, pl_tIdx:= vl_tIdx, pl_sIdx:=0, pl_tcIdx:= 0) |
| var EPTF_LGenBase_ReportedEventDescriptor vl_event:= |
| { |
| event:={ bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxG, target:=omit, source := omit}, |
| reportedArgs:= {} |
| } |
| |
| f_EPTF_LGenBase_Test_resetAllDummyTestStepAndListenerFlag(); |
| |
| f_EPTF_LGenBase_dispatchEvent(vl_event); |
| |
| f_EPTF_LGenBase_Test_setVerdictFromBool(not f_EPTF_LGenBase_Test_isDummyTestStep3Called()); //listener on fsm level |
| f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isDummyGenericEventListenerCalled());//listener on generic level |
| |
| f_EPTF_Base_cleanup_CT(); |
| }//tc_ |
| |
| //================================= |
| // Name:tc_EPTF_LGenBase_Test_dispatchEvent_DuplicatedEventToBeListenedInFsm_fsm |
| // Subject: f_EPTF_LGenBase_dispatchEvent |
| // State: Ready, failed, TR: 16465 |
| // Description: Tests this statement: "A fsm level report defined by (b,i, e, fsm) shall be listened |
| // by general listener (b,i) and by fsm listener (b,i,e,fsm)" |
| // and this: "An fsm table can contain twice the same event to listen" |
| //================================== |
| testcase tc_EPTF_LGenBase_Test_dispatchEvent_DuplicatedEventToBeListenedInFsm_fsm() runs on EPTF_LGenBase_Test_CT { |
| var charstring vl_bName:=tsp_EPTF_LGenBase_Test_behaviorTypeName; |
| var integer vl_eIdx:=0; |
| f_EPTF_LGenBase_Test_init(vl_bName, imst2); |
| |
| var integer vl_inputIdxE:=f_EPTF_LGenBase_declareFsmEvent( pl_bName:= vl_bName,pl_input:= "TestFsmEventE" ); |
| |
| var EPTF_LGenBase_CompactFsmTable vl_fsmTable := { |
| name:= "TestCompactFsmTable", |
| stateList:= {"idle", "busy"}, |
| timerList:= { {"Timer1",0.1},{"Timer2", 2.0},{"Timer2", 2.0}}, |
| table := { |
| { |
| eventToListen:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxE, eventType:= fsm}, |
| cellRow:= { |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy1),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| }, |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy1),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| } |
| } |
| }, |
| { |
| eventToListen:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxE, eventType:= fsm}, |
| cellRow:= { |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy2),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| }, |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy2),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| } |
| } |
| }, |
| { |
| eventToListen:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxE, eventType:= general}, |
| cellRow:= { |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy3),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| }, |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy3),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| } |
| } |
| } |
| } |
| } |
| |
| var integer vl_tIdx := f_EPTF_LGenBase_declareCompactFsmTable(vl_fsmTable); |
| |
| var integer vl_fsmCtxIdx:=f_EPTF_LGenBase_activateFsm(pl_eIdx:= vl_eIdx, pl_tIdx:= vl_tIdx, pl_sIdx:=0, pl_tcIdx:= 0) |
| var EPTF_LGenBase_ReportedEventDescriptor vl_event:= |
| { |
| event:={ bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxE, target:={vl_eIdx,vl_fsmCtxIdx}, source := omit}, |
| reportedArgs:= {} |
| } |
| |
| f_EPTF_LGenBase_Test_resetAllDummyTestStepAndListenerFlag(); |
| |
| f_EPTF_LGenBase_dispatchEvent(vl_event); |
| |
| f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isDummyTestStep1Called()); //vl_inputIdxE --pass |
| f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isDummyTestStep2Called()); // vl_inputIdxE -- fails, TR 16465 |
| f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isDummyTestStep3Called()); // vl_inputIdxE --pass |
| |
| f_EPTF_Base_cleanup_CT(); |
| }//tc_ |
| |
| //================================= |
| // Name:tc_EPTF_LGenBase_Test_dispatchEvent_DuplicatedEventToBeListenedInFsm_entity |
| // Subject: f_EPTF_LGenBase_dispatchEvent |
| // State: Ready, failed, TR: 16465 |
| // Description: Tests this statement: "An entity level report defined by (b,i, e) shall be listened |
| // by general listener and by entity listeners of the same fsm table" |
| // |
| //================================== |
| testcase tc_EPTF_LGenBase_Test_dispatchEvent_DuplicatedEventToBeListenedInFsm_entity() runs on EPTF_LGenBase_Test_CT { |
| var charstring vl_bName:=tsp_EPTF_LGenBase_Test_behaviorTypeName; |
| var integer vl_eIdx:=0; |
| f_EPTF_LGenBase_Test_init(vl_bName, imst2); |
| |
| var integer vl_inputIdxG:=f_EPTF_LGenBase_declareFsmEvent( pl_bName:= vl_bName,pl_input:= "TestFsmEventG" ); |
| var integer vl_inputIdxE:=f_EPTF_LGenBase_declareFsmEvent( pl_bName:= vl_bName,pl_input:= "TestFsmEventE" ); |
| var integer vl_inputIdxF:=f_EPTF_LGenBase_declareFsmEvent( pl_bName:= vl_bName,pl_input:= "TestFsmEventF" ); |
| |
| |
| var EPTF_LGenBase_CompactFsmTable vl_fsmTable := { |
| name:= "TestCompactFsmTable", |
| stateList:= {"idle", "busy"}, |
| timerList:= { {"Timer1",0.1},{"Timer2", 2.0},{"Timer2", 2.0}}, |
| table := { |
| { |
| eventToListen:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxE, eventType:= entity}, |
| cellRow:= { |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy1),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| }, |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy1),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| } |
| } |
| }, |
| { |
| eventToListen:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxE, eventType:= entity}, |
| cellRow:= { |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy2),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| }, |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy2),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| } |
| } |
| }, |
| { |
| eventToListen:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxE, eventType:= general}, |
| cellRow:= { |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy3),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| }, |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy3),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| } |
| } |
| } |
| } |
| } |
| |
| var integer vl_tIdx := f_EPTF_LGenBase_declareCompactFsmTable(vl_fsmTable); |
| |
| var integer vl_fsmCtxIdx:=f_EPTF_LGenBase_activateFsm(pl_eIdx:= vl_eIdx, pl_tIdx:= vl_tIdx, pl_sIdx:=0, pl_tcIdx:= 0) |
| var EPTF_LGenBase_ReportedEventDescriptor vl_event:= |
| { |
| event:={ bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxE, target:={vl_eIdx,vl_fsmCtxIdx}, source := omit}, |
| reportedArgs:= {} |
| } |
| |
| f_EPTF_LGenBase_Test_resetAllDummyTestStepAndListenerFlag(); |
| |
| f_EPTF_LGenBase_dispatchEvent(vl_event); |
| |
| f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isDummyTestStep1Called()); //vl_inputIdxE -- pass |
| f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isDummyTestStep2Called()); // vl_inputIdxE -- fails,TR: 16465 |
| f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isDummyTestStep3Called()); // vl_inputIdxG --pass |
| |
| f_EPTF_Base_cleanup_CT(); |
| }//tc_ |
| /* |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_reportEvent4Generic |
| // Subject: f_EPTF_LGenBase_reportEvent4Generic |
| // State: ready, passed |
| // Description: 1. Declares event |
| // 2. Creates event listeners, one on generic level and one on entity level |
| // 3. checks if the reportEvent4Generic is processed only by the generic event listener. |
| //================================== |
| testcase tc_EPTF_LGenBase_Test_reportEvent4Generic() runs on EPTF_LGenBase_Test_CT { |
| var charstring vl_bName:=tsp_EPTF_LGenBase_Test_behaviorTypeName; |
| f_EPTF_LGenBase_Test_init(vl_bName, imst2); |
| |
| var EPTF_LGenBase_FsmEvent vl_input:="TestFsmEventGeneric"; |
| |
| var integer vl_inputIdxG:=f_EPTF_LGenBase_declareFsmEvent( |
| pl_bName:=vl_bName, |
| pl_input:= vl_input); |
| |
| var EPTF_LGenBase_ReportableEventDescriptor vl_eventG:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxG, target:=omit, source := omit}; |
| |
| //add generic eventListener |
| f_EPTF_LGenBase_addGenericEventListener( |
| pl_event:= vl_eventG, |
| pl_descr:={ name:="LGenBaseTest:DummyGenericEventListenerFunction", fn:=refers(f_EPTF_LGenBase_Test_DummyGenericEventListener), args:={}} ); |
| |
| var integer vl_myEntityIdx := 0; |
| var EPTF_LGenBase_ReportableEventDescriptor vl_eventE:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxG, target:={vl_myEntityIdx, omit}, source := omit} |
| |
| //add entity eventListener |
| f_EPTF_LGenBase_addEntityEventListener( |
| pl_event:= vl_eventE, |
| pl_descr:={ name:="LGenBaseTest:DummyEntityEventListenerFunction", fn:=refers(f_EPTF_LGenBase_Test_DummyEntityEventListener), args:={}} ); |
| |
| f_EPTF_LGenBase_reportEvent4Generic( pl_event:= { |
| event:=vl_eventG, |
| reportedArgs:={} |
| }) |
| |
| //check if the function is called: |
| f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isDummyGenericEventListenerCalled()); |
| f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isDummyEntityEventListenerCalled()==false); |
| |
| f_EPTF_Base_cleanup_CT(); |
| } |
| |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_reportEvent4Entity |
| // Subject: f_EPTF_LGenBase_reportEvent4Entity |
| // Description: 1. Declare event |
| // 2. Creates event listeners of entity level and of generic level |
| // 3. checks if the reportEvent4Entity is processed only by the entity event listener. |
| //================================== |
| testcase tc_EPTF_LGenBase_Test_reportEvent4Entity() runs on EPTF_LGenBase_Test_CT { |
| var charstring vl_bName:=tsp_EPTF_LGenBase_Test_behaviorTypeName; |
| f_EPTF_LGenBase_Test_init(vl_bName, imst2); |
| |
| var EPTF_LGenBase_FsmEvent vl_input:="TestFsmEventGeneric"; |
| |
| var integer vl_inputIdxD:=f_EPTF_LGenBase_declareFsmEvent( |
| pl_bName:=vl_bName, |
| pl_input:= vl_input); |
| |
| var EPTF_LGenBase_ReportableEventDescriptor vl_eventD:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxD, target:=omit, source := omit}; |
| var integer vl_myEntityIdx := 0; |
| |
| var EPTF_LGenBase_ReportableEventDescriptor vl_eventE:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxD, target:={vl_myEntityIdx, omit}, source := omit} |
| //add generic eventListener |
| f_EPTF_LGenBase_addGenericEventListener( |
| pl_event:= vl_eventD, |
| pl_descr:={ name:="LGenBaseTest:DummyGenericEventListenerFunction", fn:=refers(f_EPTF_LGenBase_Test_DummyGenericEventListener), args:={}} ); |
| |
| //add entity eventListener |
| f_EPTF_LGenBase_addEntityEventListener( |
| pl_event:= vl_eventE, |
| pl_descr:={ name:="LGenBaseTest:DummyEntityEventListenerFunction", fn:=refers(f_EPTF_LGenBase_Test_DummyEntityEventListener), args:={}} ); |
| |
| f_EPTF_LGenBase_reportEvent4Entity( pl_event:= { |
| event:=vl_eventE, |
| reportedArgs:={} |
| }) |
| |
| //check if the event listener function is called: |
| f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isDummyGenericEventListenerCalled()==false); |
| f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isDummyEntityEventListenerCalled()==true); |
| |
| f_EPTF_Base_cleanup_CT(); |
| } |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_reportEvent4Entity_2EventListeners4Entity |
| // Subject: f_EPTF_LGenBase_reportEvent4Entity |
| // Description: Checks if it is possible to use two listeners for the same entity and the same event (b,i) |
| // 1. Declares 2 events of entity level |
| // 2. Creates event listeners to them (One to each ) |
| // 3. checks if the reportEvent4Entity is processed by both event listener |
| // Expected result: both listener "listen" the event report |
| // State: ready, failed, TR: MTTSM00016458 |
| //================================== |
| testcase tc_EPTF_LGenBase_Test_reportEvent4Entity_2EventListeners4Entity() runs on EPTF_LGenBase_Test_CT { |
| var charstring vl_bName:=tsp_EPTF_LGenBase_Test_behaviorTypeName; |
| f_EPTF_LGenBase_Test_init(vl_bName, imst2); |
| |
| var integer vl_inputIdxE:=f_EPTF_LGenBase_declareFsmEvent( |
| pl_bName:= vl_bName, |
| pl_input:= "TestFsmEventEntityLevel"); |
| |
| var integer vl_myEntityIdx := 0; |
| var EPTF_LGenBase_ReportableEventDescriptor vl_eventDE:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxE, target:={vl_myEntityIdx, omit}, source := omit} |
| |
| //add entity eventListener 1: |
| f_EPTF_LGenBase_addEntityEventListener( |
| pl_event:= vl_eventDE, |
| pl_descr:={ name:="LGenBaseTest:DummyEntityEventListenerFunction1", fn:=refers(f_EPTF_LGenBase_Test_DummyEntityEventListener), args:={}} ); |
| |
| f_EPTF_LGenBase_addEntityEventListener( |
| pl_event:= vl_eventDE, |
| pl_descr:={ name:="LGenBaseTest:DummyEntityEventListenerFunction2", fn:=refers(f_EPTF_LGenBase_Test_DummyEntityEventListener2), args:={}} ); |
| |
| //++++The function to be tested:++++ |
| f_EPTF_LGenBase_reportEvent4Entity( pl_event:= { |
| event:=vl_eventDE, |
| reportedArgs:={} |
| }) |
| |
| //check if the event listener function is called: |
| f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isDummyEntityEventListenerCalled()==true); |
| f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isDummyEntityEventListener2Called()==true);//fails, TR: MTTSM00016458 |
| |
| f_EPTF_Base_cleanup_CT(); |
| }//tc_ |
| |
| //================================= |
| // Name: tc_EPTF_LGenBase_Test_reportEvent4Entity_entityAndGenericListeners |
| // Subject: f_EPTF_LGenBase_reportEvent4Entity |
| // Description: Checks if it is possible to use two listeners with the same entity |
| // 1. Declares 1 event |
| // 2. Creates a generic and an entity event listener for the same event |
| // 3. checks if the reportEvent4Entity is processed by the event listeners. Expected: only by entity event listener |
| //================================== |
| // testcase tc_EPTF_LGenBase_Test_reportEvent4Entity_entityAndGenericListeners() runs on EPTF_LGenBase_Test_CT { |
| // var charstring vl_bName:=tsp_EPTF_LGenBase_Test_behaviorTypeName; |
| // f_EPTF_LGenBase_Test_init(vl_bName, imst2); |
| // |
| // |
| // var integer vl_inputIdxE:=f_EPTF_LGenBase_declareFsmEvent( |
| // pl_bName:= vl_bName, |
| // pl_input:= "TestFsmEvent"); |
| // |
| // var integer vl_myEntityIdx := 0; |
| // //entity level: |
| // var EPTF_LGenBase_ReportableEventDescriptor vl_eventDE:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxE, target:={vl_myEntityIdx, omit}, source := omit} |
| // //generic level: |
| // var EPTF_LGenBase_ReportableEventDescriptor vl_eventDG:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxE, target:=omit, source := omit}; |
| // |
| // //add entity eventListener 1: |
| // f_EPTF_LGenBase_addEntityEventListener( |
| // pl_event:= vl_eventDE, |
| // pl_descr:={ name:="LGenBaseTest:DummyEntityEventListenerFunction1", fn:=refers(f_EPTF_LGenBase_Test_DummyEntityEventListener), args:={}} ); |
| // |
| // |
| // f_EPTF_LGenBase_addGenericEventListener( |
| // pl_event:= vl_eventDG, //input idx is the same as for vl_eventDE !! |
| // pl_descr:={ name:="LGenBaseTest:DummyGenericEventListenerFunction", fn:=refers(f_EPTF_LGenBase_Test_DummyGenericEventListener), args:={}} ); |
| // |
| // f_EPTF_LGenBase_reportEvent4Entity( pl_event:= { |
| // event:=vl_eventDE, |
| // reportedArgs:={} |
| // }) |
| // |
| // //check if the event listener function is called: |
| // |
| // f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isDummyEntityEventListenerCalled()==true); |
| // f_EPTF_LGenBase_Test_setVerdictFromBool( f_EPTF_LGenBase_Test_isDummyGenericEventListenerCalled()==false); |
| // |
| // f_EPTF_Base_cleanup_CT(); |
| // }//tc_ |
| |
| //================================= |
| // Name:tc_EPTF_LGenBase_Test_reportEvent4Fsm |
| // Subject: f_EPTF_LGenBase_reportEvent4Fsm |
| // State: Ready,failed TR: MTTSM00016459 |
| //================================== |
| testcase tc_EPTF_LGenBase_Test_reportEvent4Fsm () runs on EPTF_LGenBase_Test_CT { |
| var charstring vl_bName:=tsp_EPTF_LGenBase_Test_behaviorTypeName; |
| var integer vl_eIdx:=0; |
| f_EPTF_LGenBase_Test_init(vl_bName, imst2); |
| |
| var integer vl_inputIdxG:=f_EPTF_LGenBase_declareFsmEvent( pl_bName:= vl_bName,pl_input:= "TestFsmEventGeneric" ); |
| var integer vl_inputIdxE:=f_EPTF_LGenBase_declareFsmEvent( pl_bName:= vl_bName,pl_input:= "TestFsmEventEntity" ); |
| var integer vl_inputIdxF:=f_EPTF_LGenBase_declareFsmEvent( pl_bName:= vl_bName,pl_input:= "TestFsmEventFsm" ); |
| |
| f_EPTF_LGenBase_addGenericEventListener( |
| pl_event:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxG, target:=omit, source := omit}, |
| pl_descr:={ name:="LGenBaseTest:DummyGenericEventListenerFunction", fn:=refers(f_EPTF_LGenBase_Test_DummyGenericEventListener), args:={}} ); |
| |
| f_EPTF_LGenBase_addEntityEventListener( |
| pl_event:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxE, target:={ vl_eIdx, omit}, source := omit}, |
| pl_descr:={ name:="LGenBaseTest:DummyEntityEventListenerFunction", fn:=refers(f_EPTF_LGenBase_Test_DummyEntityEventListener), args:={}} ); |
| |
| f_EPTF_LGenBase_addGenericEventListener( |
| pl_event:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxF, target:=omit, source := omit}, |
| pl_descr:={ name:="LGenBaseTest:DummyGenericEventListenerFunction", fn:=refers(f_EPTF_LGenBase_Test_DummyGenericEventListener), args:={}} ); |
| |
| f_EPTF_LGenBase_addEntityEventListener( |
| pl_event:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxF, target:={ vl_eIdx, omit}, source := omit}, |
| pl_descr:={ name:="LGenBaseTest:DummyEntityEventListenerFunction", fn:=refers(f_EPTF_LGenBase_Test_DummyEntityEventListener), args:={}} ); |
| |
| var EPTF_LGenBase_CompactFsmTable vl_fsmTable := { |
| name:= "TestCompactFsmTable", |
| stateList:= {"idle", "busy"}, |
| timerList:= { {"Timer1",0.1},{"Timer2", 2.0},{"Timer2", 2.0}}, |
| table := { |
| { |
| eventToListen:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxG, eventType:= general}, |
| cellRow:= { |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy1),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| }, |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy1),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| } |
| } |
| }, |
| { |
| eventToListen:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxE, eventType:= entity}, |
| cellRow:= { |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy2),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| }, |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy2),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| } |
| } |
| }, |
| { |
| eventToListen:= { bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxF, eventType:= fsm}, |
| cellRow:= { |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy3),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| }, |
| { |
| actionList :={{ step:= refers(f_EPTF_LGenBase_Test_step_Dummy3),stepContextArgs:={}}}, |
| nextStateCalculation:=omit, |
| nextState:=omit |
| } |
| } |
| } |
| } |
| } |
| |
| var integer vl_tIdx := f_EPTF_LGenBase_declareCompactFsmTable(vl_fsmTable); |
| |
| var integer vl_fsmCtxIdx:=f_EPTF_LGenBase_activateFsm(pl_eIdx:= vl_eIdx, pl_tIdx:= vl_tIdx, pl_sIdx:=0, pl_tcIdx:= 0) |
| var EPTF_LGenBase_ReportedEventDescriptor vl_event:= |
| { |
| event:={ bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxF, target:={ vl_eIdx,vl_fsmCtxIdx}, source := omit}, |
| reportedArgs:= {} |
| } |
| |
| //=== Sub-Testcase 1: Fsm Level=== |
| f_EPTF_LGenBase_Test_resetAllDummyTestStepAndListenerFlag(); |
| |
| f_EPTF_LGenBase_reportEvent4Fsm(vl_event); |
| |
| f_EPTF_LGenBase_Test_setVerdictFromBool(f_EPTF_LGenBase_Test_isDummyTestStep3Called());//fails, TR 16459---- NOW it is working!!! ethbaat,2008-09-10 |
| f_EPTF_LGenBase_Test_setVerdictFromBool(not f_EPTF_LGenBase_Test_isDummyTestStep1Called()); |
| f_EPTF_LGenBase_Test_setVerdictFromBool(not f_EPTF_LGenBase_Test_isDummyTestStep2Called()); |
| f_EPTF_LGenBase_Test_setVerdictFromBool(not f_EPTF_LGenBase_Test_isDummyGenericEventListenerCalled()); |
| f_EPTF_LGenBase_Test_setVerdictFromBool(not f_EPTF_LGenBase_Test_isDummyEntityEventListenerCalled()); |
| |
| //===Sub-Testcase2: Generic Level=== |
| f_EPTF_LGenBase_Test_resetAllDummyTestStepAndListenerFlag(); |
| |
| f_EPTF_LGenBase_reportEvent4Generic( { |
| event:={ bIdx:= v_myBCtxIdx, iIdx:= vl_inputIdxG, target:=omit, source := omit }, |
| reportedArgs:= {} |
| }); |
| |
| f_EPTF_LGenBase_Test_setVerdictFromBool(f_EPTF_LGenBase_Test_isDummyTestStep1Called()); |
| f_EPTF_LGenBase_Test_setVerdictFromBool(not f_EPTF_LGenBase_Test_isDummyTestStep2Called()); |
| f_EPTF_LGenBase_Test_setVerdictFromBool(not f_EPTF_LGenBase_Test_isDummyTestStep3Called()); |
| f_EPTF_LGenBase_Test_setVerdictFromBool(f_EPTF_LGenBase_Test_isDummyGenericEventListenerCalled()); |
| f_EPTF_LGenBase_Test_setVerdict
|