| ///////////////////////////////////////////////////////////////////////////////
|
| // //
|
| // Copyright (c) 2000-2019 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_TestcasesR3
|
| //
|
| // Purpose:
|
| // This module provides functions for testing new R3 functionalities of LGenBase
|
| //
|
| // Module depends on:
|
| // -
|
| //
|
| // Current Owner:
|
| // László Skumát (ELSZSKU)
|
| //
|
| // Last Review Date:
|
| // -
|
| //
|
| ///////////////////////////////////////////////////////////////
|
| module EPTF_LGenBase_Test_TestcasesR3
|
| {
|
| import from EPTF_LGenBase_Test_Definitions all;
|
| import from EPTF_LGenBase_Test_Functions all;
|
| import from EPTF_CLL_Common_Definitions all;
|
| import from EPTF_CLL_Base_Definitions all;
|
| import from EPTF_CLL_LGenBase_Definitions all;
|
| import from EPTF_CLL_LGenBase_Functions all;
|
| import from EPTF_CLL_LGenBaseStats_Definitions all;
|
| import from EPTF_CLL_LGenBaseStats_Functions all;
|
| import from EPTF_CLL_LGenBase_ConfigDefinitions all;
|
| import from EPTF_CLL_LGenBase_ConfigFunctions all;
|
| import from EPTF_CLL_LGenBase_PhaseDefinitions all;
|
| import from EPTF_CLL_LGenBase_PhaseFunctions all;
|
| import from EPTF_CLL_LGenBase_PhaseConfigFunctions all;
|
| import from EPTF_CLL_LGenBase_TemplateDefinitions all;
|
| import from EPTF_CLL_LGenBase_TemplateFunctions all;
|
| import from EPTF_CLL_LGenBase_TrafficFunctions all;
|
| import from EPTF_CLL_LGenBase_StepFunctions all;
|
| import from EPTF_CLL_LGenBase_EventHandlingFunctions all;
|
| import from EPTF_CLL_LGenBase_LoggingFunctions all;
|
| import from EPTF_CLL_Logging_Functions all;
|
| import from EPTF_CLL_FBQ_Functions all;
|
| import from EPTF_CLL_Base_Functions all;
|
| import from EPTF_CLL_Variable_Functions all;
|
| import from EPTF_CLL_Variable_Definitions all;
|
| import from EPTF_CLL_StatHandlerClient_Definitions all;
|
| import from EPTF_CLL_StatMeasure_Definitions all
|
| import from EPTF_CLL_StatMeasure_Functions all
|
| import from EPTF_CLL_RBTScheduler_Functions all;
|
| import from EPTF_CLL_StatHandlerClient_Functions all;
|
| import from EPTF_CLL_Scheduler_Definitions all
|
|
|
| modulepar
|
| {
|
| EPTF_LGenBase_PhaseList_Declarators tsp_EPTF_LGenBase_PhaseList_Declarators := {};
|
| // module parameter for external templates testcase, defines path of dummy template
|
| charstring tsp_dummyTemplatePath := "../dummy_templ.txt";
|
| }
|
|
|
|
|
| ///////////////////////////////////////////////////////////
|
| // Name: tc_EPTF_LGenBase_Test_declareStepAndFunction
|
| //
|
| // Purpose: testing interoperability function f_EPTF_LGenBase_declareStep, f_EPTF_LGenBase_declareFunction
|
| ///////////////////////////////////////////////////////////
|
| testcase tc_EPTF_LGenBase_Test_declareStepAndFunction() 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 Test Step and Declare Function' starts");
|
| var charstring vl_stepName := "f_EPTF_LGenBase_Test_step_Dummy1";
|
| var charstring vl_behaviorTypeName := tsp_EPTF_LGenBase_Test_behaviorTypeName;
|
|
|
| var EPTF_LGenBase_TestStepDescriptor vl_testStep := {name := vl_stepName, step := refers(f_EPTF_LGenBase_Test_step_Dummy1)}
|
| var EPTF_LGenBase_RegisteredFunctions vl_function:= {testStepFunction:= refers(f_EPTF_LGenBase_Test_step_Dummy1)}
|
|
|
| var integer vl_stepIdx := f_EPTF_LGenBase_declareStep( vl_behaviorTypeName, vl_testStep );
|
| var integer vl_fnIdx := f_EPTF_LGenBase_declareFunction( vl_stepName, vl_function );
|
|
|
| var integer vl_fnIdxCheck := f_EPTF_LGenBase_functionNameIndex(vl_stepName);
|
| var integer vl_bIdx := f_EPTF_LGenBase_behaviorTypeNameIndex(vl_behaviorTypeName);
|
|
|
| log("Check 'Declare Test Step and Declare Function' starts");
|
| f_EPTF_LGenBase_Test_setVerdictFromBool( vl_fnIdxCheck == vl_fnIdx );
|
| //f_EPTF_LGenBase_Test_setVerdictFromBool( refers(f_EPTF_LGenBase_Test_step_Dummy1) == f_EPTF_LGenBase_Test_getTestStepFunction(vl_bIdx, vl_stepIdx));
|
|
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
|
|
| group listeners{
|
| type component EPTF_LGenBase_TestListeners_CT extends EPTF_LGenBase_Test_CT{
|
| const integer c_LGenBase_TestListeners_dummy2Add := 5;
|
| const integer c_LGenBase_TestListeners_dummy2Remove := 2;
|
| const integer c_LGenBase_TestListeners_dummyRemaining := c_LGenBase_TestListeners_dummy2Add-c_LGenBase_TestListeners_dummy2Remove;
|
| const EPTF_IntegerList c_initCalledListeners := {0,0,0,0,0,0,0,0,0,0,0,0}
|
| //var EPTF_
|
| var EPTF_IntegerList v_calledListeners := c_initCalledListeners;
|
| var EPTF_IntegerArray2D v_activatedIdxs := {};
|
| var EPTF_IntegerArray2D v_listener := {};
|
| var integer v_behavFail := -1;
|
| var integer v_behavOK := -1;
|
| var integer v_firstInput := -1;
|
| var integer v_secondInput := -1;
|
| var integer v_thirdInput := -1;
|
| var integer v_listenerNot2CallIdx := -1;
|
| }
|
|
|
| function f_EPTF_LGenBase_Test_listenerMustNotBeCalled(
|
| EPTF_LGenBase_ReportedEventDescriptor pl_event,
|
| EPTF_IntegerList pl_listenerArgs
|
| )
|
| runs on EPTF_LGenBase_CT{
|
| log("Event: ",pl_event);
|
| setverdict ( fail );
|
| }
|
|
|
| function f_EPTF_LGenBase_Test_checkEvent(
|
| in EPTF_LGenBase_ReportedEventDescriptor pl_event,
|
| in EPTF_IntegerList pl_listenerArgs){
|
| select( pl_listenerArgs[0] )
|
| {
|
| case ( c_EPTF_LGenBase_eventTypeBehavior )
|
| {
|
| if(pl_event.event.bIdx != pl_listenerArgs[c_EPTF_LGenBase_eventOffsetBehavior+1]){
|
| log(pl_event, pl_listenerArgs)
|
| setverdict ( fail );
|
| }
|
| }
|
| case ( c_EPTF_LGenBase_eventTypeGeneral )
|
| {
|
| if(pl_event.event.bIdx != pl_listenerArgs[c_EPTF_LGenBase_eventOffsetBehavior+1] or
|
| pl_event.event.iIdx != pl_listenerArgs[c_EPTF_LGenBase_eventOffsetInput+1]){
|
| log(pl_event, pl_listenerArgs)
|
| setverdict ( fail );
|
| }
|
| }
|
| case ( c_EPTF_LGenBase_eventTypeEntity )
|
| {
|
| if(pl_event.event.bIdx != pl_listenerArgs[c_EPTF_LGenBase_eventOffsetBehavior+1] or
|
| pl_event.event.iIdx != pl_listenerArgs[c_EPTF_LGenBase_eventOffsetInput+1] or
|
| pl_event.event.target.eIdx != pl_listenerArgs[c_EPTF_LGenBase_eventOffsetEntity+1]){
|
| log(pl_event, pl_listenerArgs)
|
| setverdict ( fail );
|
| }
|
| }
|
| case ( c_EPTF_LGenBase_eventTypeEntityIndex )
|
| {
|
| if(pl_event.event.target.eIdx != pl_listenerArgs[c_EPTF_LGenBase_eventOffsetEntity+1]){
|
| log(pl_event, pl_listenerArgs)
|
| setverdict ( fail );
|
| }
|
| }
|
| case ( c_EPTF_LGenBase_eventTypeFSMOfEntity )
|
| {
|
| if(pl_event.event.target.fsmCtxIdx != pl_listenerArgs[c_EPTF_LGenBase_eventOffsetFSM+1] or
|
| pl_event.event.target.eIdx != pl_listenerArgs[c_EPTF_LGenBase_eventOffsetEntity+1]){
|
| log(pl_event, pl_listenerArgs)
|
| setverdict ( fail );
|
| }
|
| }
|
| case ( c_EPTF_LGenBase_eventTypeBehaviorOfEntity )
|
| {
|
| if(pl_event.event.bIdx != pl_listenerArgs[c_EPTF_LGenBase_eventOffsetBehavior+1] or
|
| pl_event.event.target.eIdx != pl_listenerArgs[c_EPTF_LGenBase_eventOffsetEntity+1]){
|
| log(pl_event, pl_listenerArgs)
|
| setverdict ( fail );
|
| }
|
| }
|
| case ( c_EPTF_LGenBase_eventTypeSourceEntity )
|
| {
|
| if(pl_event.event.bIdx != pl_listenerArgs[c_EPTF_LGenBase_eventOffsetBehavior+1] or
|
| pl_event.event.iIdx != pl_listenerArgs[c_EPTF_LGenBase_eventOffsetInput+1] or
|
| pl_event.event.source.eIdx != pl_listenerArgs[c_EPTF_LGenBase_eventOffsetSourceEntity+1]){
|
| log(pl_event, pl_listenerArgs)
|
| setverdict ( fail );
|
| }
|
| }
|
| case ( c_EPTF_LGenBase_eventTypeSourceFsm )
|
| {
|
| if(pl_event.event.bIdx != pl_listenerArgs[c_EPTF_LGenBase_eventOffsetBehavior+1] or
|
| pl_event.event.iIdx != pl_listenerArgs[c_EPTF_LGenBase_eventOffsetInput+1] or
|
| pl_event.event.source.eIdx != pl_listenerArgs[c_EPTF_LGenBase_eventOffsetSourceEntity+1] or
|
| pl_event.event.source.fsmCtxIdx != pl_listenerArgs[c_EPTF_LGenBase_eventOffsetSourceFSM+1]){
|
| log(pl_event, pl_listenerArgs)
|
| setverdict ( fail );
|
| }
|
| }
|
| case ( c_EPTF_LGenBase_eventTypeSourceEntityIndex )
|
| {
|
| if(pl_event.event.source.eIdx != pl_listenerArgs[c_EPTF_LGenBase_eventOffsetSourceEntity+1]){
|
| log(pl_event, pl_listenerArgs)
|
| setverdict ( fail );
|
| }
|
| }
|
| case ( c_EPTF_LGenBase_eventTypeFsmOfSourceEntity )
|
| {
|
| if(pl_event.event.source.eIdx != pl_listenerArgs[c_EPTF_LGenBase_eventOffsetSourceEntity+1] or
|
| pl_event.event.source.fsmCtxIdx != pl_listenerArgs[c_EPTF_LGenBase_eventOffsetSourceFSM+1]){
|
| log(pl_event, pl_listenerArgs)
|
| setverdict ( fail );
|
| }
|
| }
|
| case ( c_EPTF_LGenBase_eventTypeBehaviorOfSourceEntity )
|
| {
|
| if(pl_event.event.bIdx != pl_listenerArgs[c_EPTF_LGenBase_eventOffsetBehavior+1] or
|
| pl_event.event.source.eIdx != pl_listenerArgs[c_EPTF_LGenBase_eventOffsetSourceEntity+1]){
|
| log(pl_event, pl_listenerArgs)
|
| setverdict ( fail );
|
| }
|
| }
|
| case else
|
| {
|
| setverdict ( fail );
|
| }
|
| }
|
| }
|
|
|
| function f_EPTF_LGenBase_Test_listener4Check(
|
| EPTF_LGenBase_ReportedEventDescriptor pl_event,
|
| EPTF_IntegerList pl_listenerArgs
|
| )
|
| runs on EPTF_LGenBase_TestListeners_CT{
|
| f_EPTF_LGenBase_Test_checkEvent(pl_event, pl_listenerArgs);
|
| v_calledListeners[pl_listenerArgs[0]] := v_calledListeners[pl_listenerArgs[0]] + 1;
|
| }
|
|
|
| function f_EPTF_LGenBase_Test_msgStep (EPTF_LGenBase_TestStepArgs pl_ptr)
|
| runs on EPTF_LGenBase_TestListeners_CT{
|
| //f_EPTF_LGenBase_Test_checkEvent(pl_ptr., pl_ptr.refContext.fRefArgs);
|
| v_calledListeners[c_EPTF_LGenBase_eventTypeFSM] := v_calledListeners[c_EPTF_LGenBase_eventTypeFSM] + 1;
|
| }
|
|
|
| function f_EPTF_LGenBase_Test_addRemoveDummyListeners()
|
| runs on EPTF_LGenBase_TestListeners_CT{
|
| for ( var integer vl_i := 0; vl_i < c_LGenBase_TestListeners_dummy2Add ; vl_i := vl_i+1 )
|
| {
|
| v_dummyInt := f_EPTF_LGenBase_addListener(refers(f_EPTF_LGenBase_Test_listenerMustNotBeCalled), {vl_i})
|
| }
|
| for ( var integer vl_i := 0; vl_i < c_LGenBase_TestListeners_dummy2Remove ; vl_i := vl_i+1 )
|
| {
|
| f_EPTF_LGenBase_removeListener(vl_i);
|
| }
|
| }
|
|
|
| /*testcase tc_EPTF_LGenBase_Test_addRemoveListeners() runs on EPTF_LGenBase_TestListeners_CT{
|
| f_EPTF_LGenBase_init("tc_EPTF_LGenBase_Test_addRemoveListeners", 0, "e_", orig);
|
| var integer vl_baseCount := f_EPTF_FBQ_getOrCreateFreeSlot(v_LGenBase_listenersQueue); //f_EPTF_FBQ_getLengthOfBusyChain(v_LGenBase_listenersQueue);
|
| if(vl_baseCount != f_EPTF_LGenBase_addListener(refers(f_EPTF_LGenBase_Test_listenerMustNotBeCalled), {})){
|
| setverdict ( fail );
|
| }
|
| if(vl_baseCount+1 != f_EPTF_LGenBase_addListener(refers(f_EPTF_LGenBase_Test_listenerMustNotBeCalled), {0})){
|
| setverdict ( fail );
|
| }
|
| if(vl_baseCount+1 != f_EPTF_LGenBase_addListener(refers(f_EPTF_LGenBase_Test_listenerMustNotBeCalled), {0})){
|
| setverdict ( fail );
|
| }
|
| if(vl_baseCount+1 != f_EPTF_LGenBase_addListener(refers(f_EPTF_LGenBase_Test_listenerMustNotBeCalled), {0})){
|
| setverdict ( fail );
|
| }
|
| if(vl_baseCount+2 != f_EPTF_LGenBase_addListener(refers(f_EPTF_LGenBase_Test_listener4Check), {0})){
|
| setverdict ( fail );
|
| }
|
| if(vl_baseCount+2 != f_EPTF_LGenBase_addListener(refers(f_EPTF_LGenBase_Test_listener4Check), {0})){
|
| setverdict ( fail );
|
| }
|
| f_EPTF_LGenBase_removeListener(vl_baseCount+1);
|
| f_EPTF_LGenBase_removeListener(vl_baseCount+1);
|
| f_EPTF_LGenBase_removeListener(vl_baseCount+1);
|
| if(vl_baseCount+1 != f_EPTF_LGenBase_addListener(refers(f_EPTF_LGenBase_Test_listener4Check), {1})){
|
| setverdict ( fail );
|
| }
|
| if(vl_baseCount+1 != f_EPTF_LGenBase_addListener(refers(f_EPTF_LGenBase_Test_listener4Check), {1})){
|
| setverdict ( fail );
|
| }
|
| if(vl_baseCount+1 != f_EPTF_LGenBase_addListener(refers(f_EPTF_LGenBase_Test_listener4Check), {1})){
|
| setverdict ( fail );
|
| }
|
| f_EPTF_LGenBase_removeListener(vl_baseCount+1);
|
| if(vl_baseCount+3 != f_EPTF_LGenBase_addListener(refers(f_EPTF_LGenBase_Test_listenerMustNotBeCalled), {2})){
|
| setverdict ( fail );
|
| }
|
| if(refers(f_EPTF_LGenBase_Test_listenerMustNotBeCalled) != v_LGenBase_listeners[vl_baseCount].listener.fn or
|
| 0 != sizeof(v_LGenBase_listeners[vl_baseCount].listener.args) or
|
| 1 != v_LGenBase_listeners[vl_baseCount].refCount){
|
| setverdict ( fail );
|
| }
|
| if(refers(f_EPTF_LGenBase_Test_listener4Check) != v_LGenBase_listeners[vl_baseCount+1].listener.fn or
|
| {1} != v_LGenBase_listeners[vl_baseCount+1].listener.args or
|
| 2 != v_LGenBase_listeners[vl_baseCount+1].refCount){
|
| setverdict ( fail );
|
| }
|
| if(refers(f_EPTF_LGenBase_Test_listener4Check) != v_LGenBase_listeners[vl_baseCount+2].listener.fn or
|
| {0} != v_LGenBase_listeners[vl_baseCount+2].listener.args or
|
| 2 != v_LGenBase_listeners[vl_baseCount+2].refCount){
|
| setverdict ( fail );
|
| }
|
| if(refers(f_EPTF_LGenBase_Test_listenerMustNotBeCalled) != v_LGenBase_listeners[vl_baseCount+3].listener.fn or
|
| {2} != v_LGenBase_listeners[vl_baseCount+3].listener.args or
|
| 1 != v_LGenBase_listeners[vl_baseCount+3].refCount){
|
| setverdict ( fail );
|
| }
|
| setverdict(pass);
|
| f_EPTF_Base_cleanup_CT()
|
| }
|
| */
|
|
|
| template EPTF_IntegerList t_EPTF_LGenBase_Test_ListenerArgs(
|
| in integer pl_behavior := -1,
|
| in integer pl_input := -1,
|
| in integer pl_entity := -1,
|
| in integer pl_fsm := -1,
|
| in integer pl_source := -1,
|
| in integer pl_sourceFSM := -1):={
|
| -1, pl_behavior, pl_input, pl_entity, pl_fsm, pl_source, pl_sourceFSM
|
| }
|
| function f_EPTF_LGenBase_Test_fillListenerArgs(
|
| in EPTF_LGenBase_EventType pl_type,
|
| inout EPTF_IntegerList pl_listenerArgs)
|
| runs on EPTF_LGenBase_TestListeners_CT{
|
| select( pl_type )
|
| {
|
| case ( c_EPTF_LGenBase_eventTypeBehavior )
|
| {
|
| pl_listenerArgs := valueof(t_EPTF_LGenBase_Test_ListenerArgs(pl_behavior := v_behavOK));
|
| }
|
| case ( c_EPTF_LGenBase_eventTypeGeneral )
|
| {
|
| pl_listenerArgs := valueof(t_EPTF_LGenBase_Test_ListenerArgs(pl_behavior := v_behavOK, pl_input := v_secondInput));
|
| }
|
| case ( c_EPTF_LGenBase_eventTypeEntity )
|
| {
|
| pl_listenerArgs := valueof(t_EPTF_LGenBase_Test_ListenerArgs(
|
| pl_behavior := v_behavOK,
|
| pl_input := v_secondInput,
|
| pl_entity := 1
|
| ));
|
| }
|
| case ( c_EPTF_LGenBase_eventTypeEntityIndex )
|
| {
|
| pl_listenerArgs := valueof(t_EPTF_LGenBase_Test_ListenerArgs(
|
| pl_entity := 1
|
| ));
|
| }
|
| case ( c_EPTF_LGenBase_eventTypeFSMOfEntity )
|
| {
|
| pl_listenerArgs := valueof(t_EPTF_LGenBase_Test_ListenerArgs(
|
| pl_entity := 1,
|
| pl_fsm := 0
|
| ));
|
| }
|
| case ( c_EPTF_LGenBase_eventTypeBehaviorOfEntity )
|
| {
|
| pl_listenerArgs := valueof(t_EPTF_LGenBase_Test_ListenerArgs(
|
| pl_behavior := v_behavOK,
|
| pl_entity := 1
|
| ));
|
| }
|
| case ( c_EPTF_LGenBase_eventTypeSourceEntity )
|
| {
|
| pl_listenerArgs := valueof(t_EPTF_LGenBase_Test_ListenerArgs(
|
| pl_behavior := v_behavOK,
|
| pl_input := v_secondInput,
|
| pl_source := 1
|
| ));
|
| }
|
| case ( c_EPTF_LGenBase_eventTypeSourceFsm )
|
| {
|
| pl_listenerArgs := valueof(t_EPTF_LGenBase_Test_ListenerArgs(
|
| pl_behavior := v_behavOK,
|
| pl_input := v_secondInput,
|
| pl_source := 1,
|
| pl_sourceFSM := 0
|
| ));
|
| }
|
| case ( c_EPTF_LGenBase_eventTypeSourceEntityIndex )
|
| {
|
| pl_listenerArgs := valueof(t_EPTF_LGenBase_Test_ListenerArgs(
|
| pl_source := 1
|
| ));
|
| }
|
| case ( c_EPTF_LGenBase_eventTypeFsmOfSourceEntity )
|
| {
|
| pl_listenerArgs := valueof(t_EPTF_LGenBase_Test_ListenerArgs(
|
| pl_source := 1,
|
| pl_sourceFSM := 0
|
| ));
|
| }
|
| case ( c_EPTF_LGenBase_eventTypeBehaviorOfSourceEntity )
|
| {
|
| pl_listenerArgs := valueof(t_EPTF_LGenBase_Test_ListenerArgs(
|
| pl_behavior := v_behavOK,
|
| pl_source := 1
|
| ));
|
| }
|
| case else
|
| {
|
| setverdict ( fail );
|
| }
|
| }
|
| }
|
|
|
| //type record of
|
| function f_EPTF_LGenBase_Test_activateListeners(
|
| in EPTF_LGenBase_EventType pl_type)
|
| runs on EPTF_LGenBase_TestListeners_CT{
|
| var EPTF_IntegerList vl_listenerArgs := {};
|
| f_EPTF_LGenBase_Test_fillListenerArgs(pl_type, vl_listenerArgs);
|
| vl_listenerArgs[0] := pl_type;
|
| select( pl_type )
|
| {
|
| case ( c_EPTF_LGenBase_eventTypeBehavior )
|
| {
|
| //Listener not to call
|
| v_activatedIdxs[pl_type][0] :=
|
| f_EPTF_LGenBase_activateBehaviorListener(v_behavFail, v_listenerNot2CallIdx);
|
| //Listeners to call
|
| v_listener[pl_type][0] :=
|
| f_EPTF_LGenBase_addListener(refers(f_EPTF_LGenBase_Test_listener4Check), vl_listenerArgs);
|
| v_activatedIdxs[pl_type][1] :=
|
| f_EPTF_LGenBase_activateBehaviorListener(v_behavOK, v_listener[pl_type][0]);
|
| v_activatedIdxs[pl_type][2] :=
|
| f_EPTF_LGenBase_activateBehaviorListener(v_behavOK, v_listener[pl_type][0]);
|
| }
|
| case ( c_EPTF_LGenBase_eventTypeGeneral )
|
| {
|
| //Listener not to call
|
| v_activatedIdxs[pl_type][0] :=
|
| f_EPTF_LGenBase_activateGeneralListener(v_behavFail,v_secondInput, v_listenerNot2CallIdx);
|
| //Listeners to call
|
| v_listener[pl_type][0] :=
|
| f_EPTF_LGenBase_addListener(refers(f_EPTF_LGenBase_Test_listener4Check), vl_listenerArgs);
|
| v_activatedIdxs[pl_type][1] :=
|
| f_EPTF_LGenBase_activateGeneralListener(v_behavOK, v_secondInput, v_listener[pl_type][0]);
|
| v_activatedIdxs[pl_type][2] :=
|
| f_EPTF_LGenBase_activateGeneralListener(v_behavOK, v_secondInput, v_listener[pl_type][0]);
|
| }
|
| case ( c_EPTF_LGenBase_eventTypeEntity )
|
| {
|
| //Listener not to call
|
| v_activatedIdxs[pl_type][0] :=
|
| f_EPTF_LGenBase_activateEntityListener(v_behavFail,v_secondInput, 1, v_listenerNot2CallIdx);
|
| //Listeners to call
|
| v_listener[pl_type][0] :=
|
| f_EPTF_LGenBase_addListener(refers(f_EPTF_LGenBase_Test_listener4Check), vl_listenerArgs);
|
| v_activatedIdxs[pl_type][1] :=
|
| f_EPTF_LGenBase_activateEntityListener(v_behavOK, v_secondInput, 1, v_listener[pl_type][0]);
|
| v_activatedIdxs[pl_type][2] :=
|
| f_EPTF_LGenBase_activateEntityListener(v_behavOK, v_secondInput, 1, v_listener[pl_type][0]);
|
| }
|
| case ( c_EPTF_LGenBase_eventTypeEntityIndex )
|
| {
|
| //Listener not to call
|
| v_activatedIdxs[pl_type][0] :=
|
| f_EPTF_LGenBase_activateEntityIdxListener(2, v_listenerNot2CallIdx);
|
| //Listeners to call
|
| v_listener[pl_type][0] :=
|
| f_EPTF_LGenBase_addListener(refers(f_EPTF_LGenBase_Test_listener4Check), vl_listenerArgs);
|
| v_activatedIdxs[pl_type][1] :=
|
| f_EPTF_LGenBase_activateEntityIdxListener(1, v_listener[pl_type][0]);
|
| v_activatedIdxs[pl_type][2] :=
|
| f_EPTF_LGenBase_activateEntityIdxListener(1, v_listener[pl_type][0]);
|
| }
|
| case ( c_EPTF_LGenBase_eventTypeFSMOfEntity )
|
| {
|
| //Listener not to call
|
| v_activatedIdxs[pl_type][0] :=
|
| f_EPTF_LGenBase_activateFSMOfEntityListener(0, 0, v_listenerNot2CallIdx);
|
| //Listeners to call
|
| v_listener[pl_type][0] :=
|
| f_EPTF_LGenBase_addListener(refers(f_EPTF_LGenBase_Test_listener4Check), vl_listenerArgs);
|
| v_activatedIdxs[pl_type][1] :=
|
| f_EPTF_LGenBase_activateFSMOfEntityListener(1, 0, v_listener[pl_type][0]);
|
| v_activatedIdxs[pl_type][2] :=
|
| f_EPTF_LGenBase_activateFSMOfEntityListener(1, 0, v_listener[pl_type][0]);
|
| }
|
| case ( c_EPTF_LGenBase_eventTypeBehaviorOfEntity )
|
| {
|
| //Listener not to call
|
| v_activatedIdxs[pl_type][0] :=
|
| f_EPTF_LGenBase_activateBehaviorOfEntityListener(v_behavFail,1, v_listenerNot2CallIdx);
|
| //Listeners to call
|
| v_listener[pl_type][0] :=
|
| f_EPTF_LGenBase_addListener(refers(f_EPTF_LGenBase_Test_listener4Check), vl_listenerArgs);
|
| v_activatedIdxs[pl_type][1] :=
|
| f_EPTF_LGenBase_activateBehaviorOfEntityListener(v_behavOK, 1, v_listener[pl_type][0]);
|
| v_activatedIdxs[pl_type][2] :=
|
| f_EPTF_LGenBase_activateBehaviorOfEntityListener(v_behavOK, 1, v_listener[pl_type][0]);
|
| }
|
| case ( c_EPTF_LGenBase_eventTypeSourceEntity )
|
| {
|
| //Listener not to call
|
| v_activatedIdxs[pl_type][0] :=
|
| f_EPTF_LGenBase_activateSourceEntityListener(v_behavFail,v_secondInput, 1, v_listenerNot2CallIdx);
|
| //Listeners to call
|
| v_listener[pl_type][0] :=
|
| f_EPTF_LGenBase_addListener(refers(f_EPTF_LGenBase_Test_listener4Check), vl_listenerArgs);
|
| v_activatedIdxs[pl_type][1] :=
|
| f_EPTF_LGenBase_activateSourceEntityListener(v_behavOK, v_secondInput, 1, v_listener[pl_type][0]);
|
| v_activatedIdxs[pl_type][2] :=
|
| f_EPTF_LGenBase_activateSourceEntityListener(v_behavOK, v_secondInput, 1, v_listener[pl_type][0]);
|
| }
|
| case ( c_EPTF_LGenBase_eventTypeSourceFsm )
|
| {
|
| //Listener not to call
|
| v_activatedIdxs[pl_type][0] :=
|
| f_EPTF_LGenBase_activateSourceFsmListener(v_behavFail,v_secondInput, 1, 0, v_listenerNot2CallIdx);
|
| //Listeners to call
|
| v_listener[pl_type][0] :=
|
| f_EPTF_LGenBase_addListener(refers(f_EPTF_LGenBase_Test_listener4Check), vl_listenerArgs);
|
| v_activatedIdxs[pl_type][1] :=
|
| f_EPTF_LGenBase_activateSourceFsmListener(v_behavOK, v_secondInput, 1, 0, v_listener[pl_type][0]);
|
| v_activatedIdxs[pl_type][2] :=
|
| f_EPTF_LGenBase_activateSourceFsmListener(v_behavOK, v_secondInput, 1, 0, v_listener[pl_type][0]);
|
| }
|
| case ( c_EPTF_LGenBase_eventTypeSourceEntityIndex )
|
| {
|
| //Listener not to call
|
| v_activatedIdxs[pl_type][0] :=
|
| f_EPTF_LGenBase_activateSourceEntityIndexListener(0, v_listenerNot2CallIdx);
|
| //Listeners to call
|
| v_listener[pl_type][0] :=
|
| f_EPTF_LGenBase_addListener(refers(f_EPTF_LGenBase_Test_listener4Check), vl_listenerArgs);
|
| v_activatedIdxs[pl_type][1] :=
|
| f_EPTF_LGenBase_activateSourceEntityIndexListener(1, v_listener[pl_type][0]);
|
| v_activatedIdxs[pl_type][2] :=
|
| f_EPTF_LGenBase_activateSourceEntityIndexListener(1, v_listener[pl_type][0]);
|
| }
|
| case ( c_EPTF_LGenBase_eventTypeFsmOfSourceEntity )
|
| {
|
| //Listener not to call
|
| v_activatedIdxs[pl_type][0] :=
|
| f_EPTF_LGenBase_activateFsmOfSourceEntityListener(0, 0, v_listenerNot2CallIdx);
|
| //Listeners to call
|
| v_listener[pl_type][0] :=
|
| f_EPTF_LGenBase_addListener(refers(f_EPTF_LGenBase_Test_listener4Check), vl_listenerArgs);
|
| v_activatedIdxs[pl_type][1] :=
|
| f_EPTF_LGenBase_activateFsmOfSourceEntityListener(1, 0, v_listener[pl_type][0]);
|
| v_activatedIdxs[pl_type][2] :=
|
| f_EPTF_LGenBase_activateFsmOfSourceEntityListener(1, 0, v_listener[pl_type][0]);
|
| }
|
| case ( c_EPTF_LGenBase_eventTypeBehaviorOfSourceEntity )
|
| {
|
| //Listener not to call
|
| v_activatedIdxs[pl_type][0] :=
|
| f_EPTF_LGenBase_activateBehaviorOfSourceEntityListener(v_behavFail, 0, v_listenerNot2CallIdx);
|
| //Listeners to call
|
| v_listener[pl_type][0] :=
|
| f_EPTF_LGenBase_addListener(refers(f_EPTF_LGenBase_Test_listener4Check), vl_listenerArgs);
|
| log("------ Adding BehaviorOfSourceEntityListener ", vl_listenerArgs)
|
| //f_EPTF_LGenBase_Test_behaviorOfSourceListener
|
| v_activatedIdxs[pl_type][1] :=
|
| f_EPTF_LGenBase_activateBehaviorOfSourceEntityListener(v_behavOK, 1, v_listener[pl_type][0]);
|
| v_activatedIdxs[pl_type][2] :=
|
| f_EPTF_LGenBase_activateBehaviorOfSourceEntityListener(v_behavOK, 1, v_listener[pl_type][0]);
|
| }
|
| case else
|
| {
|
| setverdict ( fail );
|
| }
|
| }
|
| }
|
|
|
| testcase tc_EPTF_LGenBase_Test_activateListeners() runs on EPTF_LGenBase_TestListeners_CT{
|
| f_EPTF_LGenBase_init("tc_EPTF_LGenBase_Test_behaviorListeners", 0, "e_", orig);
|
| f_EPTF_LGenBase_Test_addRemoveDummyListeners()
|
| const charstring c_behavName := "tc_EPTF_LGenBase_Test_activateListenersBehavior";
|
| const charstring c_behavNameNot2Call := "tc_EPTF_LGenBase_Test_activateNot2CallListenersBehavior";
|
| const charstring c_firstInputName := "tc_EPTF_LGenBase_Test_activateListeners_firstInput";
|
| const charstring c_secondInputName := "tc_EPTF_LGenBase_Test_activateListeners_secondInput";
|
| const charstring c_thirdInputName := "tc_EPTF_LGenBase_Test_activateListeners_thirdInput";
|
| v_behavFail := f_EPTF_LGenBase_declareBehaviorType(c_behavNameNot2Call, -1, null, null, null)
|
| v_behavOK := f_EPTF_LGenBase_declareBehaviorType(c_behavName, -1, null, null, null)
|
| v_firstInput := f_EPTF_LGenBase_declareFsmEvent(c_behavName, c_firstInputName)
|
| v_secondInput := f_EPTF_LGenBase_declareFsmEvent(c_behavName, c_secondInputName)
|
| v_thirdInput := f_EPTF_LGenBase_declareFsmEvent(c_behavName, c_thirdInputName)
|
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent(c_behavNameNot2Call, c_firstInputName)
|
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent(c_behavNameNot2Call, c_secondInputName)
|
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent(c_behavNameNot2Call, c_thirdInputName)
|
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("TestEntityType",{c_behavNameNot2Call,c_behavName});
|
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({"eGroup","TestEntityType",25});
|
|
|
| var integer vl_tIdx := f_EPTF_LGenBase_declareCompactFsmTable({
|
| name := "activateListenersTestFsm",
|
| // [0]
|
| stateList := {"idle"},
|
| timerList := {},
|
| table := {
|
| {eventToListen := {v_behavOK,v_secondInput,fsm},
|
| cellRow := {
|
| //state[0]==idle
|
| {{{refers(f_EPTF_LGenBase_Test_msgStep),{}}}, omit,0}
|
| }
|
| }
|
| }
|
| }
|
| );
|
| v_dummyInt := f_EPTF_LGenBase_activateFsm(pl_eIdx:= 0, pl_tIdx:= vl_tIdx, pl_sIdx:=0, pl_tcIdx:= -1)
|
| v_dummyInt := f_EPTF_LGenBase_activateFsm(pl_eIdx:= 1, pl_tIdx:= vl_tIdx, pl_sIdx:=0, pl_tcIdx:= -1)
|
|
|
| v_listenerNot2CallIdx := f_EPTF_LGenBase_addListener(refers(f_EPTF_LGenBase_Test_listenerMustNotBeCalled), {-1});
|
|
|
| f_EPTF_LGenBase_Test_activateListeners( c_EPTF_LGenBase_eventTypeBehavior )
|
| f_EPTF_LGenBase_Test_activateListeners( c_EPTF_LGenBase_eventTypeGeneral )
|
| f_EPTF_LGenBase_Test_activateListeners( c_EPTF_LGenBase_eventTypeEntity )
|
| f_EPTF_LGenBase_Test_activateListeners( c_EPTF_LGenBase_eventTypeEntityIndex )
|
| f_EPTF_LGenBase_Test_activateListeners( c_EPTF_LGenBase_eventTypeFSMOfEntity )
|
| f_EPTF_LGenBase_Test_activateListeners( c_EPTF_LGenBase_eventTypeBehaviorOfEntity )
|
| f_EPTF_LGenBase_Test_activateListeners( c_EPTF_LGenBase_eventTypeSourceEntity )
|
| f_EPTF_LGenBase_Test_activateListeners( c_EPTF_LGenBase_eventTypeSourceFsm )
|
| f_EPTF_LGenBase_Test_activateListeners( c_EPTF_LGenBase_eventTypeSourceEntityIndex )
|
| f_EPTF_LGenBase_Test_activateListeners( c_EPTF_LGenBase_eventTypeFsmOfSourceEntity )
|
| f_EPTF_LGenBase_Test_activateListeners( c_EPTF_LGenBase_eventTypeBehaviorOfSourceEntity )
|
|
|
| //Event to be dispatched to the behavior and general listeners
|
| f_EPTF_LGenBase_dispatchEvent({{v_behavOK, v_secondInput, omit, omit},{}});
|
| if(v_calledListeners != {2,2,0,0,0,0,0,0,0,0,0,0}){
|
| log(v_calledListeners)
|
| setverdict(fail)
|
| }
|
| v_calledListeners := c_initCalledListeners;
|
|
|
| f_EPTF_LGenBase_dispatchEvent({{v_behavOK, v_thirdInput, omit, omit},{}});
|
| if(v_calledListeners != {2,0,0,0,0,0,0,0,0,0,0,0}){
|
| log(v_calledListeners)
|
| log(match(v_calledListeners,{2,0,0,0,0,0,0,0,0,0,0,0}))
|
| setverdict(fail)
|
| }
|
| v_calledListeners := c_initCalledListeners;
|
|
|
| f_EPTF_LGenBase_dispatchEvent({{v_behavOK, v_secondInput, {1, omit}, omit},{}});
|
| if(v_calledListeners != {2,2,2,0,2,0,2,0,0,0,0,0}){
|
| log(v_calledListeners)
|
| log(match(v_calledListeners,{2,2,2,0,2,0,2,0,0,0,0,0}))
|
| setverdict(fail)
|
| }
|
| v_calledListeners := c_initCalledListeners;
|
|
|
| f_EPTF_LGenBase_dispatchEvent({{v_behavOK, v_secondInput, {1, 0}, omit},{}});
|
| if(v_calledListeners != {2,2,2,1,2,2,2,0,0,0,0,0}){
|
| log(v_calledListeners)
|
| log(match(v_calledListeners,{2,2,2,1,2,2,2,0,0,0,0,0}))
|
| setverdict(fail)
|
| }
|
| v_calledListeners := c_initCalledListeners;
|
|
|
| f_EPTF_LGenBase_dispatchEvent({{v_behavOK, v_secondInput, {1, 0}, {1, omit}},{}});
|
| if(v_calledListeners != {2,2,2,1,2,2,2,2,0,2,0,2}){
|
| log(v_calledListeners)
|
| log(match(v_calledListeners,{2,2,2,1,2,2,2,2,0,2,0,2}))
|
| setverdict(fail)
|
| }
|
| v_calledListeners := c_initCalledListeners;
|
|
|
| f_EPTF_LGenBase_dispatchEvent({{v_behavOK, v_secondInput, {1, 0}, {1, 0}},{}});
|
| if(v_calledListeners != {2,2,2,1,2,2,2,2,2,2,2,2}){
|
| log(v_calledListeners)
|
| log(match(v_calledListeners,{2,2,2,1,2,2,2,2,2,2,2,2}))
|
| setverdict(fail)
|
| }
|
| /*
|
| var integer vl_count := sizeof(v_activatedIdxs[c_EPTF_LGenBase_eventTypeBehavior]);
|
| for ( var integer vl_i := 0; vl_i < vl_count ; vl_i := vl_i+1 )
|
| {
|
| f_EPTF_LGenBase_deactivateBehaviorListener(v_behavOK, v_activatedIdxs[vl_i]);
|
| }
|
|
|
| var EPTF_LGenBase_ReportedEventDescriptor vl_event := {{v_behavOK, v_secondInput, {1, 0}, {1, omit}},{}};
|
|
|
| f_EPTF_LGenBase_reportEvent4Behavior(vl_event);
|
| log(v_calledListeners)
|
| f_EPTF_LGenBase_reportEvent4Generic(vl_event);
|
| log(v_calledListeners)
|
| f_EPTF_LGenBase_reportEvent4Entity(vl_event);
|
| log(v_calledListeners)
|
| f_EPTF_LGenBase_reportEvent4EntityIdx(vl_event);
|
| log(v_calledListeners)
|
| f_EPTF_LGenBase_reportEvent4BehaviorOfEntity(vl_event);
|
| log(v_calledListeners)
|
| f_EPTF_LGenBase_reportEvent4Fsm(vl_event,false,vl_event.event.bIdx, vl_event.event.iIdx);
|
| log(v_calledListeners)
|
| f_EPTF_LGenBase_reportEvent4FSMOfEntity(vl_event);
|
| log(v_calledListeners)
|
| f_EPTF_LGenBase_reportEvent4SourceEntity(vl_event);
|
| log(v_calledListeners)
|
| f_EPTF_LGenBase_reportEvent4SourceEntityIndex(vl_event);
|
| log(v_calledListeners)
|
| f_EPTF_LGenBase_reportEvent4BehaviorOfSourceEntity(vl_event);
|
| log(v_calledListeners)
|
| */
|
| f_EPTF_Base_cleanup_CT()
|
| setverdict(pass);
|
| }
|
| } // group listeners
|
|
|
| function f_EPTF_LGenBase_Test_entityCounts()
|
| runs on EPTF_LGenBase_CT
|
| return EPTF_IntegerList{
|
| var EPTF_IntegerList vl_ret := {}
|
| vl_ret[0] := f_EPTF_LGenBase_getETypeAvailableByName("et1");
|
| vl_ret[1] := f_EPTF_LGenBase_getETypeAvailableByName("et2");
|
| vl_ret[2] := f_EPTF_LGenBase_getETypeAvailableByName("et3");
|
| vl_ret[3] := f_EPTF_LGenBase_getETypeAvailableByName("et4");
|
| vl_ret[4] := f_EPTF_LGenBase_getETypeAvailableByName("et1-2");
|
| vl_ret[5] := f_EPTF_LGenBase_getETypeAvailableByName("et1-3");
|
| vl_ret[6] := f_EPTF_LGenBase_getETypeAvailableByName("et2-4");
|
| return vl_ret;
|
| }
|
|
|
| testcase tc_EPTF_LGenBase_Test_entityCounts() runs on EPTF_LGenBase_Test_CT{
|
| f_EPTF_LGenBase_init("tc_EPTF_LGenBase_Test_entityCounts", 0, "e_", orig);
|
| v_dummyInt := f_EPTF_LGenBase_declareBehaviorType("b1", 17, null, null, null);
|
| v_dummyInt := f_EPTF_LGenBase_declareBehaviorType("b2", 5, null, null, null);
|
| v_dummyInt := f_EPTF_LGenBase_declareBehaviorType("b3", -1, null, null, null);
|
| v_dummyInt := f_EPTF_LGenBase_declareBehaviorType("b4", 16, null, null, null);
|
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("et1", {"b1"});
|
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("et2", {"b2"});
|
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("et3", {"b3"});
|
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("et4", {"b4"});
|
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("et1-2", {"b1","b2"});
|
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("et1-3", {"b1","b3"});
|
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("et2-4", {"b2","b4"});
|
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({"eg1", "et1-2", 3})
|
| if({14,2,-1,16,2,14,2} != f_EPTF_LGenBase_Test_entityCounts()){
|
| log(f_EPTF_LGenBase_Test_entityCounts())
|
| setverdict(fail);
|
| }
|
| setverdict(pass)
|
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({"eg2", "et1-3", 16})
|
| if({0,2,-1,16,0,0,2} != f_EPTF_LGenBase_Test_entityCounts()){
|
| log(f_EPTF_LGenBase_Test_entityCounts())
|
| setverdict(fail);
|
| }
|
| setverdict(pass);
|
| f_EPTF_Base_cleanup_CT()
|
| }
|
|
|
| testcase tc_EPTF_LGenBase_Test_entityCounts2() runs on EPTF_LGenBase_Test_CT{
|
| f_EPTF_LGenBase_init("tc_EPTF_LGenBase_Test_entityCounts", 0, "e_", orig);
|
| v_dummyInt := f_EPTF_LGenBase_declareBehaviorType("b1", 100, null, null, null);
|
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("et1", {"b1"});
|
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({"eg1", "et1", 20})
|
| if(80 != f_EPTF_LGenBase_getETypeAvailableByName("et1")){
|
| setverdict(fail);
|
| }
|
| setverdict(pass);
|
| f_EPTF_Base_cleanup_CT()
|
| }
|
|
|
| // test cases for using external templates
|
| group externalTemplateTests
|
| {
|
|
|
| ///////////////////////////////////////////////////////////
|
| // Testcase: tc_LGenBase_Test_externalTemplates
|
| //
|
| // Purpose:
|
| // Testcase to check the 'external templates' feature
|
| //
|
| // Requirement:
|
| // dummy_template.txt external template file is available on filesystem
|
| //
|
| // Action:
|
| // - Loads an external template,
|
| // - creates template set,
|
| // - declares a template type
|
| // - assigns template type to external template,
|
| // - substitutes template with sample values and logs content
|
| //
|
| ///////////////////////////////////////////////////////////
|
| testcase tc_LGenBase_Test_externalTemplates() runs on EPTF_LGenBase_Test_CT
|
| {
|
| const charstring extTemplName1 := "dummy";
|
| const charstring extTemplName2 := "dummy2";
|
| var EPTF_LGenBase_ExtTemplLoadList extTemplLoadList := { {extTemplName1, tsp_dummyTemplatePath, true}, {extTemplName2,
|
| "file_not_exist.txt", false} }
|
|
|
| // 1. load the external template list
|
| log("Init component and load external template list");
|
| f_EPTF_LGenBase_init("LGenBase Templates Test", pl_extTemplLoadList := extTemplLoadList);
|
| // check dummy template exist, other one not exist
|
| if ( f_EPTF_LGenBase_getExtTemplIdx(extTemplName1) >= 0 and
|
| f_EPTF_LGenBase_getExtTemplIdx(extTemplName2) == -1 )
|
| {
|
| log("External template loaded OK");
|
| }
|
| else
|
| {
|
| log("Could not load external templates");
|
| setverdict(fail);
|
| }
|
|
|
| // 2. create a new template set
|
| log("Create template set");
|
| var integer setId := f_EPTF_LGenBase_createTemplateSet();
|
| if(setId >= 0)
|
| {
|
| log("Template set created OK");
|
| }
|
| else
|
| {
|
| log("Could not create template set");
|
| setverdict(fail);
|
| }
|
|
|
| // 3. declare a new template type
|
| log("Declare new template type");
|
| var EPTF_LGenBase_TemplateTypeKey templTypeKey := {"SIP", "INVITE"};
|
| var integer templTypeIdx := f_EPTF_LGenBase_declareTemplateType(templTypeKey, {"VEGETABLE"}, {"FRUIT", "FISH", "MEAT"})
|
| if ( templTypeIdx>=0 )
|
| {
|
| log("Template type declared OK");
|
| }
|
| else
|
| {
|
| log("Could not declare template type");
|
| setverdict(fail);
|
| }
|
|
|
| // 4. assign declared template type to 'dummy' template
|
| log("Assign declared type to external template");
|
| // NOTE: f_EPTF_LGenBase_assignExtTemplToTemplType(setId, templTypeIdx, extTemplIdx) is more efficient
|
| if(f_EPTF_LGenBase_assignExtTemplToTemplType3(setId, templTypeKey, extTemplName1) >= 0)
|
| {
|
| log("Assigment OK");
|
| }
|
| else
|
| {
|
| log("Could not assign template type with external template");
|
| setverdict(fail);
|
| }
|
|
|
| // 5 get substituted template content
|
| log("Get substituted template content");
|
| var charstring content1 := "", content2:="";
|
|
|
| // 5.1 get content by position-based parameter assign
|
| var integer templateItemIdx := f_EPTF_LGenBase_getTemplateItemIdxFromSet(setId, templTypeIdx);
|
| if (templateItemIdx < 0)
|
| {
|
| log("Template type not found in template set");
|
| setverdict(fail);
|
| }
|
| if(f_EPTF_LGenBase_getTemplateContentFast(setId, templateItemIdx, {"carrot", "apple", "salmon", "pork"}, content1))
|
| {
|
| log("Positional parameter substitution done OK");
|
| log("Result:\n", content1);
|
| setverdict(pass);
|
| }
|
| else
|
| {
|
| log("Parameter substitution failed");
|
| setverdict(fail);
|
| }
|
|
|
| // 5.2 get content by dictionary-based parameter assign
|
| // NOTE: f_EPTF_LGenBase_getTemplateContent(extTemplIdx, ...) is more efficient
|
| if(f_EPTF_LGenBase_getTemplateContentByExtTemplName(extTemplName1, {{"FRUIT","apple"}, {"VEGETABLE","carrot"}, {"MEAT","pork"}}, content2))
|
| {
|
| log("Dictionary-based parameter substitution done OK");
|
| log("Result:\n", content2);
|
| setverdict(pass);
|
| }
|
| else
|
| {
|
| log("Parameter substitution failed");
|
| setverdict(fail);
|
| }
|
|
|
| if(content1 != content2)
|
| {
|
| log("Substituted contents are not equal!");
|
| setverdict(fail);
|
| }
|
|
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
|
|
| function f_EPTF_LGenBase_TemplateContentGetter_Dummy(
|
| in integer pl_extTemplateIdx,
|
| in EPTF_LGenBase_TemplParamSubstList pl_dictionary,
|
| inout charstring pl_content
|
| )
|
| runs on EPTF_LGenBase_extTemplate_CT
|
| return boolean
|
| {
|
| pl_content := c_LGenBase_TemplateContentGetter_Dummy_Content;
|
| return true;
|
| }
|
|
|
| ///////////////////////////////////////////////////////////
|
| // Testcase: tc_LGenBase_Test_externalTemplates_fixedPosition
|
| //
|
| // Purpose:
|
| // Testcase to check the 'external templates fixed position' feature
|
| //
|
| // Requirement:
|
| // dummy_template.txt external template file is available on filesystem
|
| //
|
| // Action:
|
| // - Loads an external template,
|
| // - creates template set,
|
| // - declares a template type
|
| // - assigns template type to external template,
|
| // - substitutes template with sample values and logs content
|
| //
|
| ///////////////////////////////////////////////////////////
|
| testcase tc_LGenBase_Test_externalTemplates_fixedPosition() runs on EPTF_LGenBase_extTemplate_CT
|
| {
|
| const charstring extTemplName1 := "dummy";
|
| const charstring extTemplName2 := "dummy2";
|
| var charstring content1;
|
| var charstring content2;
|
|
|
| var EPTF_LGenBase_ExtTemplLoadList extTemplLoadList := { {extTemplName1, tsp_dummyTemplatePath, true}, {extTemplName2,
|
| "file_not_exist.txt", false} }
|
|
|
| // 1. load the external template list
|
| log("Init component and load external template list");
|
| f_EPTF_LGenBase_extTemplate_init_CT(
|
| "LGenBase Fiexed Postion Template Test",
|
| pl_extTemplLoadList := extTemplLoadList,
|
| pl_templateGetterMode := { fixedPosGetter := { orderedMacroNameList := {"FRUIT", "VEGETABLE", "MEAT", "SPICE"}}} );
|
| // check dummy template exist, other one not exist
|
| if ( f_EPTF_LGenBase_getExtTemplIdx(extTemplName1) >= 0 and
|
| f_EPTF_LGenBase_getExtTemplIdx(extTemplName2) == -1 )
|
| {
|
| log("External template loaded OK");
|
| }
|
| else
|
| {
|
| setverdict(fail, "Could not load external templates");
|
| f_EPTF_Base_stop();
|
| }
|
|
|
| var integer extTemplIdx := f_EPTF_LGenBase_getExtTemplIdx(extTemplName1);
|
|
|
| if(f_EPTF_LGenBase_applyTemplateContentGetter(extTemplIdx, c_LGenBase_extTemplate_dummyTemplate_Substitution_Dictionary, content1) and
|
| content1 == c_LGenBase_extTemplate_dummyTemplate_Substitution_Result)
|
| {
|
| log("Default External Template Content Function substitution done OK");
|
| log("Result:\n", content1);
|
| }
|
| else
|
| {
|
| setverdict(fail, "Default External Template Content Function substitution failed:\n" & content1);
|
| f_EPTF_Base_stop();
|
| }
|
|
|
| if(f_EPTF_LGenBase_extTemplFixedPos_getTemplateContent(extTemplIdx, c_LGenBase_extTemplate_dummyTemplate_Substitution_Dictionary, content2) and
|
| content2 == c_LGenBase_extTemplate_dummyTemplate_Substitution_Result)
|
| {
|
| log("f_EPTF_LGenBase_extTemplFixedPos_getTemplateContent paramter substitution done OK");
|
| log("Result:\n", content2);
|
| }
|
| else
|
| {
|
| setverdict(fail, "f_EPTF_LGenBase_extTemplFixedPos_getTemplateContent parameter substitution failed:\n" & content1);
|
| f_EPTF_Base_stop();
|
| }
|
|
|
| f_EPTF_LGenBase_setTemplateContentGetter(refers(f_EPTF_LGenBase_TemplateContentGetter_Dummy));
|
|
|
| if(f_EPTF_LGenBase_applyTemplateContentGetter(-1, {}, content1) and
|
| content1 == c_LGenBase_TemplateContentGetter_Dummy_Content) {
|
| log("f_EPTF_LGenBase_setTemplateContentGetter properly changed template getter function pointer");
|
| }
|
| else {
|
| setverdict(fail, "f_EPTF_LGenBase_setTemplateContentGetter did not set template getter function pointer to expected function. Result:\n" & content1);
|
| }
|
|
|
| setverdict(pass);
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
|
|
| ///////////////////////////////////////////////////////////
|
| // Testcase: tc_LGenBase_Test_extendTemplateType
|
| //
|
| // Purpose:
|
| // Testcase to check runtime modification of a declared template type
|
| //
|
| // Requirement:
|
| // dummy_template.txt external template file is available on filesystem
|
| //
|
| // Action:
|
| // - Loads an external template, creates template set, declares a template types and assigns with external template
|
| // - extend template type with new optional parameters
|
| // - registers callback functions to parameters
|
| // - sets start and finish callback
|
| // - checks if parameter substitution is correct after template type modification
|
| //
|
| ///////////////////////////////////////////////////////////
|
| testcase tc_LGenBase_Test_extendTemplateType() runs on EPTF_LGenBase_Test_CT
|
| {
|
| const charstring extTemplName := "dummy";
|
| var EPTF_LGenBase_ExtTemplLoadList extTemplLoadList := { {extTemplName, tsp_dummyTemplatePath, true} }
|
| // load the external template list
|
| f_EPTF_LGenBase_init("LGenBase Templates Test", pl_extTemplLoadList := extTemplLoadList);
|
| // create a new template set
|
| var integer setId := f_EPTF_LGenBase_createTemplateSet();
|
| // declare a new template type
|
| var EPTF_LGenBase_TemplateTypeKey templTypeKey1 := {"MYBEHAVOUR", "dummy1"};
|
| var EPTF_LGenBase_TemplateTypeKey templTypeKey2 := {"MYBEHAVOUR", "dummy2"};
|
| var integer templTypeIdx1 := f_EPTF_LGenBase_declareTemplateType(templTypeKey1, {"VEGETABLE"}, {"FRUIT"})
|
|
|
| var integer templTypeIdx2 := f_EPTF_LGenBase_declareTemplateTypeWithCallbacks(
|
| templTypeKey2,
|
| { {"FRUIT",omit} }, // mandatory parameters
|
| { {"FISH",omit}, {"SPICE",omit}, {"MEAT",omit}, {"VEGETABLE",refers(parameterCallback)} } // optional parameters
|
| )
|
| // assign declared template type to 'dummy' template
|
| var integer templateItemIdx1 := f_EPTF_LGenBase_assignExtTemplToTemplType3(setId, templTypeKey1, extTemplName);
|
| var integer templateItemIdx2 := f_EPTF_LGenBase_assignExtTemplToTemplType3(setId, templTypeKey2, extTemplName);
|
|
|
| //extend template type wuth new param
|
| if (f_EPTF_LGenBase_extendTemplateType(templTypeIdx1, {"MEAT", "FISH"}))
|
| {
|
| log("Extending template type OK");
|
| setverdict(pass);
|
| }
|
| else
|
| {
|
| log("Extending template type failed");
|
| setverdict(fail);
|
| }
|
| //register param callbacks and extend with new param
|
| if (f_EPTF_LGenBase_extendTemplateTypeWithCallback(templTypeIdx1, { {"VEGETABLE", refers(parameterCallback)}, {"SPICE", refers(parameterCallback)} } ))
|
| {
|
| log("Extending template type1 OK");
|
| setverdict(pass);
|
| }
|
| else
|
| {
|
| log("Extending template type1 failed");
|
| setverdict(fail);
|
| }
|
| if (f_EPTF_LGenBase_extendTemplateTypeWithCallback(templTypeIdx2, { {"SPICE", refers(parameterCallback)} } ))
|
| {
|
| log("Extending template type2 OK");
|
| setverdict(pass);
|
| }
|
| else
|
| {
|
| log("Extending template type2 failed");
|
| setverdict(fail);
|
| }
|
| // register start abd finish callbacks
|
| f_EPTF_LGenBase_setStartCallbackToTemplateType(templTypeIdx2, refers(startCallback));
|
| f_EPTF_LGenBase_setFinishCallbackToTemplateType(templTypeIdx2, refers(finishCallback));
|
| // get substituted template content
|
| var charstring content1 := "", content2:="";
|
| var EPTF_IntegerList list := {};
|
| if (f_EPTF_LGenBase_getTemplateContentFastWithCallbackArgs(setId, templateItemIdx1, {"carrot", "apple", "pork", "salmon", "sugar" }, list, content1))
|
| {
|
| log("Substitution done OK");
|
| log("Result:\n", content1);
|
| setverdict(pass);
|
| }
|
| else
|
| {
|
| log("Parameter substitution failed");
|
| setverdict(fail);
|
| }
|
| if (f_EPTF_LGenBase_getTemplateContentFastWithCallbackArgs(setId, templateItemIdx2, {"apple", "salmon", "sugar", "pork", "carrot" }, list, content2))
|
| {
|
| log("Substitution done OK");
|
| log("Result:\n", content2);
|
| setverdict(pass);
|
| }
|
| else
|
| {
|
| log("Parameter substitution failed");
|
| setverdict(fail);
|
| }
|
| // check substituted contents are equal
|
| if (content1 != content2)
|
| {
|
| log("Substituted contents are not equal, test failed");
|
| setverdict(fail);
|
| }
|
| // check start/finish callbacks called correctly
|
| if (list == {1,2,3})
|
| {
|
| log("start/finish callback OK, list:", list);
|
| setverdict(pass);
|
| }
|
| else
|
| {
|
| log("start/finish callback failed, list:", list);
|
| setverdict(fail);
|
| }
|
| f_EPTF_Base_cleanup_CT()
|
| }
|
| function startCallback(inout EPTF_IntegerList intList, inout EPTF_CharstringList paramvalues) runs on EPTF_LGenBase_Test_CT
|
| {
|
| log("+++++++++++++++++++++++++++++");
|
| log("HELLO, THIS IS START CALLBACK");
|
| log("I got contextArgs:", intList, " , param:", paramvalues);
|
| intList := {1,0,0}
|
| log("I return contextArgs:", intList, " , param:", paramvalues);
|
|
|
| }
|
| function finishCallback(inout EPTF_IntegerList intList, inout EPTF_CharstringList paramvalues) runs on EPTF_LGenBase_Test_CT
|
| {
|
| log("HELLO, THIS IS FINISH CALLBACK");
|
| log("I got contextArgs:", intList, " , param:", paramvalues);
|
| if (sizeof(intList)==3 and isvalue(intList[0]) and isvalue(intList[1]) and isvalue(intList[2]))
|
| {
|
| intList[2] := intList[0] + intList[1]
|
| }
|
| else {
|
| log(%definitionId, ": Error: call back context args are uninitialized!")
|
| setverdict(fail);
|
| stop
|
| }
|
| log("I return contextArgs:", intList, " , param:", paramvalues);
|
| log("+++++++++++++++++++++++++++++");
|
| }
|
| function parameterCallback(inout EPTF_IntegerList intList, inout charstring paramvalue)
|
| runs on EPTF_LGenBase_Test_CT
|
| {
|
| log("==>HELLO, THIS IS PARAM CALLBACK, I got contextArgs:", intList, " , param:", paramvalue);
|
| if (sizeof(intList)==3 and isvalue(intList[0]) and isvalue(intList[1]) and isvalue(intList[2]))
|
| {
|
| intList[1] :=intList[1]+ 1
|
| } else {
|
| }
|
| paramvalue := "@@@" & paramvalue & "@@@";
|
| log("==>HELLO, THIS IS PARAM CALLBACK, I return contextArgs:", intList, " , param:", paramvalue);
|
| }
|
|
|
| ///////////////////////////////////////////////////////////
|
| // Testcase: tc_LGenBase_Test_configureTemplateSet
|
| //
|
| // Purpose:
|
| // Testcase to check configuring and using a template set belongs to a traffic case
|
| //
|
| // Requirement:
|
| // dummy_template.txt external template file is available on filesystem
|
| //
|
| // Action:
|
| // - Loads an external template by intiialization of LGenBase
|
| // - declares a template type
|
| // - declares a scenarion with a template set inside
|
| // - starts traffic case
|
| // - during traffic case substitutes template with sample values and logs content
|
| //
|
| ///////////////////////////////////////////////////////////
|
| testcase tc_LGenBase_Test_configureTemplateSet() runs on EPTF_LGenBase_Test_CT
|
| {
|
| //constants
|
| const charstring c_extTemplName := "Dummy Template";
|
| const charstring c_entityType := "TemplateConfig EntityType";
|
| const charstring c_entityGroup := "TemplateConfig EntityGroup";
|
| const charstring c_trafficCase := "TemplateConfig TrafficCase";
|
| const charstring c_scenario := "TemplateConfig Scenario";
|
| const charstring c_fsmName := "TemplateConfig Test FSM";
|
| const EPTF_LGenBase_CompactFsmTable c_lGenFsm :=
|
| {
|
| name := c_fsmName,
|
| stateList := {"idle", "busy"},
|
| timerList := {},
|
| table :=
|
| {
|
| {
|
| eventToListen := { c_EPTF_LGenBase_bIdx, c_EPTF_LGenBase_inputIdx_testMgmt_startTC, fsm},
|
| cellRow :=
|
| {
|
| //state[0]==idle
|
| {{{refers(f_useTemplate),{}}}, omit,omit}
|
| }
|
| }
|
| }
|
| }
|
|
|
| // init component and load external template list
|
| var EPTF_LGenBase_ExtTemplLoadList extTemplLoadList := { {c_extTemplName, tsp_dummyTemplatePath, true} }
|
| f_EPTF_LGenBase_init("LGenBase Templates Config Test", pl_extTemplLoadList := extTemplLoadList);
|
|
|
| // declare template type
|
| var integer templTypeIdx := f_EPTF_LGenBase_declareTemplateType(
|
| {c_behavior, c_templTypeName}, // template typekey
|
| {"VEGETABLE"}, // mandatory params
|
| {"FRUIT", "FISH", "MEAT"} ); // optional params
|
| if (templTypeIdx < 0)
|
| {
|
| log("Could not declare template type");
|
| setverdict(fail);
|
| }
|
|
|
| v_dummyInt := f_EPTF_LGenBase_declareBehaviorType(c_behavior, 1, null, null, null);
|
| v_dummyInt := f_EPTF_LGenBase_declareCompactFsmTable(c_lGenFsm);
|
| v_dummyInt := f_EPTF_LGenBase_declareEntityType(c_entityType, {c_behavior});
|
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup( { c_entityGroup, c_entityType, 1 } );
|
|
|
| //adding the behaviour
|
| var integer groupIdx := f_EPTF_LGenBase_entityGrpNameIndex(c_entityGroup);
|
| var integer groupBaseOffsetIdx := f_EPTF_LGenBase_getEGrpBaseOffset(groupIdx);
|
| log ("groupIdx: ",groupIdx," groupBaseOffsetIdx: ",groupBaseOffsetIdx);
|
|
|
| v_dummyInt := f_EPTF_LGenBase_declareTcType2(
|
| {
|
| name := c_trafficCase,
|
| fsmName := c_fsmName,
|
| entityType := c_entityType,
|
| customEntitySucc := ""
|
| });
|
|
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
|
| {
|
| name := c_scenario,
|
| tcList := {
|
| {
|
| tcName := c_trafficCase,
|
| tcParamsList := {
|
| {target := {cpsToReach := 1.0}},
|
| {scheduler := { preDefinedName := orig }},
|
| {enableEntitiesAtStart := true},
|
| {enabledAtStart := true},
|
| {templateSet :=
|
| {
|
| // this is our template set contains only one template currently
|
| { c_behavior, c_templTypeName, c_extTemplName }
|
| }
|
| }
|
| }
|
| }
|
| },
|
| scParamsList := {}
|
| });
|
|
|
| f_EPTF_LGenBase_createScenario2EntityGroup( { c_entityGroup, c_scenario } );
|
| v_dummyBool := f_EPTF_LGenBase_wait4TestFinished(2.0)
|
| //f_EPTF_LGenBase_stopTrafficCase( c_entityGroup, c_scenario, c_trafficCase);
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
|
|
| // constants for tc_LGenBase_Test_configureTemplateSet test case
|
| const charstring c_behavior := "TemplateConfig Behavior";
|
| const charstring c_templTypeName := "Dummy Template";
|
|
|
| // fsm callback function for tc_LGenBase_Test_configureTemplateSet test case
|
| function f_useTemplate(in EPTF_LGenBase_TestStepArgs pl_ptr) runs on EPTF_LGenBase_Test_CT
|
| {
|
| // get index of template set belongs to current traffic case
|
| var integer tset := f_EPTF_LGenBase_templateSetIdxOfStep(pl_ptr);
|
| if (tset < 0)
|
| {
|
| log("Traffic case doesn't have template set");
|
| setverdict(fail);
|
| return;
|
| }
|
| // get substituted template content
|
| // NOTE: using getTemplateContentFast could be more efficient
|
| var charstring content := "";
|
| if (not f_EPTF_LGenBase_getTemplateContentByTemplTypeKey(
|
| tset,
|
| {c_behavior, c_templTypeName},
|
| {"carrot", "apple", "salmon", "pork"},
|
| content) )
|
| {
|
| log("Parameter substitution didn't succeed");
|
| setverdict(fail);
|
| return;
|
| }
|
| log("Parameter substitution done OK");
|
| log("Result: ", content);
|
| setverdict(pass);
|
| v_LGenBase_testFinished := true
|
| }
|
|
|
| } // end of group externalTemplateTests
|
|
|
| group fsmVariablesAndStatistics{
|
|
|
| type component EPTF_LGenBase_VarAndStatTest_CT extends EPTF_LGenBase_Test_CT{
|
| var EPTF_BooleanList v_LGenBase_VarAndStatTest_stepsPassed := {false,false,false,false}
|
| var integer v_LGenBase_VarAndStatTest_behav := -1;
|
| var EPTF_IntegerList v_LGenBase_entityCalled := {};
|
| }
|
|
|
| //
|
| function f_LGenBase_Test_checkFSMVar(
|
| in EPTF_LGenBase_TestStepArgs pl_ptr,
|
| in charstring pl_varName,
|
| in integer pl_scope,
|
| in float pl_expectedContent,
|
| in integer pl_passedIdx)
|
| runs on EPTF_LGenBase_VarAndStatTest_CT
|
| {
|
| var charstring vl_name := ""
|
| select( pl_scope ){
|
| case ( c_EPTF_LGenBase_fsmObjectScopeFSM ){
|
| vl_name := f_EPTF_LGenBase_varNameOfFSMVar(pl_ptr.eIdx, pl_ptr.refContext.fCtxIdx, pl_varName);
|
| }
|
| case ( c_EPTF_LGenBase_fsmObjectScopeTC ){
|
| vl_name := f_EPTF_LGenBase_varNameOfTCVar(
|
| f_EPTF_LGenBase_tcIdxOfFSM(pl_ptr.eIdx, pl_ptr.refContext.fCtxIdx),
|
| pl_varName);
|
| }
|
| case else{
|
| setverdict(inconc,"Unknown scope: ",pl_scope)
|
| }
|
| }
|
| var integer vl_varId := f_EPTF_Var_getId(vl_name);
|
| var integer vl_recId := f_EPTF_LGenBase_fsmVarIdFromStep(pl_ptr)
|
| if(2 != sizeof(pl_ptr.refContext.fRefArgs)){
|
| setverdict ( fail );
|
| log("Invalid arguments: ",pl_ptr.refContext.fRefArgs);
|
| }else{
|
| if(pl_scope != pl_ptr.refContext.fRefArgs[1]){
|
| setverdict ( fail );
|
| log("The received scope is: ", pl_ptr.refContext.fRefArgs[1]);
|
| }else{
|
| if(vl_varId != vl_recId){
|
| setverdict ( fail );
|
| log("ID of ",vl_name,": ",vl_varId," instead of the received ",vl_recId);
|
| }else{
|
| var EPTF_Var_DirectContent vl_currentContent;
|
| f_EPTF_Var_getContent(vl_varId, vl_currentContent)
|
| if(pl_expectedContent != vl_currentContent.floatVal){
|
| setverdict ( fail );
|
| log("The value is: ",vl_currentContent," instead of ",pl_expectedContent);
|
| }else{
|
| v_LGenBase_VarAndStatTest_stepsPassed[pl_passedIdx] := true;
|
| }
|
| }
|
| }
|
| }
|
| }
|
| function f_LGenBase_Test_checkFSMVar1(in EPTF_LGenBase_TestStepArgs pl_ptr)
|
| runs on EPTF_LGenBase_VarAndStatTest_CT
|
| {
|
| f_LGenBase_Test_checkFSMVar(pl_ptr, "var1ofFSM1", c_EPTF_LGenBase_fsmObjectScopeFSM, 1.0, 0)
|
| }
|
|
|
| function f_LGenBase_Test_checkFSMVar2(in EPTF_LGenBase_TestStepArgs pl_ptr)
|
| runs on EPTF_LGenBase_VarAndStatTest_CT
|
| {
|
| f_LGenBase_Test_checkFSMVar(pl_ptr, "TCvar2ofFSM1", c_EPTF_LGenBase_fsmObjectScopeTC, 2.0, 1)
|
| }
|
|
|
| function f_LGenBase_Test_checkFSMVar3(in EPTF_LGenBase_TestStepArgs pl_ptr)
|
| runs on EPTF_LGenBase_VarAndStatTest_CT
|
| {
|
| f_LGenBase_Test_checkFSMVar(pl_ptr, "TCvar1ofFSM1", c_EPTF_LGenBase_fsmObjectScopeTC, 3.0, 2)
|
| }
|
|
|
| function f_LGenBase_Test_checkFSMVar4(in EPTF_LGenBase_TestStepArgs pl_ptr)
|
| runs on EPTF_LGenBase_VarAndStatTest_CT
|
| {
|
| f_LGenBase_Test_checkFSMVar(pl_ptr, "var2ofFSM1", c_EPTF_LGenBase_fsmObjectScopeFSM, 4.0, 3)
|
| }
|
|
|
| group tcFsmVariables{
|
| const EPTF_LGenBase_FsmVarDeclaratorList c_LGenBase_Test_vars1 :={
|
| {
|
| name := "var1ofFSM1",
|
| initValue := {floatVal := 1.0},
|
| scope := FSM
|
| },
|
| {
|
| name := "TCvar2ofFSM1",
|
| initValue := {floatVal := 2.0},
|
| scope := TC
|
| },
|
| {
|
| name := "TCvar1ofFSM1",
|
| initValue := {floatVal := 3.0},
|
| scope := TC
|
| },
|
| {
|
| name := "var2ofFSM1",
|
| initValue := {floatVal := 4.0},
|
| scope := FSM
|
| }
|
| }
|
|
|
| const EPTF_LGenBase_FsmVarDeclaratorList c_LGenBase_Test_varsInt :={
|
| {
|
| name := "var1ofFSM1",
|
| initValue := {intVal := 1},
|
| scope := FSM
|
| },
|
| {
|
| name := "TCvar2ofFSM1",
|
| initValue := {intVal := 2},
|
| scope := TC
|
| },
|
| {
|
| name := "TCvar1ofFSM1",
|
| initValue := {intVal := 3},
|
| scope := TC
|
| },
|
| {
|
| name := "var2ofFSM1",
|
| initValue := {intVal := 4},
|
| scope := FSM
|
| }
|
| }
|
|
|
| function f_LGenBase_Test_fsmVariables_init(
|
| in integer pl_eCount := 3,
|
| in charstring pl_compName := "tc_LGenBase_Test_fsmVariables",
|
| in integer pl_firstGroupSize := 0)
|
| runs on EPTF_LGenBase_VarAndStatTest_CT{
|
| f_EPTF_LGenBase_init(pl_compName);
|
| v_LGenBase_VarAndStatTest_behav := f_EPTF_LGenBase_declareBehaviorType("b1", -1, null, null, null);
|
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input1");
|
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input2");
|
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input3");
|
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input4");
|
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("et1", {"b1"});
|
| v_dummyInt := f_EPTF_LGenBase_declareFunction("checkFSMVar1", {testStepFunction:= refers(f_LGenBase_Test_checkFSMVar1)})
|
| v_dummyInt := f_EPTF_LGenBase_declareFunction("checkFSMVar2", {testStepFunction:= refers(f_LGenBase_Test_checkFSMVar2)})
|
| v_dummyInt := f_EPTF_LGenBase_declareFunction("checkFSMVar3", {testStepFunction:= refers(f_LGenBase_Test_checkFSMVar3)})
|
| v_dummyInt := f_EPTF_LGenBase_declareFunction("checkFSMVar4", {testStepFunction:= refers(f_LGenBase_Test_checkFSMVar4)})
|
| if(0 < pl_firstGroupSize){
|
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({"eg0", "et1", pl_firstGroupSize})
|
| }
|
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({"eg1", "et1", pl_eCount})
|
| }
|
|
|
| const charstring c_LGenBase_Test_fsmVariablesFSMName := "tc_LGenBase_Test_fsmVariables_FSM1"
|
| const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmVariablesFSM :=
|
| {
|
| name := c_LGenBase_Test_fsmVariablesFSMName,
|
| fsmParams := {
|
| {stateList := {"idle"}},
|
| {varList := c_LGenBase_Test_vars1}
|
| },
|
| table := {
|
| classicTable := {
|
| {eventToListen := {"b1","input1",fsm},
|
| cellRow := {
|
| //state[0]==idle
|
| {{{"checkFSMVar1",{varNames := {"var1ofFSM1"}}}}, omit, omit}
|
| }
|
| },
|
| {eventToListen := {"b1","input2",fsm},
|
| cellRow := {
|
| //state[0]==idle
|
| {{{"checkFSMVar2",{varNames := {"TCvar2ofFSM1"}}}}, omit, omit}
|
| }
|
| },
|
| {eventToListen := {"b1","input3",fsm},
|
| cellRow := {
|
| //state[0]==idle
|
| {{{"checkFSMVar3",{varNames := {"TCvar1ofFSM1"}}}}, omit, omit}
|
| }
|
| },
|
| {eventToListen := {"b1","input4",fsm},
|
| cellRow := {
|
| //state[0]==idle
|
| {{{"checkFSMVar4",{varNames := {"var2ofFSM1"}}}}, omit, omit}
|
| }
|
| },
|
| {eventToListen := {"b1","input5",fsm},
|
| cellRow := {
|
| //state[0]==idle
|
| {{{c_EPTF_LGenBase_stepName_fsmVarSet,{varParams := {"TCvar2ofFSM1",{floatVal := 9.5}}}}}, omit, omit}
|
| }
|
| }
|
| }
|
| }
|
| }
|
|
|
| function f_LGenBase_Test_fsmVariablesCheck(
|
| in integer pl_fsmCtxIdx := 0,
|
| in integer pl_eOffset := 0)
|
| runs on EPTF_LGenBase_VarAndStatTest_CT{
|
|
|
| f_EPTF_LGenBase_dispatchEvent({
|
| {v_LGenBase_VarAndStatTest_behav,0,{pl_eOffset+1,pl_fsmCtxIdx},omit},
|
| {}
|
| })
|
| f_EPTF_LGenBase_dispatchEvent({
|
| {v_LGenBase_VarAndStatTest_behav,1,{pl_eOffset+1,pl_fsmCtxIdx},omit},
|
| {}
|
| })
|
| f_EPTF_LGenBase_dispatchEvent({
|
| {v_LGenBase_VarAndStatTest_behav,2,{pl_eOffset+1,pl_fsmCtxIdx},omit},
|
| {}
|
| })
|
| f_EPTF_LGenBase_dispatchEvent({
|
| {v_LGenBase_VarAndStatTest_behav,3,{pl_eOffset+1,pl_fsmCtxIdx},omit},
|
| {}
|
| })
|
| if({true,true,true,true} == v_LGenBase_VarAndStatTest_stepsPassed){
|
| setverdict ( pass );
|
| }else{
|
| setverdict ( fail, log2str(v_LGenBase_VarAndStatTest_stepsPassed))
|
| }
|
| var EPTF_LGenBase_TestStepArgs vl_args := c_EPTF_LGenBase_emptyTestStepArgs
|
| vl_args.refContext.fCtxIdx := pl_fsmCtxIdx
|
| vl_args.refContext.fRefArgs := {1,c_EPTF_LGenBase_fsmObjectScopeFSM}
|
| vl_args.eIdx :=pl_eOffset+1
|
| var integer vl_varid1 := f_EPTF_LGenBase_fsmVarIdFromStep(vl_args)
|
| vl_args.eIdx :=pl_eOffset+2
|
| var integer vl_varid2 := f_EPTF_LGenBase_fsmVarIdFromStep(vl_args)
|
| if(vl_varid1 == vl_varid2){
|
| setverdict ( fail, "The ID of FSM variables of entity#1 and 2 are the same." );
|
| }
|
| var EPTF_Var_DirectContent vl_currentContent1;
|
| var EPTF_Var_DirectContent vl_currentContent2;
|
| f_EPTF_Var_getContent(vl_varid1, vl_currentContent1)
|
| f_EPTF_Var_getContent(vl_varid2, vl_currentContent2)
|
| if(vl_currentContent1 != vl_currentContent2){
|
| setverdict ( fail, "The content of the variables differ in different entities: ", vl_currentContent1,", ",vl_currentContent2);
|
| }
|
|
|
| vl_args.refContext.fRefArgs := {1,c_EPTF_LGenBase_fsmObjectScopeTC}
|
| vl_args.eIdx :=pl_eOffset+1
|
| vl_varid1 := f_EPTF_LGenBase_fsmVarIdFromStep(vl_args)
|
| vl_args.eIdx :=pl_eOffset+2
|
| vl_varid2 := f_EPTF_LGenBase_fsmVarIdFromStep(vl_args)
|
| if(vl_varid1 != vl_varid2){
|
| setverdict ( fail, "The IDs of TC scope variables are different: ",vl_varid1,", ",vl_varid2 );
|
| }
|
| }
|
|
|
| ///////////////////////////////////////////////////////////
|
| // Testcase: tc_LGenBase_Test_fsmVariables
|
| //
|
| // Purpose:
|
| // Declares 2 variables with FSM scope, and 2 variables with TC scope
|
| // Declares 4 test steps which get the variables as step arguments
|
| // The steps check if
|
| // - the variable ID retrieved from the step argument is proper
|
| // - the initial content of the variable is proper
|
| // The testcase checks also if the varID of the same TC scope
|
| // variables of different entities are the same
|
| //
|
| ///////////////////////////////////////////////////////////
|
| testcase tc_LGenBase_Test_fsmVariables()
|
| runs on EPTF_LGenBase_VarAndStatTest_CT{
|
| f_LGenBase_Test_fsmVariables_init()
|
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input5");
|
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmVariablesFSM);
|
| //log(v_LGenBase_fsmTables)
|
| v_dummyInt := f_EPTF_LGenBase_declareTcType2({
|
| "TC1",
|
| "tc_LGenBase_Test_fsmVariables_FSM1",
|
| "et1",
|
| ""
|
| })
|
| v_dummyInt := f_EPTF_LGenBase_declareTcType2({
|
| "TC2",
|
| "tc_LGenBase_Test_fsmVariables_FSM1",
|
| "et1",
|
| ""
|
| })
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
|
| { "SC1",
|
| {
|
| {"TC1",{{target := {cpsToReach := 0.0}}}},
|
| {"TC2",{{target := {cpsToReach := 0.0}}}}
|
| },
|
| {}
|
| })
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false)
|
| f_LGenBase_Test_fsmVariablesCheck()
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
| }
|
|
|
| testcase tc_LGenBase_Test_fsmVariables2() runs on EPTF_LGenBase_VarAndStatTest_CT{
|
| f_LGenBase_Test_fsmVariables_init()
|
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input5");
|
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input6");
|
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input7");
|
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input8");
|
| //log("------ Before declareFSMTable")
|
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable(
|
| {
|
| name := "tc_LGenBase_Test_fsmVariables2_FSM",
|
| fsmParams := {
|
| {stateList := {"idle"}},
|
| {varList := c_LGenBase_Test_vars1},
|
| {statisticList := {
|
| {"statMax1",{{"var1ofFSM1"},{"TCvar1ofFSM1"}},c_EPTF_StatHandler_Method_Max,{floatVal := 0.0},FSM},
|
| {"statMax2",{{"var1ofFSM1"},{"TCvar1ofFSM1"}},c_EPTF_StatHandler_Method_Max,{floatVal := 0.0},TC},
|
| {"statMin1",{{"var1ofFSM1"}},c_EPTF_StatHandler_Method_Min,{floatVal := 0.0},TC},
|
| {"statMin2",{{"TCvar1ofFSM1"},{"var1ofFSM1"}},c_EPTF_StatHandler_Method_Min,{floatVal := 0.0},TC}
|
| }}
|
| },
|
| table := {
|
| classicTable := {
|
| {eventToListen := {"b1","input1",fsm},
|
| cellRow := {
|
| {//state[0]==idle
|
| {
|
| {"LGenBase: Set variable",{varParams := {"var1ofFSM1",{floatVal := 3.27}}}}
|
| },
|
| omit, omit
|
| }
|
| }
|
| },
|
| {eventToListen := {"b1","input2",fsm},
|
| cellRow := {
|
| {//state[0]==idle
|
| {//Cell
|
| {"LGenBase: Set variable",{varParams := {"var1ofFSM1",{floatVal := 7.1}}}},
|
| {"LGenBase: Increment variable",{varParams := {"var1ofFSM1",{floatVal := 2.9}}}}
|
| },
|
| omit, omit
|
| }
|
| }
|
| },
|
| {eventToListen := {"b1","input3",fsm},
|
| cellRow := {
|
| {//state[0]==idle
|
| {//Cell
|
| {"LGenBase: Set variable",{varParams := {"var1ofFSM1",{floatVal := 7.1}}}},
|
| {"LGenBase: Increment variable",{varParams := {"var1ofFSM1", omit}}}
|
| },
|
| omit, omit
|
| }
|
| }
|
| },
|
| {eventToListen := {"b1","input4",fsm},
|
| cellRow := {
|
| //state[0]==idle
|
| {
|
| {
|
| {"LGenBase: Set variable",{varParams := {"var1ofFSM1",{floatVal := 7.1}}}},
|
| {"LGenBase: Decrement variable",{varParams := {"var1ofFSM1",{floatVal := 1.8}}}}
|
| },
|
| omit, omit
|
| }
|
| }
|
| },
|
| {eventToListen := {"b1","input5",fsm},
|
| cellRow := {
|
| //state[0]==idle
|
| {
|
| {
|
| {"LGenBase: Set variable",{varParams := {"var1ofFSM1",{floatVal := 7.1}}}},
|
| {"LGenBase: Decrement variable",{varParams := {"var1ofFSM1",omit}}}
|
| },
|
| omit, omit
|
| }
|
| }
|
| },
|
| {eventToListen := {"b1","input6",fsm},
|
| cellRow := {
|
| //state[0]==idle
|
| {
|
| {
|
| {"LGenBase: Set variable",{varParams := {"var1ofFSM1",{floatVal := 7.1}}}},
|
| {"LGenBase: Set variable",{varParams := {"var2ofFSM1",{floatVal := 17.4}}}},
|
| {"LGenBase: Set variable",{varParams := {"TCvar1ofFSM1",{floatVal := 3.27}}}},
|
| {"LGenBase: Set variable",{varParams := {"TCvar2ofFSM1",{floatVal := 45.27}}}},
|
| {"LGenBase: Add variables",{varNames := {"var1ofFSM1","var2ofFSM1","TCvar1ofFSM1","TCvar2ofFSM1"}}
|
| }
|
| },
|
| omit, omit
|
| }
|
| }
|
| },
|
| {eventToListen := {"b1","input7",fsm},
|
| cellRow := {
|
| //state[0]==idle
|
| {
|
| {
|
| {"LGenBase: Set variable",{varParams := {"var1ofFSM1",{floatVal := 7.1}}}},
|
| {"LGenBase: Set variable",{varParams := {"var2ofFSM1",{floatVal := 17.4}}}},
|
| {"LGenBase: Set variable",{varParams := {"TCvar2ofFSM1",{floatVal := 3.27}}}},
|
| {"LGenBase: Subtract variables",{varNames := {"var1ofFSM1","var2ofFSM1","TCvar2ofFSM1"}}
|
| }
|
| },
|
| omit, omit
|
| }
|
| }
|
| },
|
| {eventToListen := {"b1","input8",fsm},
|
| cellRow := {
|
| //state[0]==idle
|
| {
|
| {
|
| {"LGenBase: Reset variable",{varNames := {"var1ofFSM1"}}}
|
| },
|
| omit, omit
|
| }
|
| }
|
| }
|
| }
|
| }
|
| }
|
| );
|
| //log("-------------",v_LGenBase_fsmTables)
|
| v_dummyInt := f_EPTF_LGenBase_declareTcType2({
|
| "TC1",
|
| "tc_LGenBase_Test_fsmVariables2_FSM",
|
| "et1",
|
| ""
|
| })
|
| v_dummyInt := f_EPTF_LGenBase_declareTcType2({
|
| "TC2",
|
| "tc_LGenBase_Test_fsmVariables2_FSM",
|
| "et1",
|
| ""
|
| })
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
|
| { "SC1",
|
| {
|
| {"TC1",{{target := {cpsToReach := 0.0}}}},
|
| {"TC2",{{target := {cpsToReach := 0.0}}}}
|
| },
|
| {}
|
| })
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false)
|
| var EPTF_Var_DirectContent vl_content;
|
| var integer vl_var1ofFSM1E0TC1 := f_EPTF_Var_getId(f_EPTF_LGenBase_varNameOfFSMVar(0,1,"var1ofFSM1"))
|
| var integer vl_var1ofFSM1E1TC1 := f_EPTF_Var_getId(f_EPTF_LGenBase_varNameOfFSMVar(1,1,"var1ofFSM1"))
|
| var integer vl_var1ofFSM1E2TC1 := f_EPTF_Var_getId(f_EPTF_LGenBase_varNameOfFSMVar(2,1,"var1ofFSM1"))
|
| var integer vl_statMax1ET0TC1 := f_EPTF_LGenBase_fsmVarIdOfStat("statMax1", 0, 0, c_EPTF_LGenBase_fsmObjectScopeFSM)
|
| var integer vl_statMax1ET1TC1 := f_EPTF_LGenBase_fsmVarIdOfStat("statMax1", 1, 1, c_EPTF_LGenBase_fsmObjectScopeFSM)
|
| var integer vl_statMax2ET1TC1 := f_EPTF_LGenBase_fsmVarIdOfStat("statMax2", 1, 1, c_EPTF_LGenBase_fsmObjectScopeTC)
|
| var integer vl_statMax2ET2TC1 := f_EPTF_LGenBase_fsmVarIdOfStat("statMax2", 2, 1, c_EPTF_LGenBase_fsmObjectScopeTC)
|
|
|
| if(vl_statMax1ET0TC1 == vl_statMax1ET1TC1){
|
| setverdict ( fail );
|
| }
|
| if(vl_statMax2ET1TC1 != vl_statMax2ET2TC1){
|
| setverdict ( fail );
|
| }
|
| //var1ofFSM1 declaration
|
| f_EPTF_Var_getContent(vl_var1ofFSM1E1TC1, vl_content);
|
| if(not match(vl_content, {floatVal := 1.0})){
|
| log(match(vl_content, {floatVal := 1.0}))
|
| setverdict ( fail );
|
| }
|
| f_EPTF_Var_getContent(vl_statMax1ET0TC1,vl_content);
|
| if(not match(vl_content, {floatVal := 3.0})){
|
| log(vl_content)
|
| log(match(vl_content, {floatVal := 3.0}))
|
| setverdict ( fail );
|
| }
|
| f_EPTF_Var_getContent(vl_statMax1ET1TC1,vl_content);
|
| if(not match(vl_content, {floatVal := 3.0})){
|
| log(vl_content)
|
| log(match(vl_content, {floatVal := 3.0}))
|
| setverdict ( fail );
|
| }
|
| //set
|
| f_EPTF_LGenBase_dispatchEvent({{v_LGenBase_VarAndStatTest_behav,0,{1,1},omit},{}});
|
| f_EPTF_Var_getContent(vl_var1ofFSM1E1TC1, vl_content);
|
| if(not match(vl_content, {floatVal := 3.27})){
|
| log(match(vl_content, {floatVal := 3.27}))
|
| setverdict ( fail );
|
| }
|
| f_EPTF_Var_getContent(vl_statMax1ET0TC1,vl_content);
|
| log(vl_content)
|
| f_EPTF_Var_getContent(vl_statMax1ET1TC1,vl_content);
|
| log(vl_content)
|
| //inc
|
| f_EPTF_LGenBase_dispatchEvent({{v_LGenBase_VarAndStatTest_behav,1,{1,1},omit},{}});
|
| f_EPTF_Var_getContent(vl_var1ofFSM1E1TC1, vl_content);
|
| if(not match(vl_content, {floatVal := 10.0})){
|
| log(match(vl_content, {floatVal := 10.0}))
|
| setverdict ( fail );
|
| }
|
| //inc with omit
|
| f_EPTF_LGenBase_dispatchEvent({{v_LGenBase_VarAndStatTest_behav,2,{1,1},omit},{}});
|
| f_EPTF_Var_getContent(vl_var1ofFSM1E1TC1, vl_content);
|
| if(not match(vl_content, {floatVal := 8.1})){
|
| log(match(vl_content, {floatVal := 8.1}))
|
| setverdict ( fail );
|
| }
|
| //dec
|
| f_EPTF_LGenBase_dispatchEvent({{v_LGenBase_VarAndStatTest_behav,3,{1,1},omit},{}});
|
| f_EPTF_Var_getContent(vl_var1ofFSM1E1TC1, vl_content);
|
| if(not match(vl_content, {floatVal := 5.3})){
|
| log(vl_content)
|
| var EPTF_Var_DirectContent vl_temp := {floatVal := 5.3};
|
| log(vl_content.floatVal-vl_temp.floatVal)
|
| log(match(vl_content, {floatVal := 5.3}))
|
| setverdict ( fail );
|
| }
|
| //dec with omit
|
| f_EPTF_LGenBase_dispatchEvent({{v_LGenBase_VarAndStatTest_behav,4,{1,1},omit},{}});
|
| f_EPTF_Var_getContent(vl_var1ofFSM1E1TC1, vl_content);
|
| if(not match(vl_content, {floatVal := 6.1})){
|
| log(match(vl_content, {floatVal := 6.1}))
|
| setverdict ( fail );
|
| }
|
| //add
|
| f_EPTF_LGenBase_dispatchEvent({{v_LGenBase_VarAndStatTest_behav,5,{1,1},omit},{}});
|
| f_EPTF_Var_getContent(vl_var1ofFSM1E1TC1, vl_content);
|
| if(not match(vl_content, {floatVal := 65.94})){
|
| log(vl_content)
|
| log(match(vl_content, {floatVal := 65.94}))
|
| setverdict ( fail );
|
| }
|
| //subtract
|
| f_EPTF_LGenBase_dispatchEvent({{v_LGenBase_VarAndStatTest_behav,6,{1,1},omit},{}});
|
| f_EPTF_Var_getContent(vl_var1ofFSM1E1TC1, vl_content);
|
| if(not match(vl_content, {floatVal := (14.129999 .. 14.130001)})){
|
| log(vl_content)
|
| var EPTF_Var_DirectContent vl_temp := {floatVal := 14.13};
|
| log(vl_content.floatVal - vl_temp.floatVal)
|
| log(match(vl_content, {floatVal := 14.13}))
|
| setverdict ( fail );
|
| }
|
| //reset
|
| f_EPTF_LGenBase_dispatchEvent({{v_LGenBase_VarAndStatTest_behav,7,{1,1},omit},{}});
|
| f_EPTF_Var_getContent(vl_var1ofFSM1E1TC1, vl_content);
|
| if(not match(vl_content, {floatVal := 1.0})){
|
| log(match(vl_content, {floatVal := 1.0}))
|
| setverdict ( fail );
|
| }
|
| setverdict ( pass );
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
|
|
| modulepar EPTF_LGenBase_FsmVarParams tsp_unboundParams
|
| testcase tc_LGenBase_Test_fsmVariables2Int() runs on EPTF_LGenBase_VarAndStatTest_CT{
|
| f_LGenBase_Test_fsmVariables_init()
|
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input5");
|
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input6");
|
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input7");
|
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input8");
|
| v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"checkVarEqual",refers( f_EPTF_LGenBase_checkVarEqual)})
|
| log("------ Before declareFSMTable")
|
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable(
|
| {
|
| name := "tc_LGenBase_Test_fsmVariables2_FSM",
|
| fsmParams := {
|
| {stateList := {"idle"}},
|
| {varList := c_LGenBase_Test_varsInt}
|
| },
|
| table := {
|
| classicTable := {
|
| {eventToListen := {"b1","input1",fsm},
|
| cellRow := {
|
| {//state[0]==idle
|
| {
|
| {"LGenBase: Set variable",{varParams := {"var1ofFSM1",{intVal := 3}}}},
|
| {"checkVarEqual",{varParams := {"var1ofFSM1",{intVal := 3}}}},
|
|
|
| {"LGenBase: Set variable",{varParams := {"var1ofFSM1",{intVal := 7}}}},
|
| {"LGenBase: Increment variable",{varParams := {"var1ofFSM1",{intVal := 3}}}},
|
| {"checkVarEqual",{varParams := {"var1ofFSM1",{intVal := 10}}}},
|
|
|
| {"LGenBase: Set variable",{varParams := {"var1ofFSM1",{intVal := 7}}}},
|
| {"LGenBase: Increment variable",{varNames := {"var1ofFSM1"}}},
|
| {"checkVarEqual",{varParams := {"var1ofFSM1",{intVal := 8}}}},
|
|
|
| {"LGenBase: Set variable",{varParams := {"var1ofFSM1",{intVal := 7}}}},
|
| {"LGenBase: Increment variable",{varParams := {"var1ofFSM1", omit}}},
|
| {"checkVarEqual",{varParams := {"var1ofFSM1",{intVal := 8}}}},
|
|
|
| {"LGenBase: Set variable",{varParams := {"var1ofFSM1",{intVal := 7}}}},
|
| {"LGenBase: Decrement variable",{varParams := {"var1ofFSM1",{intVal := 2}}}},
|
| {"checkVarEqual",{varParams := {"var1ofFSM1",{intVal := 5}}}},
|
|
|
| {"LGenBase: Set variable",{varParams := {"var1ofFSM1",{intVal := 7}}}},
|
| {"LGenBase: Decrement variable",{varParams := {"var1ofFSM1",omit}}},
|
| {"checkVarEqual",{varParams := {"var1ofFSM1",{intVal := 6}}}},
|
|
|
| {"LGenBase: Set variable",{varParams := {"var1ofFSM1",{intVal := 7}}}},
|
| {"LGenBase: Set variable",{varParams := {"var2ofFSM1",{intVal := 17}}}},
|
| {"LGenBase: Set variable",{varParams := {"TCvar1ofFSM1",{intVal := 3}}}},
|
| {"LGenBase: Set variable",{varParams := {"TCvar2ofFSM1",{intVal := 45}}}},
|
| {"LGenBase: Add variables",{varNames := {"var1ofFSM1","var2ofFSM1","TCvar1ofFSM1","TCvar2ofFSM1"}}},
|
| {"checkVarEqual",{varParams := {"var1ofFSM1",{intVal := 65}}}},
|
|
|
| {"LGenBase: Set variable",{varParams := {"var1ofFSM1",{intVal := 7}}}},
|
| {"LGenBase: Set variable",{varParams := {"var2ofFSM1",{intVal := 17}}}},
|
| {"LGenBase: Set variable",{varParams := {"TCvar2ofFSM1",{intVal := 3}}}},
|
| {"LGenBase: Subtract variables",{varNames := {"var1ofFSM1","var2ofFSM1","TCvar2ofFSM1"}}},
|
| {"checkVarEqual",{varParams := {"var1ofFSM1",{intVal := 14}}}},
|
|
|
| {"LGenBase: Reset variable",{varNames := {"var1ofFSM1"}}},
|
| {"checkVarEqual",{varParams := {"var1ofFSM1",{intVal := 1}}}}
|
| },
|
| omit, omit
|
| }
|
| }
|
| }
|
| }
|
| }
|
| }
|
| );
|
| //log("-------------",v_LGenBase_fsmTables)
|
| v_dummyInt := f_EPTF_LGenBase_declareTcType2({
|
| "TC1",
|
| "tc_LGenBase_Test_fsmVariables2_FSM",
|
| "et1",
|
| ""
|
| })
|
| v_dummyInt := f_EPTF_LGenBase_declareTcType2({
|
| "TC2",
|
| "tc_LGenBase_Test_fsmVariables2_FSM",
|
| "et1",
|
| ""
|
| })
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
|
| { "SC1",
|
| {
|
| {"TC1",{{target := {cpsToReach := 0.0}}}},
|
| {"TC2",{{target := {cpsToReach := 0.0}}}}
|
| },
|
| {}
|
| })
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false)
|
| f_EPTF_LGenBase_dispatchEvent({{v_LGenBase_VarAndStatTest_behav,0,{1,1},omit},{}});
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
| }
|
|
|
| testcase tc_LGenBase_Test_test() runs on EPTF_LGenBase_VarAndStatTest_CT{
|
| f_LGenBase_Test_fsmVariables_init()
|
| v_dummyInt := f_EPTF_LGenBase_declareFunction("Finished",{customFinishFunction := refers(f_EPTF_LGenBase_TestFinished)});
|
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable( {
|
| name := "EPTF_FSM_Tc_Succ",
|
| fsmParams := {
|
| {stateList := {"idle"}}
|
| },
|
| table := {
|
| classicTable := {
|
| {eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
|
| cellRow := {
|
| {{
|
| {c_EPTF_LGenBase_stepName_trafficSuccess, omit}
|
| }, omit, omit}
|
| }
|
| }
|
| }
|
| }
|
| }
|
| )
|
| v_dummyInt := f_EPTF_LGenBase_declareTcType2(
|
| {
|
| name := "TC_Succ",
|
| fsmName := "EPTF_FSM_Tc_Succ",
|
| entityType := "et1",
|
| customEntitySucc := ""
|
| }
|
| )
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
|
| {
|
| name := "SC_PH_0",
|
| tcList := {
|
| {
|
| tcName := "TC0_declarator2",
|
| tcParamsList := {
|
| {tcTypeName := "TC_Succ"},
|
| {startDelay := 0.0},
|
| {target := { cpsToReach := 1.0 }},
|
| {scheduler := {preDefinedName := poisson}},
|
| {enableEntitiesAtStart := true},
|
| {enabledAtStart := true},
|
| {ranges := {
|
| {name := "myRange_MSB", enableSplit := true, baseOffset := 10, count := 30},
|
| {name := "myRange_middle", enableSplit := false, baseOffset := 10, count := 30},
|
| {name := "myRange_LSB", enableSplit := false, baseOffset := 0, count := 9}
|
| }
|
| },
|
| {params := {
|
| {aName := "myApplication1", pName := "header", pValue := "$EXTPATH/sip_support/templates/deregister.header"},
|
| {aName := "myApplication2", pName := "boost", pValue := "true"}
|
| }
|
| },
|
| {trafficStartFinish := {
|
| {nrOfExecStart := {count := 5, actions := {}}},
|
| //{nrOfSuccesses := {count := 5,actions := {}}},
|
| //{nrOfGrpLoop := {count := 1,actions := {}}},
|
| //{execTime := {time := 7.0,actions := {}}},
|
| {anythingFinished := {actions := {
|
| {enableTc := {tcName := "TC1_declarator2", aMode := available}}/*,
|
| {disableTc := {tcName := "TC0_declarator2"}}*/
|
| }}}
|
| }
|
| }
|
| }
|
| },
|
| {
|
| tcName := "TC1_declarator2",
|
| tcParamsList := {
|
| {tcTypeName := "TC_Succ"},
|
| {startDelay := 0.0},
|
| {target := { cpsToReach := 2.0 }},
|
| {scheduler := {preDefinedName := imst2}},
|
| {entitySelection := random},
|
| {enableEntitiesAtStart := true},
|
| {enabledAtStart := false},
|
| {trafficStartFinish := {
|
| {nrOfExecStart := {count := 5,actions := {}}},
|
| // {execTime := {time := 15.0,actions := {}}},
|
| {anythingFinished := {actions := {
|
| {customFinishFunction := "Finished"}
|
| }}}
|
| }
|
| }
|
| }
|
| }
|
| },
|
| scParamsList := {
|
| {enabled := true}/*,
|
| {phaseListName := "BasicPhases"},
|
| {phaseFinishConditions := {
|
| {
|
| phase := "preamble",
|
| conditions := {
|
| {
|
| tcStopped := "TC1_declarator2"
|
| }
|
| }
|
| },
|
| {
|
| phase := "loadgen",
|
| conditions := {
|
| {
|
| tcStopped := "TC0_declarator2"
|
| }
|
| }
|
| }
|
| }
|
| },
|
| {phaseStateChangeActions := {
|
| {
|
| phase := "preamble",
|
| state := RUNNING,
|
| actions := {
|
| {
|
| startScenario := "This should have been implemented :)"
|
| }
|
| }
|
| },
|
| {
|
| phase := "preamble",
|
| state := STOPPING,
|
| actions := {
|
| {
|
| stopTc := "TC1_declarator2"
|
| }
|
| }
|
| },
|
| {
|
| phase := "preamble",
|
| state := FINISHED,
|
| actions := {
|
| {
|
| customAction := "Finished"
|
| }
|
| }
|
| },
|
| {
|
| phase := "loadgen",
|
| state := RUNNING,
|
| actions := {
|
| {
|
| startScenario := "This should have been implemented :)"
|
| }
|
| }
|
| },
|
| {
|
| phase := "loadgen",
|
| state := STOPPING,
|
| actions := {
|
| {
|
| stopTc := "TC0_declarator2"
|
| }
|
| }
|
| }
|
| }
|
| }*/
|
| }
|
| })
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
|
| {
|
| name := "SC_PH_1",
|
| tcList := {
|
| {
|
| tcName := "TC0_declarator2",
|
| tcParamsList := {
|
| {tcTypeName := "TC_Succ"},
|
| {target := { cpsToReach := 1.0 }},
|
| {scheduler := {preDefinedName := imst}},
|
| {enableEntitiesAtStart := true},
|
| {enabledAtStart := true},
|
| {ranges := {
|
| {name := "myRange_MSB", enableSplit := true, baseOffset := 10, count := 30},
|
| {name := "myRange_middle", enableSplit := false, baseOffset := 10, count := 30},
|
| {name := "myRange_LSB", enableSplit := false, baseOffset := 0, count := 9}
|
| }},
|
| {params := {
|
| {aName := "myApplication1", pName := "header", pValue := "$EXTPATH/sip_support/templates/deregister.header"},
|
| {aName := "myApplication2", pName := "boost", pValue := "true"}
|
| }},
|
| {trafficStartFinish := {
|
| {nrOfExecStart := {count := 5,actions := {}}},
|
| {execTime := {time := 12.3,actions := {}}},
|
| {nrOfSuccesses := {count := 5,actions := {}}},
|
| //nrOfGrpLoop := 1,
|
| {anythingFinished := {actions := {
|
| {enableTc := {tcName := "TC1_declarator2", aMode := enableIfPreviousSuccess}},
|
| {disableTc := {tcName := "TC0_declarator2"}}
|
| }}}
|
| }}
|
| }
|
| },
|
| {
|
| tcName := "TC1_declarator2",
|
| tcParamsList := {
|
| {tcTypeName := "TC_Succ"},
|
| {target := { cpsToReach := 2.0 }},
|
| {scheduler := {preDefinedName := orig}},
|
| {enableEntitiesAtStart := true},
|
| {enabledAtStart := false},
|
| {trafficStartFinish := {
|
| {nrOfExecStart := {count := 5,actions := {}}},
|
| {execTime := {time := 15.0,actions := {}}},
|
| {anythingFinished := {actions := {
|
| {customFinishFunction := "Finished"}
|
| }}}
|
| }
|
| }
|
| }
|
| }
|
| },
|
| scParamsList := {
|
| {enabled := true}/*,
|
| {phaseListName := "BasicPhases"},
|
| {phaseFinishConditions := {
|
| {
|
| phase := "preamble",
|
| conditions := {
|
| {
|
| tcStopped := "TC1_declarator2"
|
| }
|
| }
|
| },
|
| {
|
| phase := "loadgen",
|
| conditions := {
|
| {
|
| tcStopped := "TC0_declarator2"
|
| }
|
| }
|
| }
|
| }
|
| },
|
| {phaseStateChangeActions := {
|
| {
|
| phase := "preamble",
|
| state := RUNNING,
|
| actions := {
|
| {
|
| startScenario := "This should have been implemented :)"
|
| }
|
| }
|
| },
|
| {
|
| phase := "preamble",
|
| state := STOPPING,
|
| actions := {
|
| {
|
| stopTc := "TC1_declarator2"
|
| }
|
| }
|
| },
|
| {
|
| phase := "preamble",
|
| state := FINISHED,
|
| actions := {
|
| {
|
| customAction := "Finished"
|
| }
|
| }
|
| },
|
| {
|
| phase := "loadgen",
|
| state := RUNNING,
|
| actions := {
|
| {
|
| startScenario := "This should have been implemented :)"
|
| }
|
| }
|
| },
|
| {
|
| phase := "loadgen",
|
| state := STOPPING,
|
| actions := {
|
| {
|
| stopTc := "TC0_declarator2"
|
| }
|
| }
|
| }
|
| }
|
| }*/
|
| }
|
| })
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC_PH_0"});
|
| if(f_EPTF_LGenBase_wait4TestFinished()){
|
| setverdict(pass)
|
| }
|
| f_EPTF_Base_cleanup_CT()
|
| }
|
|
|
| group fsmStatMeasure{
|
| function f_EPTF_LGenBase_checkVarEqual(
|
| in EPTF_LGenBase_TestStepArgs pl_ptr
|
| ) runs on EPTF_LGenBase_CT{
|
| var integer vl_varId
|
| var EPTF_Var_DirectContent vl_param
|
| f_EPTF_LGenBase_fsmVarParamsFromStep(pl_ptr, vl_varId, vl_param)
|
| var EPTF_Var_DirectContent vl_varContent
|
| f_EPTF_Var_getContent(vl_varId, vl_varContent)
|
| if(not match(vl_param,vl_varContent)){
|
| log("The variables don't match")
|
| log(match(vl_param.floatVal,vl_varContent.floatVal))
|
| setverdict(fail)
|
| }else{
|
| setverdict(pass)
|
| }
|
| }
|
|
|
| function f_EPTF_LGenBase_checkFloatVarInRange(
|
| in EPTF_LGenBase_TestStepArgs pl_ptr
|
| ) runs on EPTF_LGenBase_CT{
|
| var integer vl_varId
|
| var EPTF_Var_DirectContent vl_param
|
| f_EPTF_LGenBase_fsmVarParamsFromStep(pl_ptr, vl_varId, vl_param)
|
| var EPTF_Var_DirectContent vl_varContent
|
| f_EPTF_Var_getContent(vl_varId, vl_varContent)
|
| if(not match(vl_varContent, {floatVal := (vl_param.floatVal*0.95 .. vl_param.floatVal*1.05)})){
|
| log("The variables don't match")
|
| log(match(vl_param.floatVal,vl_varContent.floatVal))
|
| setverdict(fail)
|
| }else{
|
| setverdict(pass)
|
| }
|
| }
|
|
|
| function f_EPTF_LGenBase_checkStatMeasEqual(
|
| in EPTF_LGenBase_TestStepArgs pl_ptr
|
| ) runs on EPTF_LGenBase_CT{
|
| var integer vl_statId
|
| var EPTF_Var_DirectContent vl_param
|
| f_EPTF_LGenBase_fsmStatMeasParamsFromStep(pl_ptr, vl_statId, vl_param)
|
| var EPTF_Var_DirectContent vl_varContent
|
| f_EPTF_StatMeasure_stat2Var(vl_statId, vl_varContent)
|
| if(not match(vl_param,vl_varContent)){
|
| log("The statistic value doesn't match with the given one")
|
| log(match(vl_param.floatVal,vl_varContent.floatVal))
|
| setverdict(fail)
|
| }else{
|
| setverdict(pass)
|
| }
|
| }
|
|
|
| function f_EPTF_LGenBase_checkFloatStatInRange(
|
| in EPTF_LGenBase_TestStepArgs pl_ptr
|
| ) runs on EPTF_LGenBase_CT{
|
| var integer vl_statId
|
| var EPTF_Var_DirectContent vl_param
|
| f_EPTF_LGenBase_fsmStatMeasParamsFromStep(pl_ptr, vl_statId, vl_param)
|
| var EPTF_Var_DirectContent vl_varContent
|
| f_EPTF_StatMeasure_stat2Var(vl_statId, vl_varContent)
|
| if(not match(vl_varContent, {floatVal := (vl_param.floatVal*0.95 .. vl_param.floatVal*1.05)})){
|
| log("The statistic value doesn't match with the given one")
|
| log(match(vl_param.floatVal,vl_varContent.floatVal))
|
| setverdict(fail)
|
| }else{
|
| setverdict(pass)
|
| }
|
| }
|
|
|
| function f_EPTF_LGenBase_checkChronoEqual(
|
| in EPTF_LGenBase_TestStepArgs pl_ptr
|
| ) runs on EPTF_LGenBase_Test_CT{
|
| var integer vl_statId
|
| var EPTF_Var_DirectContent vl_param
|
| f_EPTF_LGenBase_fsmStatMeasParamsFromStep(pl_ptr, vl_statId, vl_param)
|
| var EPTF_Var_DirectContent vl_varContent := {floatVal := 0.0}
|
| v_dummyBool := f_EPTF_StatMeasure_getStat_chrono(vl_statId, vl_varContent.floatVal)
|
| if(not match(vl_param,vl_varContent)){
|
| log("The statistic value doesn't match with the given one")
|
| log(match(vl_param.floatVal,vl_varContent.floatVal))
|
| setverdict(fail)
|
| }else{
|
| setverdict(pass)
|
| }
|
| }
|
|
|
| function f_EPTF_LGenBase_checkChronoInRange(
|
| in EPTF_LGenBase_TestStepArgs pl_ptr
|
| ) runs on EPTF_LGenBase_CT{
|
| var integer vl_statId
|
| var EPTF_Var_DirectContent vl_param
|
| f_EPTF_LGenBase_fsmStatMeasParamsFromStep(pl_ptr, vl_statId, vl_param)
|
| var EPTF_Var_DirectContent vl_varContent
|
| f_EPTF_StatMeasure_stat2Var(vl_statId, vl_varContent)
|
| if(not match(vl_varContent, {floatVal := (vl_param.floatVal*0.95 .. vl_param.floatVal*1.05)})){
|
| log("The statistic value doesn't match with the given one")
|
| log(match(vl_param.floatVal,vl_varContent.floatVal))
|
| setverdict(fail)
|
| }else{
|
| setverdict(pass)
|
| }
|
| }
|
|
|
| function f_EPTF_LGenBase_refreshSnapshot(
|
| in EPTF_LGenBase_TestStepArgs pl_ptr
|
| ) runs on EPTF_LGenBase_CT{
|
| f_EPTF_SchedulerComp_refreshSnapshotTime();
|
| }
|
|
|
| function f_EPTF_LGenBase_VarAndStatTestFinished(
|
| in EPTF_LGenBase_TestStepArgs pl_ptr
|
| ) runs on EPTF_LGenBase_VarAndStatTest_CT{
|
| v_LGenBase_testFinished := true
|
| }
|
| testcase tc_LGenBase_Test_fsmStatMeasure()
|
| runs on EPTF_LGenBase_VarAndStatTest_CT{
|
| f_LGenBase_Test_fsmVariables_init()
|
| v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"checkVarEqual",refers( f_EPTF_LGenBase_checkVarEqual)})
|
| v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"checkFloatVarInRange",refers( f_EPTF_LGenBase_checkFloatVarInRange )})
|
| v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"checkStatMeasEqual",refers( f_EPTF_LGenBase_checkStatMeasEqual)})
|
| v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"checkFloatStatInRange",refers( f_EPTF_LGenBase_checkFloatStatInRange )})
|
| v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"checkChronoEqual",refers( f_EPTF_LGenBase_checkChronoEqual)})
|
| v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"checkChronoInRange",refers( f_EPTF_LGenBase_checkChronoInRange )})
|
| v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"finished",refers(f_EPTF_LGenBase_VarAndStatTestFinished)})
|
| v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"refreshSnapshot",refers(f_EPTF_LGenBase_refreshSnapshot)})
|
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable(
|
| {
|
| name := "fsmStatMeasure_FSM",
|
| fsmParams := {
|
| {timerList := {{"time",3.27},{"time2",5.93}}},
|
| {stateList := {"idle"}},
|
| {statMeasStatList := {
|
| {"chrono1","",chrono,FSM},
|
| {"chrono2","",chrono,TC}
|
| }}
|
| },
|
| table := {
|
| classicTable := {
|
| {eventToListen := {"b1","input1",fsm},
|
| cellRow := {
|
| {
|
| {
|
| {"refreshSnapshot",omit},
|
| {c_EPTF_LGenBase_stepName_timerStart,{timerName := "time"}},
|
| {c_EPTF_LGenBase_stepName_timerStart,{timerName := "time2"}},
|
| {c_EPTF_LGenBase_stepName_fsmStartChrono,{statMeasName := "chrono1"}},
|
| {c_EPTF_LGenBase_stepName_fsmStartChrono,{statMeasName := "chrono2"}}
|
| },
|
| omit, omit
|
| }
|
| }
|
| },
|
| {eventToListen := {c_EPTF_LGenBase_specialBName_timerTimeout,"time",fsm},
|
| cellRow := {
|
| {
|
| {
|
| {c_EPTF_LGenBase_stepName_fsmStopChrono,{statMeasName := "chrono1"}},
|
| {c_EPTF_LGenBase_stepName_fsmStopChrono,{statMeasName := "chrono2"}},
|
| {"checkChronoInRange",{statMeasParams := {"chrono1",{floatVal := 3.27}}}},
|
| {"checkChronoInRange",{statMeasParams := {"chrono2",{floatVal := 3.27}}}}
|
| },
|
| omit, omit
|
| }
|
| }
|
| },
|
| {eventToListen := {c_EPTF_LGenBase_specialBName_timerTimeout,"time2",fsm},
|
| cellRow := {
|
| {
|
| {
|
| {"checkChronoInRange",{statMeasParams := {"chrono1",{floatVal := 3.27}}}},
|
| {"checkChronoInRange",{statMeasParams := {"chrono2",{floatVal := 3.27}}}},
|
| {c_EPTF_LGenBase_stepName_fsmResetChrono,{statMeasName := "chrono1"}},
|
| {c_EPTF_LGenBase_stepName_fsmResetChrono,{statMeasName := "chrono2"}},
|
| {c_EPTF_LGenBase_stepName_fsmStartChrono,{statMeasName := "chrono1"}},
|
| {c_EPTF_LGenBase_stepName_fsmStartChrono,{statMeasName := "chrono2"}},
|
| {"checkChronoEqual",{statMeasParams := {"chrono1",{floatVal := 0.0}}}},
|
| {"checkChronoEqual",{statMeasParams := {"chrono2",{floatVal := 0.0}}}},
|
| {"finished",omit}
|
| },
|
| omit, omit
|
| }
|
| }
|
| }
|
| }
|
| }
|
| })
|
| v_dummyInt := f_EPTF_LGenBase_declareTrafficCaseType({
|
| "TC1",
|
| "fsmStatMeasure_FSM",
|
| "et1",
|
| {}
|
| })
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
|
| { "SC1",
|
| {
|
| {"TC1",{
|
| {target := {cpsToReach := 50.0}}
|
| }
|
| }
|
| },
|
| {}
|
| })
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false)
|
| f_EPTF_LGenBase_dispatchEvent({{v_LGenBase_VarAndStatTest_behav,0,{0,0},omit},{}})
|
| v_dummyBool := f_EPTF_LGenBase_wait4TestFinished()
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
|
|
| function f_EPTF_LGenBase_Test_statCreateTimerActionHandler(
|
| in EPTF_ScheduledAction pl_action, in integer pl_eventIndex) runs on EPTF_LGenBase_CT
|
| return boolean{
|
| if(tsp_EPTF_LGenBaseTestDebug) {
|
| log(%definitionId&": ",pl_action)
|
| }
|
| f_EPTF_LGenBase_dispatchEvent({{c_EPTF_LGenBase_bIdx,pl_action.actionId[2],{pl_action.actionId[0],pl_action.actionId[1]},omit},{}})
|
| return true
|
| }
|
|
|
| function f_EPTF_LGenBase_Test_statCreateScheduleAction(
|
| in EPTF_LGenBase_TestStepArgs pl_ptr
|
| ) runs on EPTF_LGenBase_CT{
|
| if(tsp_EPTF_LGenBaseTestDebug) {
|
| log(%definitionId&": ",pl_ptr.eIdx," ",pl_ptr.refContext.fCtxIdx," ",pl_ptr.stepArgs[0],",",pl_ptr)
|
| }
|
| var float vl_duration := int2float(pl_ptr.eIdx+1)/10.0
|
| f_EPTF_SchedulerComp_refreshSnapshotTime();
|
| var integer vl_eventId //dummy
|
| if(tsp_EPTF_LGenBaseTestDebug) {
|
| log("Snapshot time: ",f_EPTF_SchedulerComp_snapshotTime())
|
| log("vl_duration: ",vl_duration)
|
| }
|
| if(not f_EPTF_SchedulerComp_scheduleAction(
|
| f_EPTF_SchedulerComp_snapshotTime()+vl_duration,
|
| refers(f_EPTF_LGenBase_Test_statCreateTimerActionHandler),
|
| {pl_ptr.eIdx,pl_ptr.refContext.fCtxIdx,pl_ptr.refContext.fRefArgs[0]},
|
| vl_eventId))
|
| {
|
| f_EPTF_Base_stop()
|
| }
|
| }
|
|
|
| function f_EPTF_LGenBase_Test_statCreatePostproc(
|
| in integer pl_idx,
|
| in EPTF_IntegerList pl_argList)
|
| runs on LGenBase_Test_StatCreate_CT{
|
| var EPTF_Var_DirectContent vl_content
|
| f_EPTF_Var_getContent(pl_idx, vl_content)
|
| var integer vl_state := f_EPTF_LGenBase_getTcState(0)
|
| if(tsp_EPTF_LGenBaseTestDebug) {
|
| log(%definitionId&": ",vl_content," state of tc:",c_EPTF_LGenBase_stateNames[vl_state])
|
| }
|
| v_statCreateValues[sizeof(v_statCreateValues)] := vl_content.floatVal
|
| }
|
|
|
| function f_EPTF_LGenBase_Test_tcCreated(
|
| in integer pl_tcIdx
|
| ) runs on LGenBase_Test_StatCreate_CT{
|
| var charstring vl_name := f_EPTF_LGenBase_varNameOfTCVar(0,"vf_95")
|
| var integer vl_varId := f_EPTF_Var_getId(vl_name)
|
| f_EPTF_Var_addPostProcFn(vl_varId, {refers(f_EPTF_LGenBase_Test_statCreatePostproc),{}})
|
| }
|
|
|
| function f_EPTF_LGenBase_Test_tcStartedOrStopped_FT(in integer pl_tcIdx, in boolean pl_started)
|
| runs on LGenBase_Test_StatCreate_CT{
|
| if(pl_started){
|
| log(%definitionId&": v_statCreateValues := {}")
|
| v_statCreateValues := {}
|
| }
|
| }
|
|
|
| type component LGenBase_Test_StatCreate_CT extends EPTF_LGenBase_Test_CT {
|
| var EPTF_FloatList v_statCreateValues := {}
|
| const integer c_initVal := 3
|
| const float c_timer := 1.4
|
| const float c_p95InitVal := 0.0
|
| const integer c_entities := 100
|
| const integer c_incVal := 4
|
| const EPTF_StatMeasure_StatParams c_stat95Params := {
|
| percentile95 := {
|
| scale := {
|
| min := 0.0,
|
| max := int2float(c_entities/*-1*/)/10.0,
|
| n := c_entities+1,
|
| scale := linear}
|
| }
|
| }
|
| }
|
| testcase tc_EPTF_LGenBase_Test_statCreate()
|
| runs on LGenBase_Test_StatCreate_CT{
|
| f_EPTF_LGenBase_init("")
|
| var integer vl_incEvent := f_EPTF_LGenBase_declareFsmEvent(c_EPTF_LGenBase_behavior,"incrementVar");
|
| if(tsp_EPTF_LGenBaseTestDebug) {
|
| log("vl_incEvent==",vl_incEvent)
|
| }
|
| v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"checkChronoEqual",refers( f_EPTF_LGenBase_checkChronoEqual)})
|
| v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"checkChronoInRange",refers( f_EPTF_LGenBase_checkChronoInRange )})
|
| v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"statCreateScheduleAction",refers(f_EPTF_LGenBase_Test_statCreateScheduleAction)})
|
| v_dummyInt := f_EPTF_LGenBase_addtrafficCaseCreatedCallback(refers(f_EPTF_LGenBase_Test_tcCreated))
|
| f_EPTF_LGenBase_registerTcStartedCallback(refers( f_EPTF_LGenBase_Test_tcStartedOrStopped_FT ))
|
| v_dummyInt := f_EPTF_LGenBase_addGeneralEventListener(
|
| c_EPTF_LGenBase_bIdx,
|
| c_EPTF_LGenBase_inputIdx_testMgmt_testFinished,
|
| refers(f_EPTF_LGenBase_Test_testFinishedListener), {})
|
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable(
|
| {
|
| name := "XCAP_getFsm",
|
| fsmParams := {
|
| {stateList := {"idle","waitingForResponse"}},
|
| {timerList := {
|
| {name := "T_userWatchdog",startValue :=c_timer}
|
| }}
|
| ,{varList := {
|
| {name := "vf_rtt", initValue := {floatVal := 0.0}, scope := FSM}
|
| ,{name := "vf_95", initValue := {floatVal := 0.0}, scope := TC}
|
| ,{name := "vFSM2", initValue := {intVal := c_initVal}, scope := FSM}
|
| }}
|
| ,{statMeasStatList := {
|
| {name := "mean_rtt", varName := "vf_95",statType := mean, scope := TC}
|
| }}
|
| ,{statMeasWithParamsList := {
|
| {
|
| name := "minChrono",
|
| providerVarName := "vf_95",
|
| targetVarName := "",
|
| statMeasParams := {
|
| statType := min},
|
| scope := TC
|
| },
|
| {
|
| name := "chrono_rtt",
|
| providerVarName := "",
|
| targetVarName := "vf_95",
|
| statMeasParams := {
|
| statType := chrono},
|
| scope := FSM
|
| },
|
| {
|
| name := "p95_rtt",
|
| providerVarName := "vf_95",
|
| targetVarName := "",
|
| statMeasParams := {
|
| params := c_stat95Params
|
| },
|
| scope := TC
|
| }
|
| }}
|
| ,{statHandlerStatList := {{
|
| name := "shTC1",
|
| providers := {
|
| {statMeas := "p95_rtt"}
|
| },
|
| statMethod := c_EPTF_StatHandler_Method_Percentile95,
|
| statResetValue := {floatVal := c_p95InitVal},
|
| scope := TC
|
| }
|
| }}
|
| },
|
| table := {
|
| classicTable := {
|
| {eventToListen := { bName := "EPTF_CLL_LGenBase", iName := "LGenBase: Start_the_traffic_case!", eventType := fsm },
|
| cellRow := {
|
| //state==idle
|
| {actionList := {//XCAPget_DOT: idle -> waitingForResponse [label="i:startTC\no:request\nstart(T_userWatchdog)"]
|
| {stepOrFunctionName := "statCreateScheduleAction", contextArgs :={stepContextArgs := {vl_incEvent}}}
|
| //,{stepOrFunctionName := "LGenBase: Reset chronometer", contextArgs :={statMeasName := "chrono_rtt"}}
|
| ,{stepOrFunctionName := c_EPTF_LGenBase_stepName_fsmStartChrono, contextArgs :={statMeasName := "chrono_rtt"}}
|
| ,{stepOrFunctionName := c_EPTF_LGenBase_stepName_fsmVarInc, contextArgs :={varParams := {"vFSM2",{intVal := c_incVal}}}}
|
| },
|
| nextStateCalculation := omit,
|
| nextState := "waitingForResponse"
|
| }
|
| //state==waitingForResponse
|
| ,{actionList :=omit, nextStateCalculation := omit, nextState := omit}
|
| }
|
| },
|
| {eventToListen := { bName := "EPTF_CLL_LGenBase", iName := "incrementVar", eventType := fsm },
|
| cellRow := {
|
| //state==idle
|
| {actionList :=omit, nextStateCalculation := omit, nextState := omit},
|
| //state==waitingForResponse
|
| {actionList := {
|
| {stepOrFunctionName := c_EPTF_LGenBase_stepName_fsmStopChrono, contextArgs :={statMeasName := "chrono_rtt"}},
|
| {stepOrFunctionName := c_EPTF_LGenBase_stepName_trafficSuccess, contextArgs := omit}},
|
| nextStateCalculation := omit,
|
| nextState := "idle"
|
| }
|
| }
|
| }
|
| }//table
|
| }
|
| }//fsm //XCAPget_DOT:}
|
| )
|
| v_dummyInt := f_EPTF_LGenBase_declareBehaviorType("b1", -1, null, null, null);
|
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("Entity_Tc_A", {"b1"});
|
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({name := "eg0", eType := "Entity_Tc_A", eCount := c_entities})
|
| v_dummyInt := f_EPTF_LGenBase_declareTcType2({
|
| name := "TC_Delayed",
|
| fsmName := "XCAP_getFsm",
|
| entityType := "Entity_Tc_A",
|
| customEntitySucc := ""
|
| })
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
|
| {
|
| name := "Scenario_Simple",
|
| tcList := {
|
| {
|
| tcName := "TC_Delayed",
|
| tcParamsList := {
|
| {enabledAtStart := true},
|
| {enableEntitiesAtStart := true},
|
| {entityFinishConditions := {{nrOfSuccesses := 1}}},
|
| {target := {cpsToReach := 1111.0}},
|
| {trafficFinishedActions := {{testFinished := {}}}},
|
| {trafficStartFinish := {
|
| {nrOfExecStart := {count := c_entities,actions := {}}}
|
| }}
|
| }
|
| }
|
| },
|
| scParamsList := {}
|
| })
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0", "Scenario_Simple"},true)
|
| if(f_EPTF_LGenBase_wait4TestFinished(int2float(c_entities)+2.0)){
|
| var integer vl_temp := f_EPTF_LGenBase_fsmStatMeasIdOfTC(0,"mean_rtt")
|
| if( -1 == vl_temp){
|
| log("f_EPTF_LGenBase_fsmStatMeasIdOfTC(0,""mean_rtt"") == ",vl_temp)
|
| setverdict(fail)
|
| }
|
| var integer vl_statId95 := f_EPTF_LGenBase_fsmStatMeasIdOfTC(0, "p95_rtt")
|
| var charstring vl_name := f_EPTF_LGenBase_varNameOfTCVar(0,"vf_95")
|
| var integer vl_varIdx0 := f_EPTF_Var_getId(vl_name)
|
| if(tsp_EPTF_LGenBaseTestDebug) {
|
| log("StatMeasID of TC stat p95_rtt: ",vl_statId95)
|
| }
|
| for ( var integer vl_i := 0; vl_i < c_entities ; vl_i := vl_i+1 ){
|
| var integer vl_statIdOfStatMeas := f_EPTF_LGenBase_fsmStatMeasIdOfFSM(vl_i, 0, "chrono_rtt")
|
| var integer vl_varIdOfStatMeas := f_EPTF_StatMeasure_getCreatedVarIdx(vl_statIdOfStatMeas)
|
| if(vl_varIdx0 != vl_varIdOfStatMeas){
|
| log("The created variable ID of the chrono stat#",vl_i," is ",vl_varIdOfStatMeas,
|
| " instead of ",vl_varIdx0)
|
| setverdict(fail)
|
| }
|
| var integer vl_varIdInc := f_EPTF_Var_getId(f_EPTF_LGenBase_varNameOfFSMVar(vl_i, 0, "vFSM2"))
|
| var EPTF_Var_DirectContent vl_contentInc
|
| f_EPTF_Var_getContent(vl_varIdInc, vl_contentInc)
|
| if(c_initVal+c_incVal != vl_contentInc.intVal){
|
| log("Content of variable to be incremented: ",match(c_initVal+c_incVal, vl_contentInc.intVal))
|
| setverdict(fail)
|
| }
|
| if(tsp_EPTF_LGenBaseTestDebug) {
|
| log("StatMeasID of stat chrono_rtt: ",vl_statIdOfStatMeas)
|
| log("Created variable ID of stat chrono_rtt: ",vl_varIdOfStatMeas)
|
| }
|
| }
|
| var integer vl_testVar
|
| f_EPTF_Var_newFloat("testVar", 0.0, vl_testVar)
|
| var integer vl_testStatId := f_EPTF_StatMeasure_newStatWithParams(vl_testVar, c_stat95Params)
|
| for ( var integer vl_i := 0; vl_i < sizeof(v_statCreateValues) ; vl_i := vl_i+1 ){
|
| f_EPTF_Var_adjustContent(vl_testVar, {floatVal := v_statCreateValues[vl_i]})
|
| }
|
| if(tsp_EPTF_LGenBaseTestDebug) {
|
| log(v_statCreateValues)
|
| }
|
| var float vl_expected, vl_measured
|
| f_EPTF_StatMeasure_getStat_percentile95(vl_testStatId, vl_expected)
|
| f_EPTF_StatMeasure_getStat_percentile95(vl_statId95, vl_measured)
|
| if(not match(vl_measured, vl_expected)){
|
| log(match(vl_measured, vl_expected))
|
| setverdict(fail)
|
| }
|
| var integer vl_varSh := f_EPTF_LGenBase_fsmVarIdOfTCStat("shTC1", 0)
|
| if(-1<vl_varSh){
|
| //timer t1
|
| //t1.start(0.1)
|
| //t1.timeout
|
| var EPTF_Var_DirectContent vl_currentContent
|
| f_EPTF_Var_getContent(vl_varSh, vl_currentContent)
|
| if(vl_measured == vl_currentContent.floatVal){
|
| setverdict(pass)
|
| }else{
|
| setverdict(inconc,"content(",vl_currentContent,")!= vl_measured(",vl_measured,")")
|
| }
|
| }else{
|
| setverdict(fail,"vl_varSh < 0")
|
| }
|
| f_EPTF_LGenBase_restoreScenario("eg0", "Scenario_Simple", false)
|
| for ( var integer vl_i := 0; vl_i < c_entities ; vl_i := vl_i+1 ){
|
| var integer vl_varIdInc := f_EPTF_Var_getId(f_EPTF_LGenBase_varNameOfFSMVar(vl_i, 0, "vFSM2"))
|
| var EPTF_Var_DirectContent vl_contentInc
|
| f_EPTF_Var_getContent(vl_varIdInc, vl_contentInc)
|
| if(c_initVal != vl_contentInc.intVal){
|
| log("Content of variable to be incremented: ",match(c_initVal+c_incVal, vl_contentInc.intVal))
|
| setverdict(fail)
|
| }
|
| }
|
| v_statCreateValues := {}
|
| f_EPTF_LGenBase_enableScenarioOnEntityGroup(0, 0, true)
|
| if(f_EPTF_LGenBase_wait4TestFinished(int2float(c_entities)+2.0)){
|
| f_EPTF_StatMeasure_getStat_percentile95(vl_statId95, vl_measured)
|
| f_EPTF_StatMeasure_disableStat(vl_testStatId)
|
| f_EPTF_Var_adjustContent(vl_testVar, {floatVal := 0.0})
|
| f_EPTF_StatMeasure_initStatValue(vl_testStatId)
|
| f_EPTF_StatMeasure_enableStat(vl_testStatId)
|
| for ( var integer vl_i := 0; vl_i < sizeof(v_statCreateValues) ; vl_i := vl_i+1 ){
|
| f_EPTF_Var_adjustContent(vl_testVar, {floatVal := v_statCreateValues[vl_i]})
|
| }
|
| f_EPTF_StatMeasure_getStat_percentile95(vl_testStatId, vl_expected)
|
|
|
| if(vl_expected == vl_measured){
|
| setverdict ( pass );
|
| }else{
|
| if(tsp_EPTF_LGenBaseTestDebug) {
|
| log(v_statCreateValues)
|
| }
|
| setverdict(fail,"Second run: "&log2str(vl_measured)&" instead of ",vl_expected)
|
| }
|
| }else{
|
| setverdict(fail,"Not finished at second run")
|
| }
|
| }else{
|
| setverdict(fail,"Not finished")
|
| }
|
| //f_EPTF_LGenBase_startEntity("eg0", "Scenario_Simple", "TC_Delayed", 0, true)
|
| f_EPTF_Base_cleanup_CT()
|
| }
|
|
|
| }
|
|
|
| group statList{
|
|
|
| // commented - f_EPTF_LGenBase_getStatisticsOfTcs is private
|
| /* testcase tc_EPTF_LGenBase_Test_statList()
|
| runs on EPTF_LGenBase_Test_CT{
|
| f_EPTF_LGenBase_init("")
|
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable(
|
| {
|
| name := "XCAP_getFsm",
|
| fsmParams := {
|
| {stateList := {"idle"}}
|
| ,{varList := {
|
| {name := "vf_rtt", initValue := {floatVal := 0.0}, scope := TC}
|
| ,{name := "vf_95", initValue := {floatVal := 0.0}, scope := TC}
|
| ,{name := "vFSM2", initValue := {intVal := 2}, scope := FSM}
|
| }}
|
| ,{statMeasStatList := {
|
| {name := "mean_rtt", varName := "vf_rtt",statType := mean, scope := TC},
|
| {name := "chrono", varName := "vf_rtt",statType := mean, scope := TC}
|
| }}
|
| ,{statHandlerStatList := {
|
| {name := "shTC1",
|
| providers := {
|
| {varList := {"vf_rtt"}}
|
| },
|
| statMethod := c_EPTF_StatHandler_Method_Min,
|
| statResetValue := {floatVal := 0.1},
|
| scope := TC
|
| }
|
| ,{name := "shTC2",
|
| providers := {
|
| {varList := {"vf_rtt"}}
|
| },
|
| statMethod := c_EPTF_StatHandler_Method_Max,
|
| statResetValue := {floatVal := 0.2},
|
| scope := TC
|
| }
|
| ,{name := "shTC3",
|
| providers := {
|
| {varList := {"vf_95"}}
|
| },
|
| statMethod := c_EPTF_StatHandler_Method_Min,
|
| statResetValue := {floatVal := 0.3},
|
| scope := TC
|
| }
|
| }}
|
| },
|
| table := {
|
| classicTable := {
|
| {eventToListen := { bName := "EPTF_CLL_LGenBase", iName := "LGenBase: Start_the_traffic_case!", eventType := fsm },
|
| cellRow := {
|
| //state==idle
|
| {actionList := omit,
|
| nextStateCalculation := omit,
|
| nextState := omit
|
| }
|
| }
|
| }
|
| }
|
| }//table
|
| }//fsm //XCAPget_DOT:}
|
| )
|
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable(
|
| {
|
| name := "XCAP_getFsm2",
|
| fsmParams := {
|
| {stateList := {"idle"}}
|
| ,{varList := {
|
| {name := "vf_rtt", initValue := {floatVal := 0.0}, scope := TC}
|
| ,{name := "vf_95", initValue := {floatVal := 0.0}, scope := TC}
|
| ,{name := "vFSM2", initValue := {intVal := 2}, scope := FSM}
|
| }}
|
| ,{statMeasStatList := {
|
| {name := "mean_rtt", varName := "vf_rtt",statType := mean, scope := TC},
|
| {name := "p95", varName := "vf_rtt",statType := percentile95, scope := TC}
|
| }}
|
| ,{statHandlerStatList := {
|
| {name := "shTC2-1",
|
| providers := {
|
| {statMeas := "p95"}
|
| },
|
| statMethod := c_EPTF_StatHandler_Method_Percentile95,
|
| statResetValue := {floatVal := 0.0},
|
| scope := TC
|
| }
|
| ,{name := "shTC2-2",
|
| providers := {
|
| {varList := {"vf_rtt"}}
|
| },
|
| statMethod := c_EPTF_StatHandler_Method_Min,
|
| statResetValue := {floatVal := 1.0},
|
| scope := TC
|
| }
|
| ,{name := "shTC2-3",
|
| providers := {
|
| {varList := {"vf_95"}}
|
| },
|
| statMethod := c_EPTF_StatHandler_Method_Max,
|
| statResetValue := {floatVal := 2.0},
|
| scope := TC
|
| }
|
| }}
|
| },
|
| table := {
|
| classicTable := {
|
| {eventToListen := { bName := "EPTF_CLL_LGenBase", iName := "LGenBase: Start_the_traffic_case!", eventType := fsm },
|
| cellRow := {
|
| //state==idle
|
| {actionList := omit,
|
| nextStateCalculation := omit,
|
| nextState := omit
|
| }
|
| }
|
| }
|
| }
|
| }//table
|
| }//fsm //XCAPget_DOT:}
|
| )
|
| v_dummyInt := f_EPTF_LGenBase_declareBehaviorType("b1", -1, null, null, null);
|
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("Entity_Tc_A", {"b1"});
|
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({name := "eg0", eType := "Entity_Tc_A", eCount := 5})
|
| v_dummyInt := f_EPTF_LGenBase_declareTcType2({
|
| name := "TC_Delayed",
|
| fsmName := "XCAP_getFsm",
|
| entityType := "Entity_Tc_A",
|
| customEntitySucc := ""
|
| })
|
| v_dummyInt := f_EPTF_LGenBase_declareTcType2({
|
| name := "TC_Delayed2",
|
| fsmName := "XCAP_getFsm2",
|
| entityType := "Entity_Tc_A",
|
| customEntitySucc := ""
|
| })
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
|
| {
|
| name := "Scenario_Simple",
|
| tcList := {
|
| { tcName := "TC_Delayed",
|
| tcParamsList := {
|
| {target := {cpsToReach := 1111.0}}
|
| }},
|
| { tcName := "TC_Delayed2",
|
| tcParamsList := {{target := {cpsToReach := 1111.0}}}
|
| }
|
| },
|
| scParamsList := {}
|
| })
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0", "Scenario_Simple"},false)
|
| var EPTF_LGenBase_StatisticListOfTCList c_expected := {
|
| }
|
| c_expected[0].entityGroup := "eg0"
|
| c_expected[0].scenario := "Scenario_Simple"
|
| c_expected[0].tc := "TC_Delayed"
|
| c_expected[0].stats[0].declaredName := "shTC1"
|
| c_expected[0].stats[0].statName := f_EPTF_LGenBase_varNameOfTCVar(0, "shTC1")
|
| c_expected[0].stats[0].statMethod := c_EPTF_StatHandler_Method_Min
|
| c_expected[0].stats[0].statResetValue := {floatVal := 0.1}
|
| c_expected[0].stats[1].declaredName := "shTC2"
|
| c_expected[0].stats[1].statName := f_EPTF_LGenBase_varNameOfTCVar(0, "shTC2")
|
| c_expected[0].stats[1].statMethod := c_EPTF_StatHandler_Method_Max
|
| c_expected[0].stats[1].statResetValue := {floatVal := 0.2}
|
| c_expected[0].stats[2].declaredName := "shTC3"
|
| c_expected[0].stats[2].statName := f_EPTF_LGenBase_varNameOfTCVar(0, "shTC3")
|
| c_expected[0].stats[2].statMethod := c_EPTF_StatHandler_Method_Min
|
| c_expected[0].stats[2].statResetValue := {floatVal := 0.3}
|
|
|
| c_expected[1].entityGroup := "eg0"
|
| c_expected[1].scenario := "Scenario_Simple"
|
| c_expected[1].tc := "TC_Delayed2"
|
| c_expected[1].stats[0].declaredName := "shTC2-1"
|
| c_expected[1].stats[0].statName := f_EPTF_LGenBase_varNameOfTCVar(1, "shTC2-1")
|
| c_expected[1].stats[0].statMethod := c_EPTF_StatHandler_Method_Percentile95
|
| c_expected[1].stats[0].statResetValue := {floatVal := 0.0}
|
| c_expected[1].stats[1].declaredName := "shTC2-2"
|
| c_expected[1].stats[1].statName := f_EPTF_LGenBase_varNameOfTCVar(1, "shTC2-2")
|
| c_expected[1].stats[1].statMethod := c_EPTF_StatHandler_Method_Min
|
| c_expected[1].stats[1].statResetValue := {floatVal := 1.0}
|
| c_expected[1].stats[2].declaredName := "shTC2-3"
|
| c_expected[1].stats[2].statName := f_EPTF_LGenBase_varNameOfTCVar(1, "shTC2-3")
|
| c_expected[1].stats[2].statMethod := c_EPTF_StatHandler_Method_Max
|
| c_expected[1].stats[2].statResetValue := {floatVal := 2.0}
|
|
|
| var EPTF_LGenBase_StatisticListOfTCList vl_list
|
| log(v_LGenBase_trafficCases[0].statisticList)
|
| log(v_LGenBase_trafficCases[1].statisticList)
|
| log(v_LGenBase_fsmTables[0].statisticListArray)
|
| log(v_LGenBase_fsmTables[1].statisticListArray)
|
| f_EPTF_LGenBase_getStatisticsOfTcs(vl_list)
|
| log(c_expected)
|
| log(vl_list)
|
| if(not match(c_expected, vl_list)){
|
| setverdict ( fail,match(c_expected, vl_list) );
|
| }else{
|
| setverdict(pass)
|
| }
|
| //f_EPTF_LGenBase_startEntity("eg0", "Scenario_Simple", "TC_Delayed", 0, true)
|
| f_EPTF_Base_cleanup_CT()
|
| }*/
|
| }
|
| function f_EPTF_LGenBase_Test_fsmStateStepMustNotBeCalled(
|
| in EPTF_LGenBase_TestStepArgs pl_ptr
|
| ) runs on EPTF_LGenBase_VarAndStatTest_CT{
|
| setverdict(fail)
|
| v_LGenBase_VarAndStatTest_stepsPassed[sizeof(v_LGenBase_VarAndStatTest_stepsPassed)] := false
|
| }
|
|
|
| function f_EPTF_LGenBase_Test_fsmStateStepMustBeCalled(
|
| in EPTF_LGenBase_TestStepArgs pl_ptr
|
| ) runs on EPTF_LGenBase_VarAndStatTest_CT{
|
| setverdict(pass)
|
| v_LGenBase_VarAndStatTest_stepsPassed[sizeof(v_LGenBase_VarAndStatTest_stepsPassed)] := true
|
| }
|
|
|
| function f_EPTF_LGenBase_Test_fsmStateFinished(
|
| in EPTF_LGenBase_TestStepArgs pl_ptr
|
| ) runs on EPTF_LGenBase_VarAndStatTest_CT{
|
| log("----Finished")
|
| v_LGenBase_testFinished := true
|
| }
|
|
|
| function f_EPTF_LGenBase_Test_checkStateName(
|
| in EPTF_LGenBase_TestStepArgs pl_ptr
|
| ) runs on EPTF_LGenBase_VarAndStatTest_CT{
|
| if("st1"==f_EPTF_LGenBase_getEntityStateNameAtFsm(pl_ptr.eIdx, pl_ptr.refContext.fCtxIdx)){
|
| setverdict(pass)
|
| }else{
|
| setverdict(fail)
|
| }
|
| }
|
|
|
| //never called ????:
|
| function f_EPTF_LGenBase_varAndStatTestFirstTCFinished(in integer pl_idx)
|
| runs on EPTF_LGenBase_VarAndStatTest_CT{
|
| log("------First finished function called.")
|
| v_LGenBase_testFinished := true;
|
| }
|
|
|
| function f_EPTF_LGenBase_varAndStatTestCheckCallsAfterFinished(in EPTF_LGenBase_TestStepArgs pl_ptr)
|
| runs on EPTF_LGenBase_VarAndStatTest_CT{
|
| log(">>>v_LGenBase_testFinished: ",v_LGenBase_testFinished);
|
| log(">>>f_EPTF_LGenBase_tcIdxOfStep(pl_ptr): ",f_EPTF_LGenBase_tcIdxOfStep(pl_ptr));
|
|
|
| if(v_LGenBase_testFinished and 0 == f_EPTF_LGenBase_tcIdxOfStep(pl_ptr)){
|
| log("There is traffic on tc#0 after the tc finished!")
|
| setverdict ( fail );
|
| }
|
| }
|
|
|
| function f_LGenBase_Test_fsmEntityFinishSucc(in EPTF_LGenBase_EntitySelectionType pl_selection := round_robin)
|
| runs on EPTF_LGenBase_VarAndStatTest_CT{
|
| f_LGenBase_Test_fsmVariables_init(4)
|
| v_dummyInt := f_EPTF_LGenBase_declareFunction("Finished",{customFinishFunction := refers(f_EPTF_LGenBase_TestFinished)});
|
| v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior,{"CheckCallsAfterFinished", refers( f_EPTF_LGenBase_varAndStatTestCheckCallsAfterFinished )})
|
| const integer c_initValue := 4
|
| const integer c_count := 7
|
| const integer c_inc := 3
|
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable(
|
| {
|
| name := "tc_LGenBase_Test_fsmEntityFinishSucc_FSM",
|
| fsmParams := {
|
| {stateList := {"idle"}},
|
| {varList := {{
|
| name := "var1ofFSM1",
|
| initValue := {intVal := c_initValue},
|
| scope := FSM
|
| }
|
| }}
|
| },
|
| table := {
|
| classicTable := {
|
| {eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
|
| cellRow := {
|
| //state[0]==idle
|
| {{
|
| {c_EPTF_LGenBase_stepName_fsmVarInc, {varParams := {"var1ofFSM1",{intVal := c_inc}}}},
|
| {"CheckCallsAfterFinished", omit},
|
| {c_EPTF_LGenBase_stepName_trafficSuccess, omit}
|
| }, omit, omit}
|
| }
|
| }
|
| }
|
| }
|
| }
|
| );
|
| //log(v_LGenBase_fsmTables)
|
| v_dummyInt := f_EPTF_LGenBase_declareTrafficCaseType({
|
| "TC1",
|
| "tc_LGenBase_Test_fsmEntityFinishSucc_FSM",
|
| "et1",
|
| {}
|
| })
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
|
| { "SC1",
|
| {
|
| {"TC1",{
|
| {entitySelection := pl_selection},
|
| {enabledAtStart := true},
|
| {enableEntitiesAtStart := true},
|
| {target := {cpsToReach := 50.0}},
|
| {trafficStartFinish :={
|
| {entitiesFinished := {{}}}
|
| }},
|
| {trafficFinishedActions := {
|
| {customFinishFunction := "Finished"}
|
| }
|
| },
|
| {entityFinishConditions := {
|
| {nrOfSuccesses := c_count}}
|
| }
|
| }
|
| }
|
| },
|
| {}
|
| })
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},true)
|
| if(not f_EPTF_LGenBase_wait4TestFinished()){
|
| //log("----",v_LGenBase_trafficCases[0])
|
| setverdict(fail);
|
| }else{
|
| var integer vl_varId := f_EPTF_Var_getId(f_EPTF_LGenBase_varNameOfFSMVar(0, 0, "var1ofFSM1"))
|
| if(-1 < vl_varId){
|
| var EPTF_Var_DirectContent vl_content
|
| f_EPTF_Var_getContent(vl_varId,vl_content)
|
| if(match(vl_content.intVal, c_initValue+c_count*c_inc)){
|
| setverdict(pass)
|
| }else{
|
| setverdict(fail, log2str(match(vl_content.intVal, c_initValue+c_count*c_inc)))
|
| }
|
| }else{
|
| log("There is no variable ID of FSM variable var1ofFSM1")
|
| f_EPTF_Base_stop()
|
| }
|
| setverdict(pass)
|
| }
|
| f_EPTF_Base_cleanup_CT()
|
| }
|
|
|
| testcase tc_LGenBase_Test_fsmEntityFinishSucc() runs on EPTF_LGenBase_VarAndStatTest_CT{
|
| f_LGenBase_Test_fsmEntityFinishSucc()
|
| }
|
|
|
| testcase tc_LGenBase_Test_fsmEntityFinishSuccRandom() runs on EPTF_LGenBase_VarAndStatTest_CT{
|
| f_LGenBase_Test_fsmEntityFinishSucc(random)
|
| }
|
|
|
| testcase tc_LGenBase_Test_rangeLoop()
|
| runs on EPTF_LGenBase_VarAndStatTest_CT{
|
| f_LGenBase_Test_fsmVariables_init(400)
|
| v_dummyInt := f_EPTF_LGenBase_declareFunction("Finished",{customFinishFunction := refers(f_EPTF_LGenBase_TestFinished)});
|
| v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior,{"CheckCallsAfterFinished", refers( f_EPTF_LGenBase_varAndStatTestCheckCallsAfterFinished )})
|
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable(
|
| {
|
| name := "tc_LGenBase_Test_range_FSM",
|
| fsmParams := {
|
| {stateList := {"idle"}}
|
| },
|
| table := {
|
| classicTable := {
|
| {eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
|
| cellRow := {
|
| //state[0]==idle
|
| {{
|
| {c_EPTF_LGenBase_stepName_trafficSuccess, omit}
|
| }, omit, omit}
|
| }
|
| }
|
| }
|
| }
|
| }
|
| );
|
| //log(v_LGenBase_fsmTables)
|
| v_dummyInt := f_EPTF_LGenBase_declareTrafficCaseType({
|
| "TC1",
|
| "tc_LGenBase_Test_range_FSM",
|
| "et1",
|
| {}
|
| })
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
|
| { "SC1",
|
| {
|
| {"TC1",{
|
| {entitySelection := round_robin},
|
| {enabledAtStart := true},
|
| {enableEntitiesAtStart := true},
|
| {target := {cpsToReach := 50.0}},
|
| {trafficStartFinish :={
|
| {nrOfRangeLoop := {2, {}}}
|
| }},
|
| {trafficFinishedActions := {
|
| {customFinishFunction := "Finished"}
|
| }
|
| },
|
| {ranges := {
|
| {name := "public id", enableSplit := true, baseOffset := 0, count := 2},
|
| {name := "user id", enableSplit := false, baseOffset := 0, count := 3}
|
| }}
|
| }
|
| }
|
| },
|
| {}
|
| })
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},true)
|
| if(not f_EPTF_LGenBase_wait4TestFinished()){
|
| //log("----",v_LGenBase_trafficCases[0])
|
| }else{
|
| if(12 != f_EPTF_LGenBase_getTcStarts(0)){
|
| log("Min: ")
|
| log(match(12, f_EPTF_LGenBase_getTcStarts(0)))
|
| setverdict(fail);
|
| }else{
|
| setverdict(pass)
|
| }
|
| }
|
| f_EPTF_Base_cleanup_CT()
|
| }
|
|
|
| function f_EPTF_LGenBase_Test_PhaseFinishedFn(
|
| in charstring pl_eGrpName,
|
| in charstring pl_scName,
|
| in charstring pl_phase,
|
| in EPTF_IntegerList pl_args)
|
| runs on EPTF_LGenBase_Test_CT{
|
| log(%definitionId&" function called.")
|
| v_LGenBase_testFinished := true
|
| }
|
| ///////////////////////////////////////////////////////////
|
| // Testcase: tc_EPTF_LGenBase_Test_registerPhases
|
| //
|
| //
|
| // Purpose:
|
| // Testcase to check phase registration feature
|
| //
|
| // Requirement:
|
| // -
|
| //
|
| // Action:
|
| // - Creates a "register" and a "doTraffic" traffic case
|
| // - reads tsp_EPTF_LGenBase_PhaseList_Declarators from module par and generates 2 phase type "BasicPhases", "AdvancedPhases"
|
| // - declare phase actions and finish conditions
|
| // - starts "preamble" phase
|
| // - after 50sec start "loadgen" phase
|
| // - after 50sec checks number of runs, generates final verdict
|
| ///////////////////////////////////////////////////////////
|
| testcase tc_EPTF_LGenBase_Test_registerPhases()
|
| runs on EPTF_LGenBase_Test_CT{
|
| f_EPTF_LGenBase_init("lGenBasePhaseTest", 0, "lGenBasePhaseTest#",orig);
|
| f_EPTF_LGenBase_PhaseList_Declarators_store(tsp_EPTF_LGenBase_PhaseList_Declarators);
|
| v_dummyInt := f_EPTF_LGenBase_addBurstCalcFunction("bubu",refers(f_EPTF_LGenBase_burstPreCalcOrig),refers(f_EPTF_LGenBase_burstPostCalcOrig));
|
| v_dummyInt := f_EPTF_LGenBase_declareBehaviorType("bhTest1", tsp_numEntities,
|
| null,
|
| null,
|
| null);
|
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("etBubu0", {"bhTest1"});
|
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({"eg0", "etBubu0", tsp_numEntities});
|
| /*v_dummyInt := f_EPTF_LGenBase_declareFunction("successGroupRegister",
|
| {
|
| customFinishFunction := refers(f_LGenBaseRegisterTest_groupRegisterFinishFunction_FT)
|
| });*/
|
| v_dummyInt := f_EPTF_LGenBase_declareCompactFsmTable(f_lGenBaseGetFsmRegister());
|
| v_dummyInt := f_EPTF_LGenBase_declareCompactFsmTable(f_lGenBaseGetFsmDoTraffic());
|
| v_dummyInt := f_EPTF_LGenBase_declareTrafficCaseType({
|
| name := "register",
|
| fsmName := "lGenRegFsm",
|
| entityType := "etBubu0",
|
| tcParams := {}
|
| });
|
| v_dummyInt := f_EPTF_LGenBase_declareTrafficCaseType({
|
| name := "doTraffic",
|
| fsmName := "lGenTrafficFsm",
|
| entityType := "etBubu0",
|
| tcParams := {}
|
| });
|
|
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3({
|
| name := "sc1",
|
| tcList := {
|
| {
|
| "register",
|
| {
|
| {target := {cpsToReach := 10.0}},
|
| {scheduler := { preDefinedName := orig }},
|
| {enableEntitiesAtStart := true},
|
| {enabledAtStart := true},
|
| {trafficStartFinish:={
|
| {availableEntitiesFinished := {{}}}
|
| }},
|
| {entityFinishConditions := {{nrOfSuccesses := 1}}},
|
| {entityFinishActions := {
|
| {
|
| enableEntity4Tc := {
|
| tcName := "doTraffic",
|
| aMode := available
|
| }
|
| }
|
| }
|
| }
|
| }
|
| },
|
| {
|
| "doTraffic",
|
| {
|
| {target := {cpsToReach := 10.0}},
|
| {scheduler := { preDefinedName := imst }},
|
| {trafficStartFinish :={
|
| {nrOfExecStart := {15, {}}}
|
| }}
|
| }
|
| }
|
| },
|
| scParamsList := {
|
| {enabled :=true},
|
| {phaseListName := "BasicPhases"},
|
| {phaseFinishConditions := {
|
| {
|
| phase := "preamble",
|
| conditions := {
|
| {tcFinished := "register"}
|
| }
|
| },
|
| {
|
| phase := "loadgen",
|
| conditions := {
|
| {tcFinished := "doTraffic"}
|
| }
|
| }
|
| }
|
| },
|
| {phaseStateChangeActions := {
|
| {
|
| phase := "preamble",
|
| state := RUNNING,
|
| actions := {
|
| {startTc := "register"}
|
| }
|
| },
|
| {
|
| phase := "loadgen",
|
| state := RUNNING,
|
| actions := {
|
| {startTc := "doTraffic"}
|
| }
|
| },
|
| {
|
| phase := "postamble",
|
| state := RUNNING,
|
| actions := {
|
| {stopScenario := ""}
|
| }
|
| }
|
| }
|
| }
|
| }
|
| });
|
|
|
| //log("v_LGenBase_PhaseListDeclaratorDB: ",v_LGenBase_PhaseListDeclaratorDB);
|
| //log("v_LGenBase_scenarioTypes: ",v_LGenBase_scenarioTypes);
|
| //log("v_LGenBase_entityGroups: ",v_LGenBase_entityGroups);
|
| //log("v_LGenBase_trafficCases: ",v_LGenBase_trafficCases);
|
| //f_EPTF_SchedulerComp_refreshSnapshotTime();
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0","sc1"});
|
|
|
| var integer vl_scIdx := f_EPTF_LGenBase_scenarioAbsIdxByName("eg0","sc1");
|
| var EPTF_LGenBase_TcMgmt_PhaseActionDescList pl_actions := {};
|
| var EPTF_LGenBase_PhaseCondition_InstanceList pl_conditions := {};
|
|
|
| if(not f_EPTF_LGenBase_getActualPhaseActions(vl_scIdx,pl_actions)){setverdict(fail) f_EPTF_Base_stop()}
|
| log("Actual phase actions: ",pl_actions);
|
| if(not f_EPTF_LGenBase_getPhaseActions(vl_scIdx,"loadgen",RUNNING,pl_actions)){setverdict(fail) f_EPTF_Base_stop()}
|
| log("Loadgen phase, RUNNING state, actions: ",pl_actions);
|
| if(not f_EPTF_LGenBase_getActualPhaseFinishConditions(vl_scIdx,pl_conditions)){setverdict(fail) f_EPTF_Base_stop()}
|
| log("Actual phase finish conditions: ",pl_conditions);
|
| if(not f_EPTF_LGenBase_getPhaseFinishConditions(vl_scIdx,"loadgen",pl_conditions)){setverdict(fail) f_EPTF_Base_stop()}
|
| log("Loadgen phase, finish conditions: ",pl_conditions)
|
|
|
|
|
| if(not f_EPTF_LGenBase_startPhase("eg0","sc1","preamble",refers( f_EPTF_LGenBase_Test_PhaseFinishedFn ))){setverdict(fail) f_EPTF_Base_stop()}
|
| //log("v_LGenBase_entityGroups: ",v_LGenBase_entityGroups);
|
| v_dummyBool := f_EPTF_LGenBase_wait4TestFinished()
|
| if(not f_EPTF_LGenBase_startPhase("eg0","sc1","loadgen",refers( f_EPTF_LGenBase_Test_PhaseFinishedFn ))){setverdict(fail) f_EPTF_Base_stop()}
|
| //log("v_LGenBase_entityGroups: ",v_LGenBase_entityGroups);
|
| v_dummyBool := f_EPTF_LGenBase_wait4TestFinished()
|
| var integer vl_tcRegIdx := f_EPTF_LGenBase_trafficCaseId("eg0", "sc1", "register");
|
| var integer vl_tcDoIdx := f_EPTF_LGenBase_trafficCaseId("eg0", "sc1", "doTraffic");
|
| if(f_EPTF_LGenBase_getTcSuccesses(vl_tcRegIdx) == tsp_numEntities and
|
| f_EPTF_LGenBase_getTcStarts(vl_tcDoIdx) > 0
|
| ){
|
| setverdict ( pass );
|
| }else{
|
| setverdict ( fail );
|
| //log("Registration tc: ",v_LGenBase_trafficCases[vl_tcRegIdx]);
|
| //log("Traffic started: ",v_LGenBase_trafficCases[vl_tcDoIdx].nrOfStarts);
|
| }
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
|
|
| function f_LGenBaseRegisterTest_groupRegisterFinishFunction_FT(in integer pl_idx)
|
| runs on EPTF_LGenBase_Test_CT{
|
| log("--- Traffic case ",f_EPTF_LGenBase_getTcUniqueNameByTcIdx(pl_idx)," has finished.")
|
| }
|
|
|
| function f_lGenBaseGetFsmRegister()
|
| runs on EPTF_LGenBase_Test_CT
|
| return EPTF_LGenBase_CompactFsmTable{
|
| const EPTF_LGenBase_CompactFsmTable c_lGenFsm := {
|
| name := "lGenRegFsm",
|
| // [0]
|
| stateList := {"idle", "busy"},
|
| timerList := {{"dummy", 0.1}},
|
| table := {
|
| {eventToListen := {c_EPTF_LGenBase_bIdx,c_EPTF_LGenBase_inputIdx_testMgmt_startTC,fsm},
|
| cellRow := {
|
| //state[0]==idle
|
| //{{{refers(f_LGenBaseRegister_register),{}}}, omit,omit}
|
| {{{refers(f_EPTF_LGenBase_step_timerStart),{0}}}, omit, 1},
|
| //state[1]==busy
|
| {{{refers(f_EPTF_LGenBaseRegister_InvalidEvent),{0}}}, omit, 1}
|
| }
|
| },
|
| {eventToListen := {c_EPTF_LGenBase_specialBIdx_timerTimeout,0,fsm},
|
| cellRow := {
|
| //state[0]==idle
|
| {omit , omit, omit},
|
| //state[1]==busy
|
| {{{refers(f_LGenBaseRegister_register),{}}}, omit,0}
|
| }
|
| }
|
| }
|
| }
|
| return c_lGenFsm;
|
| }
|
|
|
| function f_lGenBaseGetFsmDoTraffic()
|
| runs on EPTF_LGenBase_Test_CT
|
| return EPTF_LGenBase_CompactFsmTable{
|
| const EPTF_LGenBase_CompactFsmTable c_lGenFsm := {
|
| name := "lGenTrafficFsm",
|
| // [0]
|
| stateList := {"idle", "busy"},
|
| timerList := {},
|
| table := {
|
| {
|
| eventToListen := {c_EPTF_LGenBase_bIdx,c_EPTF_LGenBase_inputIdx_testMgmt_startTC,fsm},
|
| cellRow := {
|
| //state[0]==idle
|
| {{{refers(f_LGenBaseRegister_doTraffic),{}}}, omit,omit}
|
| }
|
| }
|
| }
|
| }
|
| return c_lGenFsm;
|
| }
|
|
|
| function f_LGenBaseRegister_register(in EPTF_LGenBase_TestStepArgs pl_ptr)
|
| runs on EPTF_LGenBase_Test_CT {
|
| var float vl_rnd := rnd();
|
| if(vl_rnd < 0.7){
|
| v_registerCounterSucc := v_registerCounterSucc + 1;
|
| log("--RegisterCounter- Entity#",pl_ptr.eIdx," has been succesfully registered. Successful registrations: ",v_registerCounterSucc);
|
| f_EPTF_LGenBase_step_trafficSuccess(pl_ptr)
|
| }else{
|
| v_registerCounterFail := v_registerCounterFail + 1;
|
| f_EPTF_LGenBase_step_trafficFailed(pl_ptr)
|
| log("--RegisterCounter- Registration of #",pl_ptr.eIdx," failed.");
|
| }
|
| }
|
|
|
| function f_EPTF_LGenBaseRegister_InvalidEvent(in EPTF_LGenBase_TestStepArgs pl_ptr)
|
| runs on EPTF_LGenBase_Test_CT {
|
| log("ERROR: ","An event has arrived in busy state!");
|
| f_EPTF_Base_stop();
|
| }
|
|
|
| function f_LGenBaseRegister_doTraffic(in EPTF_LGenBase_TestStepArgs pl_ptr)
|
| runs on EPTF_LGenBase_Test_CT {
|
| log("--- doTraffic#", pl_ptr.eIdx);
|
| // vl_trafficStarted := true;
|
| var float vl_rnd := rnd();
|
| if(vl_rnd < 0.5){
|
| f_EPTF_LGenBase_step_trafficSuccess(pl_ptr)
|
| }else{
|
| f_EPTF_LGenBase_step_trafficFailed(pl_ptr)
|
| }
|
| }
|
|
|
| template EPTF_LGenBase_FsmTableDeclarator t_table(in charstring pl_name):={
|
| name := pl_name,
|
| fsmParams := {
|
| {stateList := {"idle"}}
|
| },
|
| table := {
|
| classicTable := {
|
| {eventToListen := {"b1","input1",fsm},
|
| cellRow := {
|
| //state[0]==idle
|
| {{{"LGenBase: Traffic_success_reply_step",omit}}, omit, omit}
|
| }
|
| }
|
| }
|
| }
|
| }
|
|
|
| function f_EPTF_LGenBase_Test_weightedScStart(
|
| in boolean pl_startSc,
|
| in boolean pl_autoStart)
|
| runs on EPTF_LGenBase_VarAndStatTest_CT{
|
| f_EPTF_LGenBase_init("lGenBasePhaseTest", 0, "lGenBasePhaseTest#",orig);
|
| v_LGenBase_VarAndStatTest_behav := f_EPTF_LGenBase_declareBehaviorType("b1", -1, null, null, null);
|
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input1");
|
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("CS_Entity_Tc_A", {"b1"});
|
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("CS_Entity_LGen_A", {"b1"});
|
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({name := "eg0", eType := "CS_Entity_Tc_A", eCount := 100})
|
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({name := "eg1", eType := "CS_Entity_LGen_A", eCount := 5})
|
| v_dummyInt := f_EPTF_LGenBase_declareFunction("Finished",{customFinishFunction := refers(f_EPTF_LGenBase_TestFinished)});
|
| v_dummyInt := f_EPTF_LGenBase_PhaseList_store(
|
| {
|
| name := "ExecPhases",
|
| phases :=
|
| {
|
| { name := "preexec", enabled := true },
|
| { name := "loadgen" , enabled := true },
|
| { name := "postexec", enabled := true }
|
| }
|
| })
|
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable( {
|
| name := "EPTF_CS_FSM_Tc",
|
| fsmParams := {
|
| {stateList := {"idle"}},
|
| {varList := {{
|
| name := "var1ofFSM1",
|
| initValue := {intVal := 0},
|
| scope := FSM
|
| }
|
| }},
|
| {statisticList := {
|
| {"statMax",{{"var1ofFSM1"}},c_EPTF_StatHandler_Method_Max,{intVal := 0},TC},
|
| {"statMin",{{"var1ofFSM1"}},c_EPTF_StatHandler_Method_Min,{intVal := 0},TC}
|
| }}
|
| },
|
| table := {
|
| classicTable := {
|
| {eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
|
| cellRow := {
|
| //state[0]==idle
|
| {{
|
| {c_EPTF_LGenBase_stepName_fsmVarInc, {varParams := {"var1ofFSM1",{intVal := 1}}}},
|
| {c_EPTF_LGenBase_stepName_trafficSuccess, omit}
|
| }, omit, omit}
|
| }
|
| }
|
| }
|
| }
|
| }
|
| )
|
| v_dummyInt := f_EPTF_LGenBase_declareTcType2(
|
| { // TCs running in preexec phase
|
| name := "TC_A",
|
| fsmName := "EPTF_CS_FSM_Tc", // declared in EPTF CentralScheduling
|
| entityType := "CS_Entity_Tc_A", // CS_Entity_Tc in EPTF CentralScheduling, "_A" supplied as a suffix by the application
|
| customEntitySucc := ""
|
| }
|
| )
|
|
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
|
| {
|
| name := "Scenario_A",
|
| tcList := {
|
| {
|
| tcName := "TC_A0_Pre",
|
| tcParamsList := {
|
| {tcTypeName := "TC_A"},
|
| {target := { trafficWeight := 1.0 }},
|
| {enableEntitiesAtStart := true},
|
| {enabledAtStart := pl_startSc},
|
| {ranges := {
|
| {name := "public id", enableSplit := true, baseOffset := 0, count := 3},
|
| {name := "user id", enableSplit := false, baseOffset := 0, count := 1},
|
| {name := "subscriber id", enableSplit := false, baseOffset := 0, count := 3}
|
| }
|
| },
|
| {entityFinishConditions := {
|
| {nrOfSuccesses := 1}}
|
| },
|
| {trafficFinishedActions := {
|
| {enableTc := {"TC_A0",available}}
|
| }
|
| },
|
| {trafficStartFinish := {
|
| //{entitiesFinished := {actions := {}}},
|
| {nrOfRangeLoop := {count := 1, actions := {}}}
|
| }
|
| }
|
| }
|
| },
|
| {
|
| tcName := "TC_A0",
|
| tcParamsList := {
|
| {tcTypeName := "TC_A"},
|
| {target := { trafficWeight := 1.0 }},
|
| {enableEntitiesAtStart := true},
|
| //{enabledAtStart := false},
|
| {ranges := {
|
| {name := "public id", enableSplit := true, baseOffset := 0, count := 3},
|
| {name := "user id", enableSplit := false, baseOffset := 0, count := 1},
|
| {name := "subscriber id", enableSplit := false, baseOffset := 0, count := 3}
|
| }
|
| },
|
| {trafficFinishedActions := {
|
| {customFinishFunction := "Finished"}
|
| }
|
| },
|
| {trafficStartFinish := {
|
| {nrOfExecStart := {count := 20,actions := {}}}//,
|
| //{execTime := {time := 150.0,actions := {}}}
|
| }
|
| }
|
| }
|
| }
|
| },
|
| scParamsList := {
|
| {weightedScData := {cpsToReach := 40.0, lockCPS := false, deterministicMix := true, scheduler := omit}},
|
| {enabled := pl_autoStart}
|
| }
|
| }
|
| )
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0", "Scenario_A"}, pl_autoStart)
|
| if(not pl_autoStart){
|
| f_EPTF_LGenBase_enableScenarioOnEntityGroup(0, 0, pl_startSc)
|
| }
|
| if(not pl_startSc){
|
| f_EPTF_LGenBase_startLaunchWeightedScenario(0, 0)
|
| f_EPTF_LGenBase_startTrafficCase("eg0", "Scenario_A", "TC_A0_Pre")
|
| }
|
| if(f_EPTF_LGenBase_wait4TestFinished()){
|
| if(c_EPTF_LGenBase_tcStateTerminated != f_EPTF_LGenBase_getTcState(0)){
|
| if (tsp_EPTF_LGenBaseDebugTraffic) {
|
| log("DEBUG: ","State of tc ",f_EPTF_LGenBase_getTcUniqueNameByTcIdx(0),": ",c_EPTF_LGenBase_stateNames[f_EPTF_LGenBase_getTcState(0)]);
|
| }
|
| setverdict(fail)
|
| }
|
| if(c_EPTF_LGenBase_tcStateTerminated != f_EPTF_LGenBase_getTcState(1)){
|
| if (tsp_EPTF_LGenBaseDebugTraffic) {
|
| log("DEBUG: ","State of tc ",f_EPTF_LGenBase_getTcUniqueNameByTcIdx(1),": ",c_EPTF_LGenBase_stateNames[f_EPTF_LGenBase_getTcState(1)]);
|
| }
|
| setverdict(fail)
|
| }else{
|
| setverdict(pass)
|
| }
|
| }
|
| f_EPTF_Base_cleanup_CT()
|
| }
|
| testcase tc_EPTF_LGenBase_Test_weightedScStart() runs on EPTF_LGenBase_VarAndStatTest_CT{
|
| f_EPTF_LGenBase_Test_weightedScStart(true, false)
|
| }
|
| testcase tc_EPTF_LGenBase_Test_weightedScStartTC() runs on EPTF_LGenBase_VarAndStatTest_CT{
|
| f_EPTF_LGenBase_Test_weightedScStart(false, false)
|
| }
|
|
|
| testcase tc_EPTF_LGenBase_Test_weightedScStartAuto() runs on EPTF_LGenBase_VarAndStatTest_CT{
|
| f_EPTF_LGenBase_Test_weightedScStart(false, true)
|
| }
|
|
|
| group actionsPerCondition{
|
|
|
| type component EPTF_LGenBase_ActionsPerCondition_CT extends EPTF_LGenBase_Test_CT, EPTF_LGenBaseStats_CT{
|
| var integer v_LGenBase_ActionsPerCondition_behav := -1;
|
| var integer v_LGenBase_ActionsPerCondition_actionCalled := 0
|
| }
|
|
|
| function f_EPTF_LGenBase_actionsPerConditionMustBeCalled(in integer pl_idx)
|
| runs on EPTF_LGenBase_ActionsPerCondition_CT{
|
| log(%definitionId&" function called.")
|
| setverdict(pass)
|
| v_LGenBase_ActionsPerCondition_actionCalled := v_LGenBase_ActionsPerCondition_actionCalled + 1
|
| }
|
|
|
| function f_EPTF_LGenBase_actionsPerConditionMustNotBeCalled(in integer pl_idx)
|
| runs on EPTF_LGenBase_Test_CT{
|
| log(%definitionId&" function called.")
|
| setverdict(fail)
|
| }
|
|
|
| function f_EPTF_LGenBase_actionsPerConditionCustomFinishConditionFalse(in integer pl_tcIdx,in integer pl_eIdx)
|
| runs on EPTF_LGenBase_Test_CT
|
| return boolean{
|
| log(%definitionId&" function called.")
|
| return false
|
| }
|
|
|
| function f_EPTF_LGenBase_actionsPerConditionCustomFinishConditionTrue(in integer pl_tcIdx,in integer pl_eIdx)
|
| runs on EPTF_LGenBase_Test_CT
|
| return boolean{
|
| log(%definitionId&" function called.")
|
| return true
|
| }
|
|
|
| const EPTF_LGenBase_ScenarioTypeDeclarator c_EPTF_LGenBase_Test_actionsPerConditionInitScenario :=
|
| {
|
| name := "Scenario_A",
|
| tcList := {
|
| {
|
| tcName := "TC_A0",
|
| tcParamsList := {
|
| {trafficStartFinish := {//Note: this must be the first param because of the test code
|
| //Note: If you add new conditions, appen them to the end
|
| /*0*/ {nrOfExecStart := {count := 200,actions := {{customFinishFunction := "MustNotBeCalled"}}}},
|
| /*1*/ {nrOfSuccesses := {count := 200,actions := {{customFinishFunction := "MustNotBeCalled"}}}},
|
| /*2*/ {nrOfFails := {count := 200,actions := {{customFinishFunction := "MustNotBeCalled"}}}},
|
| /*3*/ {nrOfRangeLoop := {count := 200,actions := {{customFinishFunction := "MustNotBeCalled"}}}},
|
| /*4*/ {entitiesFinished := {actions := {{customFinishFunction := "MustNotBeCalled"}}}},
|
| /*5*/ {customFinish := {functionName := "ConditionFalse", actions := {{customFinishFunction := "MustNotBeCalled"}}}},
|
| /*6*/ {execTime := {time := 150.0,actions := {{customFinishFunction := "MustNotBeCalled"}}}},
|
| /*7*/ {anythingFinished := {{{customFinishFunction := "MustBeCalled"}}}},
|
| /*8*/ {nrOfErrors := {count := 200,actions := {{customFinishFunction := "MustNotBeCalled"}}}},
|
| /*9*/ {nrOfTimeouts := {count := 200,actions := {{customFinishFunction := "MustNotBeCalled"}}}},
|
| /*10*/ {availableEntitiesFinished := {actions := {{customFinishFunction := "MustNotBeCalled"}}}}
|
| }
|
| },
|
| {tcTypeName := "TC_Succ"},//Note: this must be the second parameter in the test
|
| {target := {cpsToReach := 10.0}},
|
| {enableEntitiesAtStart := true},
|
| {enabledAtStart := true},
|
| {trafficFinishedActions := {
|
| {customFinishFunction := "Finished"}
|
| }
|
| },
|
| {ranges := {
|
| {name := "public id", enableSplit := true, baseOffset := 0, count := 3},
|
| {name := "user id", enableSplit := false, baseOffset := 0, count := 2}
|
| }
|
| }
|
| }
|
| }
|
| },
|
| scParamsList := {
|
| //{enabled := false}
|
| }
|
| }
|
|
|
|
|
| template EPTF_LGenBase_FsmTableDeclarator t_EPTF_LGenBase_Test_simpleResponse(
|
| in charstring pl_fsmName,
|
| in charstring pl_respStep) := {
|
| name := pl_fsmName,
|
| fsmParams := {
|
| {stateList := {"idle"}}
|
| },
|
| table := {
|
| classicTable := {
|
| {eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
|
| cellRow := {
|
| {{
|
| {pl_respStep, omit}
|
| }, omit, omit}
|
| }
|
| }
|
| }
|
| }
|
| }
|
|
|
| template EPTF_LGenBase_FsmTableDeclarator t_EPTF_LGenBase_Test_delayedResponse(
|
| in charstring pl_fsmName,
|
| in charstring pl_respStep,
|
| in float pl_delay := 0.2) := {
|
| name := pl_fsmName,
|
| fsmParams := {
|
| {stateList := {"idle", "busy"}},
|
| {timerList := {{"timer",pl_delay}}}
|
| },
|
| table := {
|
| classicTable := {
|
| {eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
|
| cellRow := {
|
| {{{c_EPTF_LGenBase_stepName_timerStart, {timerName := "timer"}}}, omit, "busy"},
|
| {omit, omit, omit}
|
| }
|
| },
|
| {eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_stopTC,fsm},
|
| cellRow := {
|
| {{{c_EPTF_LGenBase_stepName_entityStopped, omit}}, omit, omit},
|
| {{
|
| {c_EPTF_LGenBase_stepName_timerCancel, {timerName := "timer"}},
|
| {c_EPTF_LGenBase_stepName_entityStopped, omit},
|
| {pl_respStep, omit}
|
| }, omit, "idle"}
|
| }
|
| },
|
| {eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_abortTC,fsm},
|
| cellRow := {
|
| {{{c_EPTF_LGenBase_stepName_entityAborted, omit}}, omit, omit},
|
| {{
|
| {c_EPTF_LGenBase_stepName_timerCancel, {timerName := "timer"}},
|
| {c_EPTF_LGenBase_stepName_entityAborted, omit},
|
| {pl_respStep, omit}
|
| }, omit, "idle"}
|
| }
|
| },
|
| {eventToListen := {c_EPTF_LGenBase_specialBName_timerTimeout,"timer",fsm},
|
| cellRow := {
|
| {omit, omit, omit},
|
| {{{pl_respStep, omit}}, omit, "idle"}
|
| }
|
| }
|
| }
|
| }
|
| }
|
|
|
| const charstring c_EPTF_LGenBase_Test_fsmNameSimpleResponseSucc := "EPTF_FSM_Tc_Succ"
|
| const charstring c_EPTF_LGenBase_Test_fsmNameSimpleResponseFail := "EPTF_FSM_Tc_Fail"
|
| const charstring c_EPTF_LGenBase_Test_fsmNameSimpleResponseError := "EPTF_FSM_Tc_Error"
|
| const charstring c_EPTF_LGenBase_Test_fsmNameSimpleResponseTimeout := "EPTF_FSM_Tc_Timeout"
|
|
|
| function f_EPTF_LGenBase_actionsPerConditionInit(in integer pl_eCount := 100)
|
| runs on EPTF_LGenBase_ActionsPerCondition_CT{
|
| f_EPTF_LGenBaseStats_init("actionsPerCondition", "actionsPerCondition#");
|
| v_LGenBase_ActionsPerCondition_behav := f_EPTF_LGenBase_declareBehaviorType("b1", -1, null, null, null);
|
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input1");
|
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("Entity_Tc_A", {"b1"});
|
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({name := "eg0", eType := "Entity_Tc_A", eCount := pl_eCount})
|
| v_dummyInt := f_EPTF_LGenBase_declareFunction("Finished",{customFinishFunction := refers(f_EPTF_LGenBase_TestFinished)});
|
| v_dummyInt := f_EPTF_LGenBase_declareFunction("ConditionFalse",{customFinishCondition := refers(f_EPTF_LGenBase_actionsPerConditionCustomFinishConditionFalse)});
|
| v_dummyInt := f_EPTF_LGenBase_declareFunction("ConditionTrue",{customFinishCondition := refers(f_EPTF_LGenBase_actionsPerConditionCustomFinishConditionTrue)});
|
| v_dummyInt := f_EPTF_LGenBase_declareFunction("MustBeCalled",{customFinishFunction := refers(f_EPTF_LGenBase_actionsPerConditionMustBeCalled)});
|
| v_dummyInt := f_EPTF_LGenBase_declareFunction("MustNotBeCalled",{customFinishFunction := refers(f_EPTF_LGenBase_actionsPerConditionMustNotBeCalled)});
|
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable(
|
| valueof(t_EPTF_LGenBase_Test_simpleResponse(
|
| c_EPTF_LGenBase_Test_fsmNameSimpleResponseSucc,
|
| c_EPTF_LGenBase_stepName_trafficSuccess)))
|
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable(
|
| valueof(t_EPTF_LGenBase_Test_simpleResponse(
|
| c_EPTF_LGenBase_Test_fsmNameSimpleResponseFail,
|
| c_EPTF_LGenBase_stepName_trafficFailed)))
|
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable(
|
| valueof(t_EPTF_LGenBase_Test_simpleResponse(
|
| c_EPTF_LGenBase_Test_fsmNameSimpleResponseError,
|
| c_EPTF_LGenBase_stepName_trafficError)))
|
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable(
|
| valueof(t_EPTF_LGenBase_Test_simpleResponse(
|
| c_EPTF_LGenBase_Test_fsmNameSimpleResponseTimeout,
|
| c_EPTF_LGenBase_stepName_trafficTimeout)))
|
| v_dummyInt := f_EPTF_LGenBase_declareTcType2({
|
| name := "TC_Succ",
|
| fsmName := c_EPTF_LGenBase_Test_fsmNameSimpleResponseSucc,
|
| entityType := "Entity_Tc_A",
|
| customEntitySucc := ""
|
| })
|
| v_dummyInt := f_EPTF_LGenBase_declareTcType2({
|
| name := "TC_Fail",
|
| fsmName := c_EPTF_LGenBase_Test_fsmNameSimpleResponseFail,
|
| entityType := "Entity_Tc_A",
|
| customEntitySucc := ""
|
| })
|
| v_dummyInt := f_EPTF_LGenBase_declareTcType2({
|
| name := "TC_Error",
|
| fsmName := c_EPTF_LGenBase_Test_fsmNameSimpleResponseError,
|
| entityType := "Entity_Tc_A",
|
| customEntitySucc := ""
|
| })
|
| v_dummyInt := f_EPTF_LGenBase_declareTcType2({
|
| name := "TC_Timeout",
|
| fsmName := c_EPTF_LGenBase_Test_fsmNameSimpleResponseTimeout,
|
| entityType := "Entity_Tc_A",
|
| customEntitySucc := ""
|
| })
|
| }
|
|
|
| testcase tc_EPTF_LGenBase_Test_actionsPerConditionExecStart()
|
| runs on EPTF_LGenBase_ActionsPerCondition_CT{
|
| f_EPTF_LGenBase_actionsPerConditionInit()
|
| //Test execTime
|
| var EPTF_LGenBase_ScenarioTypeDeclarator vl_sc := c_EPTF_LGenBase_Test_actionsPerConditionInitScenario
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList)
|
| setverdict(inconc)
|
| f_EPTF_Base_cleanup_CT(); stop;
|
| }
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[0].nrOfExecStart)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[0])
|
| setverdict(inconc)
|
| f_EPTF_Base_cleanup_CT(); stop;
|
| }
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[0].nrOfExecStart.count := 20
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[0].nrOfExecStart.actions[0].customFinishFunction := "MustBeCalled"
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(vl_sc)
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0", "Scenario_A"}, true)
|
| if(f_EPTF_LGenBase_wait4TestFinished()){
|
| if(2 != v_LGenBase_ActionsPerCondition_actionCalled){
|
| log(match(2, v_LGenBase_ActionsPerCondition_actionCalled))
|
| setverdict(fail)
|
| }else{
|
| setverdict(pass)
|
| }
|
| }
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
|
|
| testcase tc_EPTF_LGenBase_Test_actionsPerConditionNrOfSuccesses()
|
| runs on EPTF_LGenBase_ActionsPerCondition_CT{
|
| f_EPTF_LGenBase_actionsPerConditionInit()
|
| //Test Successes
|
| var EPTF_LGenBase_ScenarioTypeDeclarator vl_sc := c_EPTF_LGenBase_Test_actionsPerConditionInitScenario
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList)
|
| setverdict(inconc)
|
| f_EPTF_Base_cleanup_CT(); stop;
|
| }
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[1].nrOfSuccesses)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[1])
|
| setverdict(inconc)
|
| f_EPTF_Base_cleanup_CT(); stop;
|
| }
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[1].nrOfSuccesses.count := 20
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[1].nrOfSuccesses.actions[0].customFinishFunction := "MustBeCalled"
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(vl_sc)
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0", "Scenario_A"}, true)
|
| if(f_EPTF_LGenBase_wait4TestFinished()){
|
| if(2 != v_LGenBase_ActionsPerCondition_actionCalled){
|
| log(match(2, v_LGenBase_ActionsPerCondition_actionCalled))
|
| setverdict(fail)
|
| }else{
|
| setverdict(pass)
|
| }
|
| }
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
|
|
| testcase tc_EPTF_LGenBase_Test_actionsPerConditionNrOfFails()
|
| runs on EPTF_LGenBase_ActionsPerCondition_CT{
|
| f_EPTF_LGenBase_actionsPerConditionInit()
|
| //Test Successes
|
| var EPTF_LGenBase_ScenarioTypeDeclarator vl_sc := c_EPTF_LGenBase_Test_actionsPerConditionInitScenario
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList)
|
| setverdict(inconc)
|
| f_EPTF_Base_cleanup_CT(); stop;
|
| }
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[2].nrOfFails)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[2])
|
| setverdict(inconc)
|
| f_EPTF_Base_cleanup_CT(); stop;
|
| }
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[1].tcTypeName)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList)
|
| setverdict(inconc)
|
| f_EPTF_Base_cleanup_CT(); stop;
|
| }
|
| vl_sc.tcList[0].tcParamsList[1].tcTypeName := "TC_Fail"
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[2].nrOfFails.count := 20
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[2].nrOfFails.actions[0].customFinishFunction := "MustBeCalled"
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(vl_sc)
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0", "Scenario_A"}, true)
|
| if(f_EPTF_LGenBase_wait4TestFinished()){
|
| if(2 != v_LGenBase_ActionsPerCondition_actionCalled){
|
| log(match(2, v_LGenBase_ActionsPerCondition_actionCalled))
|
| setverdict(fail)
|
| }else{
|
| setverdict(pass)
|
| }
|
| }
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
|
|
| testcase tc_EPTF_LGenBase_Test_actionsPerConditionNrOfErrors()
|
| runs on EPTF_LGenBase_ActionsPerCondition_CT{
|
| f_EPTF_LGenBase_actionsPerConditionInit()
|
| //Test Successes
|
| var EPTF_LGenBase_ScenarioTypeDeclarator vl_sc := c_EPTF_LGenBase_Test_actionsPerConditionInitScenario
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList)
|
| setverdict(inconc)
|
| f_EPTF_Base_cleanup_CT(); stop;
|
| }
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[8].nrOfErrors)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[8])
|
| setverdict(inconc)
|
| f_EPTF_Base_cleanup_CT(); stop;
|
| }
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[8].nrOfErrors.count := 20
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[8].nrOfErrors.actions:={{customFinishFunction := "MustBeCalled"}}
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[1].tcTypeName)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList)
|
| setverdict(inconc)
|
| f_EPTF_Base_cleanup_CT(); stop;
|
| }
|
| vl_sc.tcList[0].tcParamsList[1].tcTypeName := "TC_Error"
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(vl_sc)
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0", "Scenario_A"}, true)
|
| if(f_EPTF_LGenBase_wait4TestFinished()){
|
| if(2 != v_LGenBase_ActionsPerCondition_actionCalled){
|
| log(match(2, v_LGenBase_ActionsPerCondition_actionCalled))
|
| setverdict(fail)
|
| }else{
|
| setverdict(pass)
|
| }
|
| }
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
|
|
| testcase tc_EPTF_LGenBase_Test_actionsPerConditionNrOfTimeouts()
|
| runs on EPTF_LGenBase_ActionsPerCondition_CT{
|
| f_EPTF_LGenBase_actionsPerConditionInit()
|
| //Test Successes
|
| var EPTF_LGenBase_ScenarioTypeDeclarator vl_sc := c_EPTF_LGenBase_Test_actionsPerConditionInitScenario
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList)
|
| setverdict(inconc)
|
| f_EPTF_Base_cleanup_CT(); stop;
|
| }
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[9].nrOfTimeouts)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[9])
|
| setverdict(inconc)
|
| f_EPTF_Base_cleanup_CT(); stop;
|
| }
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[9].nrOfTimeouts.count := 20
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[9].nrOfTimeouts.actions:={{customFinishFunction := "MustBeCalled"}}
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[1].tcTypeName)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList)
|
| setverdict(inconc)
|
| f_EPTF_Base_cleanup_CT(); stop;
|
| }
|
| vl_sc.tcList[0].tcParamsList[1].tcTypeName := "TC_Timeout"
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(vl_sc)
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0", "Scenario_A"}, true)
|
| if(f_EPTF_LGenBase_wait4TestFinished()){
|
| if(2 != v_LGenBase_ActionsPerCondition_actionCalled){
|
| log(match(2, v_LGenBase_ActionsPerCondition_actionCalled))
|
| setverdict(fail)
|
| }else{
|
| setverdict(pass)
|
| }
|
| }
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
|
|
| testcase tc_EPTF_LGenBase_Test_actionsPerConditionNrOfRangeLoop()
|
| runs on EPTF_LGenBase_ActionsPerCondition_CT{
|
| f_EPTF_LGenBase_actionsPerConditionInit()
|
| //Test Successes
|
| var EPTF_LGenBase_ScenarioTypeDeclarator vl_sc := c_EPTF_LGenBase_Test_actionsPerConditionInitScenario
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList)
|
| setverdict(inconc)
|
| f_EPTF_Base_cleanup_CT(); stop;
|
| }
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[3].nrOfRangeLoop)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[3])
|
| setverdict(inconc)
|
| f_EPTF_Base_cleanup_CT(); stop;
|
| }
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[3].nrOfRangeLoop.count := 20
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[3].nrOfRangeLoop.actions[0].customFinishFunction := "MustBeCalled"
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(vl_sc)
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0", "Scenario_A"}, true)
|
| if(f_EPTF_LGenBase_wait4TestFinished()){
|
| if(2 != v_LGenBase_ActionsPerCondition_actionCalled){
|
| log(match(2, v_LGenBase_ActionsPerCondition_actionCalled))
|
| setverdict(fail)
|
| }else{
|
| setverdict(pass)
|
| }
|
| }
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
|
|
| testcase tc_EPTF_LGenBase_Test_actionsPerConditionEntitiesFinishedNofError()
|
| runs on EPTF_LGenBase_ActionsPerCondition_CT{
|
| const integer c_eCount := 5;
|
| f_EPTF_LGenBase_actionsPerConditionInit(c_eCount)
|
| //Test Successes
|
| var EPTF_LGenBase_ScenarioTypeDeclarator vl_sc := c_EPTF_LGenBase_Test_actionsPerConditionInitScenario
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList)
|
| setverdict(inconc)
|
| f_EPTF_Base_cleanup_CT(); stop;
|
| }
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[4].entitiesFinished)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[4])
|
| setverdict(inconc)
|
| f_EPTF_Base_cleanup_CT(); stop;
|
| }
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[4].entitiesFinished.actions:={{customFinishFunction := "MustBeCalled"}}
|
|
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[10].availableEntitiesFinished)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[10])
|
| setverdict(inconc)
|
| f_EPTF_Base_cleanup_CT(); stop;
|
| }
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[10].availableEntitiesFinished.actions[0].customFinishFunction := "MustBeCalled"
|
|
|
| const integer c_nofErrors := 2
|
| vl_sc.tcList[0].tcParamsList[sizeof(vl_sc.tcList[0].tcParamsList)] := {
|
| entityFinishConditions := {{nrOfErrors := c_nofErrors}}
|
| }
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[1].tcTypeName)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList)
|
| setverdict(inconc)
|
| f_EPTF_Base_cleanup_CT(); stop;
|
| }
|
| vl_sc.tcList[0].tcParamsList[1].tcTypeName := "TC_Error"
|
|
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(vl_sc)
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0", "Scenario_A"}, true)
|
| if(f_EPTF_LGenBase_wait4TestFinished()){
|
| if(3 != v_LGenBase_ActionsPerCondition_actionCalled){
|
| log(match(3, v_LGenBase_ActionsPerCondition_actionCalled))
|
| setverdict(fail)
|
| }else{
|
| setverdict(pass)
|
| }
|
| var charstring vl_varNamePrefix := f_EPTF_LGenBase_getNamePrefix("eg0", "Scenario_A", "TC_A0")
|
| var integer vl_startCountRef := f_EPTF_Var_getId(vl_varNamePrefix&c_EPTF_LGenBaseStats_nameOfTcNrOfStarts);
|
| if(-1 != vl_startCountRef){
|
| }else{
|
| log("Variable "&vl_varNamePrefix&c_EPTF_LGenBaseStats_nameOfTcNrOfStarts&" not found.")
|
| setverdict(fail)
|
| }
|
| var integer vl_errorCountRef := f_EPTF_Var_getId(vl_varNamePrefix&c_EPTF_LGenBaseStats_nameOfTcNrOfErrors);
|
| if(-1 != vl_errorCountRef){
|
| }else{
|
| log("Variable "&vl_varNamePrefix&c_EPTF_LGenBaseStats_nameOfTcNrOfErrors&" not found.")
|
| setverdict(fail)
|
| }
|
| var EPTF_Var_DirectContent vl_content
|
| f_EPTF_Var_getContent(vl_errorCountRef, vl_content)
|
| if(c_nofErrors*c_eCount == vl_content.intVal){
|
| setverdict(pass)
|
| }else{
|
| log(match(c_nofErrors*c_eCount , vl_content.intVal))
|
| setverdict(fail)
|
| }
|
| f_EPTF_Var_getContent(vl_startCountRef, vl_content)
|
| if(c_nofErrors*c_eCount == vl_content.intVal){
|
| setverdict(pass)
|
| }else{
|
| log(match(c_nofErrors*c_eCount , vl_content.intVal))
|
| setverdict(fail)
|
| }
|
| }
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
|
|
| testcase tc_EPTF_LGenBase_Test_actionsPerConditionEntitiesFinishedTimeout()
|
| runs on EPTF_LGenBase_ActionsPerCondition_CT{
|
| const integer c_eCount := 5;
|
| f_EPTF_LGenBase_actionsPerConditionInit(c_eCount)
|
| //Test Successes
|
| var EPTF_LGenBase_ScenarioTypeDeclarator vl_sc := c_EPTF_LGenBase_Test_actionsPerConditionInitScenario
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList)
|
| setverdict(inconc)
|
| f_EPTF_Base_cleanup_CT(); stop;
|
| }
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[4].entitiesFinished)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[4])
|
| setverdict(inconc)
|
| f_EPTF_Base_cleanup_CT(); stop;
|
| }
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[4].entitiesFinished.actions[0].customFinishFunction := "MustBeCalled"
|
|
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[10].availableEntitiesFinished)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[10])
|
| setverdict(inconc)
|
| f_EPTF_Base_cleanup_CT(); stop;
|
| }
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[10].availableEntitiesFinished.actions[0].customFinishFunction := "MustBeCalled"
|
|
|
| const integer c_nofTimeouts := 2
|
| vl_sc.tcList[0].tcParamsList[sizeof(vl_sc.tcList[0].tcParamsList)] := {
|
| entityFinishConditions := {{nrOfTimeouts := c_nofTimeouts}}
|
| }
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[1].tcTypeName)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList)
|
| setverdict(inconc)
|
| f_EPTF_Base_cleanup_CT(); stop;
|
| }
|
| vl_sc.tcList[0].tcParamsList[1].tcTypeName := "TC_Timeout"
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(vl_sc)
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0", "Scenario_A"}, true)
|
| if(f_EPTF_LGenBase_wait4TestFinished()){
|
| if(3 != v_LGenBase_ActionsPerCondition_actionCalled){
|
| log(match(3, v_LGenBase_ActionsPerCondition_actionCalled))
|
| setverdict(fail)
|
| }else{
|
| setverdict(pass)
|
| }
|
| var charstring vl_varNamePrefix := f_EPTF_LGenBase_getNamePrefix("eg0", "Scenario_A", "TC_A0")
|
| var integer vl_startCountRef := f_EPTF_Var_getId(vl_varNamePrefix&c_EPTF_LGenBaseStats_nameOfTcNrOfStarts);
|
| if(-1 != vl_startCountRef){
|
| }else{
|
| log("Variable "&vl_varNamePrefix&c_EPTF_LGenBaseStats_nameOfTcNrOfStarts&" not found.")
|
| setverdict(fail)
|
| }
|
| var integer vl_TimeoutCountRef := f_EPTF_Var_getId(vl_varNamePrefix&c_EPTF_LGenBaseStats_nameOfTcNrOfTimeouts);
|
| if(-1 != vl_TimeoutCountRef){
|
| }else{
|
| log("Variable "&vl_varNamePrefix&c_EPTF_LGenBaseStats_nameOfTcNrOfTimeouts&" not found.")
|
| setverdict(fail)
|
| }
|
| var EPTF_Var_DirectContent vl_content
|
| f_EPTF_Var_getContent(vl_TimeoutCountRef, vl_content)
|
| if(c_nofTimeouts*c_eCount == vl_content.intVal){
|
| setverdict(pass)
|
| }else{
|
| log(match(c_nofTimeouts*c_eCount , vl_content.intVal))
|
| setverdict(fail)
|
| }
|
| f_EPTF_Var_getContent(vl_startCountRef, vl_content)
|
| if(c_nofTimeouts*c_eCount == vl_content.intVal){
|
| setverdict(pass)
|
| }else{
|
| log(match(c_nofTimeouts*c_eCount , vl_content.intVal))
|
| setverdict(fail)
|
| }
|
| }
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
|
|
| testcase tc_EPTF_LGenBase_Test_actionsPerConditionEntitiesFinished()
|
| runs on EPTF_LGenBase_ActionsPerCondition_CT{
|
| f_EPTF_LGenBase_actionsPerConditionInit()
|
| //Test Successes
|
| var EPTF_LGenBase_ScenarioTypeDeclarator vl_sc := c_EPTF_LGenBase_Test_actionsPerConditionInitScenario
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList)
|
| setverdict(inconc)
|
| f_EPTF_Base_cleanup_CT(); stop;
|
| }
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[4].entitiesFinished)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[4])
|
| setverdict(inconc)
|
| f_EPTF_Base_cleanup_CT(); stop;
|
| }
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[4].entitiesFinished.actions[0].customFinishFunction := "MustBeCalled"
|
|
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[10].availableEntitiesFinished)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[10])
|
| setverdict(inconc)
|
| f_EPTF_Base_cleanup_CT(); stop;
|
| }
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[10].availableEntitiesFinished.actions[0].customFinishFunction := "MustBeCalled"
|
|
|
| vl_sc.tcList[0].tcParamsList[sizeof(vl_sc.tcList[0].tcParamsList)] := {
|
| entityFinishConditions := {{nrOfExecStart := 1}}
|
| }
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(vl_sc)
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0", "Scenario_A"}, true)
|
| if(f_EPTF_LGenBase_wait4TestFinished()){
|
| if(3 != v_LGenBase_ActionsPerCondition_actionCalled){
|
| log(match(3, v_LGenBase_ActionsPerCondition_actionCalled))
|
| setverdict(fail)
|
| }else{
|
| setverdict(pass)
|
| }
|
| }
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
|
|
| testcase tc_EPTF_LGenBase_Test_actionsPerConditionAvailableEntitiesFinished()
|
| runs on EPTF_LGenBase_ActionsPerCondition_CT{
|
| const integer c_eCount := 50
|
| const integer c_eDisable := 20
|
| f_EPTF_LGenBase_actionsPerConditionInit(c_eCount)
|
| //Test Successes
|
| var EPTF_LGenBase_ScenarioTypeDeclarator vl_sc := c_EPTF_LGenBase_Test_actionsPerConditionInitScenario
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList)
|
| setverdict(inconc)
|
| f_EPTF_Base_cleanup_CT(); stop;
|
| }
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[10].availableEntitiesFinished)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[10])
|
| setverdict(inconc)
|
| f_EPTF_Base_cleanup_CT(); stop;
|
| }
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[10].availableEntitiesFinished.actions:={{customFinishFunction := "MustBeCalled"}}
|
|
|
| vl_sc.tcList[0].tcParamsList[sizeof(vl_sc.tcList[0].tcParamsList)] := {
|
| entityFinishConditions := {{nrOfExecStart := 1}}
|
| }
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(vl_sc)
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0", "Scenario_A"}, false)
|
| for ( var integer vl_i := 0; vl_i < c_eDisable ; vl_i := vl_i+1 ){
|
| f_EPTF_LGenBase_disableEntityInTrafficCase(0, vl_i*2)
|
| }
|
| f_EPTF_LGenBase_enableScenarioOnEntityGroup(0, 0, true)
|
| if(f_EPTF_LGenBase_wait4TestFinished()){
|
| if(2 != v_LGenBase_ActionsPerCondition_actionCalled){
|
| log(match(2, v_LGenBase_ActionsPerCondition_actionCalled))
|
| setverdict(fail)
|
| }else{
|
| setverdict(pass)
|
| }
|
| var charstring vl_varNamePrefix := f_EPTF_LGenBase_getNamePrefix("eg0", "Scenario_A", "TC_A0")
|
| var integer vl_startCountRef := f_EPTF_Var_getId(vl_varNamePrefix&c_EPTF_LGenBaseStats_nameOfTcNrOfStarts);
|
| if(-1 != vl_startCountRef){
|
| }else{
|
| log("Variable "&vl_varNamePrefix&c_EPTF_LGenBaseStats_nameOfTcNrOfStarts&" not found.")
|
| setverdict(fail)
|
| }
|
| var EPTF_Var_DirectContent vl_content
|
| f_EPTF_Var_getContent(vl_startCountRef, vl_content)
|
| if(c_eCount-c_eDisable == vl_content.intVal){
|
| setverdict(pass)
|
| }else{
|
| log(match(c_eCount-c_eDisable , vl_content.intVal))
|
| setverdict(fail)
|
| }
|
| }
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
|
|
|
|
| testcase tc_EPTF_LGenBase_Test_actionsPerConditionCustomFinish()
|
| runs on EPTF_LGenBase_ActionsPerCondition_CT{
|
| f_EPTF_LGenBase_actionsPerConditionInit()
|
| //Test Successes
|
| var EPTF_LGenBase_ScenarioTypeDeclarator vl_sc := c_EPTF_LGenBase_Test_actionsPerConditionInitScenario
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList)
|
| setverdict(inconc)
|
| f_EPTF_Base_cleanup_CT(); stop;
|
| }
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[5].customFinish)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[5])
|
| setverdict(inconc)
|
| f_EPTF_Base_cleanup_CT(); stop;
|
| }
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[5].customFinish.functionName := "ConditionTrue"
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[5].customFinish.actions[0].customFinishFunction := "MustBeCalled"
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(vl_sc)
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0", "Scenario_A"}, true)
|
| if(f_EPTF_LGenBase_wait4TestFinished()){
|
| if(2 != v_LGenBase_ActionsPerCondition_actionCalled){
|
| log(match(2, v_LGenBase_ActionsPerCondition_actionCalled))
|
| setverdict(fail)
|
| }else{
|
| setverdict(pass)
|
| }
|
| }
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
| testcase tc_EPTF_LGenBase_Test_actionsPerConditionExecTime() runs on EPTF_LGenBase_ActionsPerCondition_CT{
|
| f_EPTF_LGenBase_actionsPerConditionInit()
|
| //Test Successes
|
| var EPTF_LGenBase_ScenarioTypeDeclarator vl_sc := c_EPTF_LGenBase_Test_actionsPerConditionInitScenario
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList)
|
| setverdict(inconc)
|
| f_EPTF_Base_cleanup_CT(); stop;
|
| }
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[6].execTime)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[6])
|
| setverdict(inconc)
|
| f_EPTF_Base_cleanup_CT(); stop;
|
| }
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[6].execTime.time := 2.0
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[6].execTime.actions[0].customFinishFunction := "MustBeCalled"
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(vl_sc)
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0", "Scenario_A"}, true)
|
| if(f_EPTF_LGenBase_wait4TestFinished()){
|
| if(2 != v_LGenBase_ActionsPerCondition_actionCalled){
|
| log(match(2, v_LGenBase_ActionsPerCondition_actionCalled))
|
| setverdict(fail)
|
| }else{
|
| setverdict(pass)
|
| }
|
| }
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
|
|
| //This test tests if the execTimer is cancelled after the group is finished with other condition.
|
| testcase tc_EPTF_LGenBase_Test_actionsPerConditionExecTime_TimeoutAfterFinish() runs on EPTF_LGenBase_ActionsPerCondition_CT{
|
| f_EPTF_LGenBase_actionsPerConditionInit()
|
| //Test Successes
|
| var EPTF_LGenBase_ScenarioTypeDeclarator vl_sc := c_EPTF_LGenBase_Test_actionsPerConditionInitScenario
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList)
|
| setverdict(inconc)
|
| f_EPTF_Base_cleanup_CT(); stop;
|
| }
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[6].execTime)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[6])
|
| setverdict(inconc)
|
| f_EPTF_Base_cleanup_CT(); stop;
|
| }
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[6].execTime.time := 2.0
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[6].execTime.actions[0].customFinishFunction := "MustNotBeCalled"
|
|
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[1].nrOfSuccesses)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[1])
|
| setverdict(inconc)
|
| f_EPTF_Base_cleanup_CT(); stop;
|
| }
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[1].nrOfSuccesses.count := 2
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[1].nrOfSuccesses.actions[0].customFinishFunction := "MustBeCalled"
|
|
|
|
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(vl_sc)
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0", "Scenario_A"}, true)
|
| if(f_EPTF_LGenBase_wait4TestFinished()){
|
| //wait for the execTime timer timeout
|
| timer t_wait := 3.0;
|
| t_wait.start;
|
| t_wait.timeout;
|
|
|
| if(2 != v_LGenBase_ActionsPerCondition_actionCalled){
|
| log(match(2, v_LGenBase_ActionsPerCondition_actionCalled))
|
| setverdict(fail, "There should be 2 action call, but there are ", v_LGenBase_ActionsPerCondition_actionCalled)
|
| }else{
|
| setverdict(pass)
|
| }
|
| }
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
|
|
| testcase tc_EPTF_LGenBase_Test_actionsPerConditionCombined() runs on EPTF_LGenBase_ActionsPerCondition_CT{
|
| f_EPTF_LGenBase_actionsPerConditionInit()
|
| //Test Successes
|
| var EPTF_LGenBase_ScenarioTypeDeclarator vl_sc := c_EPTF_LGenBase_Test_actionsPerConditionInitScenario
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList)
|
| setverdict(inconc)
|
| f_EPTF_Base_cleanup_CT(); stop;
|
| }
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish := {
|
| {nrOfExecStart := {count := 24,actions := {{customFinishFunction := "MustBeCalled"}}}},
|
| {nrOfRangeLoop := {count := 4,actions := {{customFinishFunction := "MustBeCalled"}}}},
|
| {nrOfSuccesses := {count := 24,actions := {{customFinishFunction := "MustBeCalled"}}}},
|
| {anythingFinished := {{{customFinishFunction := "MustBeCalled"}}}}
|
| }
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(vl_sc)
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0", "Scenario_A"}, true)
|
| if(f_EPTF_LGenBase_wait4TestFinished()){
|
| if(4 != v_LGenBase_ActionsPerCondition_actionCalled){
|
| log(match(4, v_LGenBase_ActionsPerCondition_actionCalled))
|
| setverdict(fail)
|
| }else{
|
| setverdict(pass)
|
| }
|
| }
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
| }
|
| //==========================================================
|
| // f_LGenBase_Test_logActualEntityIdx
|
| //==========================================================
|
| function f_LGenBase_Test_logActualEntityIdx(in EPTF_LGenBase_TestStepArgs pl_ptr)
|
| runs on EPTF_LGenBase_VarAndStatTest_CT {
|
| v_LGenBase_entityCalled[sizeof(v_LGenBase_entityCalled)]:= pl_ptr.eIdx;
|
| }
|
| //==========================================================
|
| // f_LGenBase_Test_fsmEntityFinishSucc1
|
| // Based on f_LGenBase_Test_fsmEntityFinishSucc
|
| //==========================================================
|
| function f_LGenBase_Test_fsmEntityFinishSucc1(in EPTF_LGenBase_EntitySelectionType pl_selection := round_robin)
|
| runs on EPTF_LGenBase_VarAndStatTest_CT{
|
| f_EPTF_LGenBase_init("tc_LGenBase_Test_fsmVariables");
|
| v_LGenBase_VarAndStatTest_behav := f_EPTF_LGenBase_declareBehaviorType("b1", -1, null, null, null);
|
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("et1", {"b1"});
|
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({"eg1", "et1", tsp_nrOfEntities});
|
| v_dummyInt := f_EPTF_LGenBase_declareFunction("Finished",{ customFinishFunction:= refers(f_EPTF_LGenBase_TestFinished)});
|
| v_dummyInt := f_EPTF_LGenBase_declareFunction("LogEntityIndex",{ testStepFunction:=refers(f_LGenBase_Test_logActualEntityIdx)});
|
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable(
|
| {
|
| name := "tc_LGenBase_Test_fsmEntityFinishSucc_FSM",
|
| fsmParams := {
|
| {stateList := {"idle"}},
|
| {varList := {
|
| // {
|
| // name := "var1ofFSM1",
|
| // initValue := {intVal := 0},
|
| // scope := FSM
|
| // }
|
| }},
|
| {statisticList := {
|
| //{"statMax",{{"var1ofFSM1"}},c_EPTF_StatHandler_Method_Max,{intVal := 0},TC},
|
| //{"statMin",{{"var1ofFSM1"}},c_EPTF_StatHandler_Method_Min,{intVal := 0},TC}
|
| }}
|
| },
|
| table := {
|
| classicTable := {
|
| {eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
|
| cellRow := {
|
| //state[0]==idle
|
| {{
|
| {"LogEntityIndex",omit},
|
| {c_EPTF_LGenBase_stepName_trafficSuccess, omit}
|
| }, omit, omit}
|
| }
|
| }
|
| }
|
| }
|
| }
|
| );
|
| v_dummyInt := f_EPTF_LGenBase_declareTrafficCaseType({
|
| "TC1",
|
| "tc_LGenBase_Test_fsmEntityFinishSucc_FSM",
|
| "et1",
|
| {}
|
| })
|
|
|
| var integer vl_nofSuccessPerEntity := 3;
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
|
| { "SC1",
|
| {
|
| {"TC1",{
|
| {entitySelection := pl_selection},
|
| {enabledAtStart := true},
|
| {enableEntitiesAtStart := true},
|
| {target := {cpsToReach := tsp_cps}},
|
| {trafficStartFinish :={
|
| {entitiesFinished := {{}}}
|
| }},
|
| {trafficFinishedActions := {
|
| {customFinishFunction := "Finished"}
|
| }
|
| },
|
| {entityFinishConditions := {
|
| {nrOfSuccesses := vl_nofSuccessPerEntity}}
|
| }
|
| }
|
| }
|
| },
|
| {}
|
| })
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},true);
|
| var float vl_started:=0.0, vl_finished:=0.0, vl_elapsed:=0.0;
|
| timer T_1;
|
| timer T_2;
|
| T_1.start( 0.0 )
|
| T_2.start( 15.0 )
|
| vl_started:=T_2.read;
|
| alt{
|
| [v_LGenBase_testFinished] T_1.timeout {
|
| vl_finished:=T_2.read;
|
| T_2.stop;
|
| log(">>>Finished with T_1 timeout")
|
| }
|
| [] T_2.timeout {
|
| log(">>>T_2 timeout occured!");
|
| setverdict(fail);
|
| }
|
| };
|
| log(">>>Finally v_LGenBase_entityCalled: ",v_LGenBase_entityCalled, " NofEntityCalled: ", sizeof(v_LGenBase_entityCalled));
|
| if(sizeof(v_LGenBase_entityCalled)==tsp_nrOfEntities*vl_nofSuccessPerEntity) {
|
| setverdict(pass);
|
| } else {
|
| setverdict(fail);
|
| log( ">>>NofEntityCalled: ", sizeof(v_LGenBase_entityCalled), " != ", tsp_nrOfEntities, "*", vl_nofSuccessPerEntity, " ,as expected");
|
| }
|
| log(">>>Times: started: ",vl_started, " finished: ", vl_finished, " elapsed: ", vl_finished-vl_elapsed);
|
| if((vl_finished-vl_elapsed)>0.0) {
|
| log("cps: ", int2float(sizeof(v_LGenBase_entityCalled))/ (vl_finished-vl_elapsed));
|
| }
|
| log("Ordered cps: ", tsp_cps);
|
|
|
|
|
| //========================
|
| //===== once more:========
|
| //========================
|
| var EPTF_IntegerList vl_oldEntityCalled:=v_LGenBase_entityCalled;
|
| v_LGenBase_entityCalled:={};
|
| v_LGenBase_testFinished:=false;
|
| //log(">>>Before reset v_LGenBase_trafficCases: ",v_LGenBase_trafficCases);
|
| if(not f_EPTF_LGenBase_restoreScenario( "eg1","SC1",false)){f_EPTF_Base_stop()}
|
| //log(">>>After reset v_LGenBase_trafficCases: ",v_LGenBase_trafficCases)
|
| f_EPTF_LGenBase_startTrafficCase( "eg1", "SC1", "TC1");
|
| if(f_EPTF_LGenBase_wait4TestFinished()){
|
| setverdict ( pass );
|
| }
|
| //log(">>>2. Finally v_LGenBase_entityCalled: ",v_LGenBase_entityCalled, " NofEntityCalled: ", sizeof(v_LGenBase_entityCalled));
|
| //log(">>>New EntityCalled: ", v_LGenBase_entityCalled);
|
| log(">>>Old EntityCalled: ", vl_oldEntityCalled);
|
| if( sizeof(v_LGenBase_entityCalled)==tsp_nrOfEntities*vl_nofSuccessPerEntity and v_LGenBase_entityCalled!=vl_oldEntityCalled) {
|
| setverdict(pass);
|
| } else {
|
| setverdict(fail);
|
| log( ">>>NofEntityCalled: ", sizeof(v_LGenBase_entityCalled), " != ", tsp_nrOfEntities, "*", vl_nofSuccessPerEntity, " ,as expected or the list is the same as the old one");
|
| log(">>>Old EntityCalled: ", vl_oldEntityCalled);
|
| }
|
| f_EPTF_Base_cleanup_CT()
|
| }
|
|
|
| ///////////////////////////////////////////////////////////
|
| // Testcase: tc_LGenBase_Test_randomlySelectedEntities
|
| //
|
| // Purpose:
|
| // To test function f_EPTF_LGenBase_step_entityStopped
|
| //
|
| // Requirement:
|
| // -
|
| //
|
| // Action:
|
| // 1. Starts a scenario for N entites in mode "random entity selection". Let noSuccessPerEntity is equal to 3.
|
| // All traffic case logs the entity index into a list.
|
| // 2. Repeat the scenario and log the entiy indices into a new list.
|
| // 3. Check the two list
|
| // Expected Result: The tc is passed if the two list are different.and the size of the lists is nofEntities*noSuccessPerEntity
|
| //
|
| ///////////////////////////////////////////////////////////
|
| // Status: Ready
|
| testcase tc_LGenBase_Test_randomlySelectedEntities() runs on EPTF_LGenBase_VarAndStatTest_CT{
|
| f_LGenBase_Test_fsmEntityFinishSucc1(random)
|
| }
|
|
|
| function f_LGenBase_Test_externalExecCallback(
|
| in integer pl_tcIdx,
|
| in EPTF_LGenBase_TcMgmt_GroupFinishActionListType pl_finishType)
|
| runs on LGenBase_ExternalExec_CT {
|
| log(%definitionId,": pl_finishType: ",pl_finishType,"pl_tcIdx: ",pl_tcIdx)
|
| select( pl_finishType ){
|
| case ( onGroupFinishCondition ){
|
| v_LGenBase_Test_counters[c_EPTF_LGenBase_Test_externalWithGroupFinishCounter] :=
|
| v_LGenBase_Test_counters[c_EPTF_LGenBase_Test_externalWithGroupFinishCounter] + 1
|
| v_ExternalExec_groupFinishedCalled := true
|
| if(not v_ExternalExec_detectInLGen){
|
| log("The group finish should have been detected externally")
|
| setverdict(fail)
|
| }
|
| }
|
| case (onLaunchFinish){
|
| v_LGenBase_Test_counters[c_EPTF_LGenBase_Test_externalWithTrafficFinishedCounter] :=
|
| v_LGenBase_Test_counters[c_EPTF_LGenBase_Test_externalWithTrafficFinishedCounter] + 1
|
| if(v_ExternalExec_detectInLGen and not v_ExternalExec_groupFinishedCalled){
|
| log(%definitionId,": The traffic finished called before the group finished called")
|
| setverdict ( fail );
|
| }
|
| if(v_ExternalExec_detectInLGen and not v_ExternalExec_groupFinishedProcessed){
|
| log(%definitionId,": The traffic finished called before the group finished processed")
|
| setverdict ( fail );
|
| }
|
| }
|
| }
|
|
|
| var EPTF_LGenBase_TcMgmt_GroupFinishActionListTypeMsg vl_msg := {
|
| pl_finishType,
|
| pl_tcIdx
|
| }
|
| p_LGenBase_Tester.send(vl_msg)
|
|
|
| }
|
|
|
| function f_LGenBase_externalExecPerConditionCallback(
|
| in integer pl_tcIdx,
|
| in EPTF_LGenBase_finishCallbackCause cause)
|
| runs on LGenBase_ExternalExec_CT {
|
| log(%definitionId,cause)
|
| select( true ){
|
| case ( ischosen(cause.conditions) ){
|
| v_LGenBase_Test_counters[c_EPTF_LGenBase_Test_externalNewWithGroupFinishCounter] :=
|
| v_LGenBase_Test_counters[c_EPTF_LGenBase_Test_externalNewWithGroupFinishCounter] + 1
|
| v_ExternalExec_groupFinishedCalled := true
|
| if(not v_ExternalExec_detectInLGen){
|
| log(%definitionId,": The group finished callback called when it should have been detected externally")
|
| setverdict ( fail );
|
| }
|
| }
|
| case (ischosen(cause.trafficFinished)){
|
| v_LGenBase_Test_counters[c_EPTF_LGenBase_Test_externalNewWithTrafficFinishedCounter] :=
|
| v_LGenBase_Test_counters[c_EPTF_LGenBase_Test_externalNewWithTrafficFinishedCounter] + 1
|
| if(not v_ExternalExec_groupFinishedCalled and v_ExternalExec_detectInLGen){
|
| log(%definitionId,": The traffic finished called before the group finished called")
|
| setverdict ( fail );
|
| }
|
| if(not v_ExternalExec_groupFinishedProcessed and v_ExternalExec_detectInLGen){
|
| log(%definitionId,": The traffic finished called before the group finished processed")
|
| setverdict ( fail );
|
| }
|
| }
|
| }
|
| var EPTF_LGenBase_finishCallbackCauseMsg vl_msg := {cause,pl_tcIdx}
|
| p_LGenBase_Tester.send(vl_msg)
|
| }
|
|
|
| function f_EPTF_LGenBase_Test_externalExecTcStatChangedCallbackOld(
|
| in integer pl_tcAbsIdx,
|
| in integer pl_eAbsIdx)
|
| runs on LGenBase_ExternalExec_CT {
|
| log(%definitionId)
|
| if(f_EPTF_LGenBase_getTcStarts(pl_tcAbsIdx) >= c_EPTF_LGenBase_Test_externalExecNofStart){
|
| if(v_ExternalExec_detectInLGen){
|
| log("The group finish should have been detected in LGenBase")
|
| setverdict(fail)
|
| }
|
| f_EPTF_LGenBase_processGroupFinished(pl_tcAbsIdx)
|
| }
|
| }
|
| function f_EPTF_LGenBase_Test_externalExecTcStatChangedCallbackNew(
|
| in integer pl_tcAbsIdx,
|
| in integer pl_eAbsIdx)
|
| runs on LGenBase_ExternalExec_CT {
|
| log(%definitionId)
|
| if(f_EPTF_LGenBase_getTcStarts(pl_tcAbsIdx) >= c_EPTF_LGenBase_Test_externalExecNofStart){
|
| var EPTF_LGenBase_ConditionTrue vl_cond:= c_EPTF_LGenBase_emptyConditionTrue
|
| vl_cond.nrOfExecStart := true
|
| vl_cond.anythingFinished := true
|
| if(v_ExternalExec_detectInLGen){
|
| log("The group finish should have been detected in LGenBase")
|
| setverdict(fail)
|
| }
|
| f_EPTF_LGenBase_processGroupFinished(pl_tcAbsIdx, vl_cond)
|
| }
|
| }
|
|
|
| function f_EPTF_LGenBase_Test_setExternalCounter(in integer pl_idx)
|
| runs on LGenBase_ExternalExec_CT{
|
| log(%definitionId)
|
| v_LGenBase_Test_counters[c_EPTF_LGenBase_Test_externalCounter] :=
|
| v_LGenBase_Test_counters[c_EPTF_LGenBase_Test_externalCounter] + 1
|
| }
|
|
|
| function f_EPTF_LGenBase_Test_setInternalCounter(in integer pl_idx)
|
| runs on LGenBase_ExternalExec_CT{
|
| log(%definitionId)
|
| v_LGenBase_Test_counters[c_EPTF_LGenBase_Test_internalCounter] :=
|
| v_LGenBase_Test_counters[c_EPTF_LGenBase_Test_internalCounter] + 1
|
| }
|
|
|
| function f_EPTF_LGenBase_Test_setCommonCounter(in integer pl_idx)
|
| runs on LGenBase_ExternalExec_CT{
|
| log(%definitionId)
|
| v_LGenBase_Test_counters[c_EPTF_LGenBase_Test_commonCounter] :=
|
| v_LGenBase_Test_counters[c_EPTF_LGenBase_Test_commonCounter] + 1
|
| }
|
|
|
| type enumerated LGenBase_Test_externalExecTestType {internal, oldver, newver}
|
| function f_LGenBase_Test_externalExec(
|
| in integer pl_execCount,
|
| in LGenBase_Test_externalExecTestType pl_testType,
|
| in integer pl_eCount)
|
| runs on LGenBase_ExternalExec_CT
|
| return boolean{
|
| f_EPTF_LGenBase_init("externalExec");
|
| v_LGenBase_Test_counters := {0,0,0,0,0,0,0}
|
| v_ExternalExec_groupFinishedCalled := false
|
| v_ExternalExec_groupFinishedProcessed := false
|
| v_ExternalExec_detectInLGen := c_EPTF_LGenBase_Test_externalExecNofStart > pl_execCount
|
| v_dummyInt := f_EPTF_LGenBase_declareFunction("Finished",{ customFinishFunction:= refers(f_EPTF_LGenBase_TestFinished)});
|
| v_dummyInt := f_EPTF_LGenBase_declareFunction("setExternalCounter",{ customFinishFunction:= refers(f_EPTF_LGenBase_Test_setExternalCounter)});
|
| v_dummyInt := f_EPTF_LGenBase_declareFunction("setInternalCounter",{ customFinishFunction:= refers(f_EPTF_LGenBase_Test_setInternalCounter)});
|
| v_dummyInt := f_EPTF_LGenBase_declareFunction("setCommonCounter",{ customFinishFunction:= refers(f_EPTF_LGenBase_Test_setCommonCounter)});
|
| var EPTF_LGenBase_ScenarioTypeDeclarator vl_scType := {
|
| name := "SC1",
|
| tcList := {
|
| {
|
| tcName := "TC_A0",
|
| tcParamsList := {
|
| {trafficStartFinish := {
|
| {nrOfExecStart := {count := 3*pl_execCount,actions := {{customFinishFunction := "setExternalCounter"}}}},
|
| {anythingFinished := {actions := {{customFinishFunction := "setCommonCounter"}}}},
|
| {entitiesFinished := {actions := {{customFinishFunction := "setInternalCounter"}}}}
|
| }
|
| },
|
| {tcTypeName := "TC_Succ"},
|
| {target := {cpsToReach := 15.0}},
|
| {enableEntitiesAtStart := true},
|
| {enabledAtStart := true},
|
| {trafficFinishedActions := {
|
| {customFinishFunction := "Finished"}
|
| }
|
| },
|
| {ranges := {
|
| {name := "public id", enableSplit := true, baseOffset := 0, count := 3},
|
| {name := "user id", enableSplit := false, baseOffset := 0, count := 2}
|
| }
|
| }
|
| }
|
| }
|
| },
|
| scParamsList := {
|
| //{enabled := false}
|
| }
|
| }
|
| select( pl_testType ){
|
| case ( oldver ){
|
| f_EPTF_LGenBase_setGroupFinishedFn(refers(f_LGenBase_Test_externalExecCallback))
|
| f_EPTF_LGenBase_registerTrafficStartedFn(
|
| refers(f_EPTF_LGenBase_Test_externalExecTcStatChangedCallbackOld))
|
| }
|
| case ( newver ){
|
| f_EPTF_LGenBase_setGroupFinishedPerConditionFn(refers(f_LGenBase_externalExecPerConditionCallback))
|
| f_EPTF_LGenBase_registerTrafficStartedFn(
|
| refers(f_EPTF_LGenBase_Test_externalExecTcStatChangedCallbackNew))
|
| }
|
| case ( internal ){
|
| }
|
| }
|
| vl_scType.tcList[0].tcParamsList[0].trafficStartFinish[
|
| sizeof(vl_scType.tcList[0].tcParamsList[0].trafficStartFinish)] :=
|
| {nrOfSuccesses := {count := pl_execCount,actions := {{customFinishFunction := "setInternalCounter"}}}}
|
|
|
| v_dummyInt := f_EPTF_LGenBase_declareBehaviorType("b1", -1, null, null, null);
|
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("et1", {"b1"});
|
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({"eg1", "et1", pl_eCount})
|
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable(
|
| valueof(t_EPTF_LGenBase_Test_simpleResponse(
|
| c_EPTF_LGenBase_Test_fsmNameSimpleResponseSucc,
|
| c_EPTF_LGenBase_stepName_trafficSuccess)))
|
|
|
| v_dummyInt := f_EPTF_LGenBase_declareTrafficCaseType({
|
| name := "TC_Succ",
|
| fsmName := c_EPTF_LGenBase_Test_fsmNameSimpleResponseSucc,
|
| entityType := "et1",
|
| tcParams := {}
|
| })
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(vl_scType)
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},true);
|
| return f_EPTF_LGenBase_wait4TestFinished(8.0)
|
| }
|
|
|
| const integer c_EPTF_LGenBase_Test_externalExecNofStart := 30
|
| const integer c_EPTF_LGenBase_Test_externalExecLessNofStart := 20
|
| const integer c_EPTF_LGenBase_Test_externalExecGtNofStart := 50
|
|
|
| const integer c_EPTF_LGenBase_Test_externalCounter := 0
|
| const integer c_EPTF_LGenBase_Test_internalCounter := 1
|
| const integer c_EPTF_LGenBase_Test_commonCounter := 2
|
| const integer c_EPTF_LGenBase_Test_externalWithGroupFinishCounter := 3
|
| const integer c_EPTF_LGenBase_Test_externalWithTrafficFinishedCounter := 4
|
| const integer c_EPTF_LGenBase_Test_externalNewWithGroupFinishCounter := 5
|
| const integer c_EPTF_LGenBase_Test_externalNewWithTrafficFinishedCounter := 6
|
|
|
| function f_LGenBase_Test_externalExecCheckResult(
|
| in integer pl_expectedCount,
|
| in EPTF_IntegerList pl_expectedMatch)
|
| runs on LGenBase_ExternalExec_CT {
|
| var integer vl_execStart := f_EPTF_LGenBase_getTcStarts(0)
|
| if(match(vl_execStart,pl_expectedCount)){
|
| setverdict(pass)
|
| }else{
|
| log(match(vl_execStart,pl_expectedCount))
|
| setverdict(fail)
|
| }
|
| if(match(v_LGenBase_Test_counters,pl_expectedMatch)){
|
| setverdict(pass)
|
| }else{
|
| log("Expected: ",pl_expectedMatch)
|
| log("Result: ",v_LGenBase_Test_counters)
|
| log(match(v_LGenBase_Test_counters,pl_expectedMatch))
|
| setverdict(fail)
|
| }
|
| }
|
|
|
| altstep as_LGenBase_Test_externalExecClient()
|
| runs on LGenBase_ExternalExec_CT {
|
| var EPTF_LGenBase_finishCallbackCauseMsg vl_newMsg;
|
| var EPTF_LGenBase_TcMgmt_GroupFinishActionListTypeMsg vl_oldMsg;
|
| [] p_LGenBase_Tester.receive(EPTF_LGenBase_finishCallbackCauseMsg:{cause:= {conditions:=?},tcIdx:=?} ) -> value vl_newMsg{
|
| v_ExternalExec_groupFinishedProcessed := true
|
| f_EPTF_LGenBase_execGroupFinishActions(vl_newMsg.tcIdx, {conditions:=vl_newMsg.cause.conditions})
|
| repeat;
|
| }
|
| [] p_LGenBase_Tester.receive(EPTF_LGenBase_finishCallbackCauseMsg:{cause:= {trafficFinished:=?},tcIdx:=?} ) -> value vl_newMsg{
|
| f_EPTF_LGenBase_execGroupFinishActions(vl_newMsg.tcIdx,{trafficFinished:={}})
|
| repeat;
|
| }
|
| [] p_LGenBase_Tester.receive(EPTF_LGenBase_TcMgmt_GroupFinishActionListTypeMsg:{finishType := onGroupFinishCondition,tcIdx:=?} ) -> value vl_oldMsg{
|
| v_ExternalExec_groupFinishedProcessed := true
|
| f_EPTF_LGenBase_execGroupFinishActions(vl_oldMsg.tcIdx, {conditions:=c_EPTF_LGenBase_anythingConditionTrue})
|
| repeat;
|
| }
|
| [] p_LGenBase_Tester.receive(EPTF_LGenBase_TcMgmt_GroupFinishActionListTypeMsg:{finishType := onLaunchFinish,tcIdx:=?} ) -> value vl_oldMsg{
|
| f_EPTF_LGenBase_execGroupFinishActions(vl_oldMsg.tcIdx,{trafficFinished:={}})
|
| repeat;
|
| }
|
| }
|
|
|
| function f_LGenBase_Test_externalExecClientBehavior(
|
| in integer pl_execCount,
|
| in LGenBase_Test_externalExecTestType pl_testType,
|
| in integer pl_eCount,
|
| in integer pl_expectedCount,
|
| in EPTF_IntegerList pl_expectedMatch,
|
| in LGenBase_Tester_CT pl_tester)
|
| runs on LGenBase_ExternalExec_CT {
|
| connect(self:p_LGenBase_Tester, pl_tester:p_LGenBase_Tester)
|
| activate(as_LGenBase_Test_externalExecClient())
|
| if(f_LGenBase_Test_externalExec(pl_execCount, pl_testType, pl_eCount)){
|
| f_LGenBase_Test_externalExecCheckResult(pl_expectedCount, pl_expectedMatch)
|
| }
|
| f_EPTF_Base_cleanup_CT()
|
| disconnect(self:p_LGenBase_Tester, pl_tester:p_LGenBase_Tester)
|
| stop
|
| }
|
|
|
| type record EPTF_LGenBase_finishCallbackCauseMsg{
|
| EPTF_LGenBase_finishCallbackCause cause,
|
| integer tcIdx
|
| }
|
|
|
| type record EPTF_LGenBase_TcMgmt_GroupFinishActionListTypeMsg{
|
| EPTF_LGenBase_TcMgmt_GroupFinishActionListType finishType,
|
| integer tcIdx
|
| }
|
| type port LGenBase_Test_ExternalExecMgmt_PT message {
|
| inout EPTF_LGenBase_finishCallbackCauseMsg
|
| inout EPTF_LGenBase_TcMgmt_GroupFinishActionListTypeMsg
|
| } with {extension "internal"}
|
|
|
| type component LGenBase_Tester_CT extends EPTF_Base_CT{
|
| port LGenBase_Test_ExternalExecMgmt_PT p_LGenBase_Tester
|
| }
|
|
|
| type component LGenBase_ExternalExec_CT extends EPTF_LGenBase_Test_CT{
|
| var boolean v_ExternalExec_groupFinishedCalled := false
|
| var boolean v_ExternalExec_groupFinishedProcessed := false
|
| var boolean v_ExternalExec_detectInLGen := false
|
| port LGenBase_Test_ExternalExecMgmt_PT p_LGenBase_Tester
|
| }
|
|
|
| function f_LGenBase_Test_execExternalExec(
|
| in integer pl_execCount,
|
| in LGenBase_Test_externalExecTestType pl_testType,
|
| in integer pl_eCount,
|
| in integer pl_expectedCount,
|
| in EPTF_IntegerList pl_expectedMatch,
|
| in float pl_wait := 0.2)
|
| runs on LGenBase_Tester_CT{
|
| f_EPTF_Base_init_CT("LGenBase_Tester")
|
| var LGenBase_ExternalExec_CT vl_client := LGenBase_ExternalExec_CT.create("client")
|
| vl_client.start( f_LGenBase_Test_externalExecClientBehavior(pl_execCount, pl_testType, pl_eCount, pl_expectedCount, pl_expectedMatch, self) );
|
| timer T_guard
|
| var EPTF_LGenBase_finishCallbackCauseMsg vl_newMsg;
|
| var EPTF_LGenBase_TcMgmt_GroupFinishActionListTypeMsg vl_oldMsg;
|
| T_guard.start(10.0)
|
| alt{
|
| [] p_LGenBase_Tester.receive(EPTF_LGenBase_finishCallbackCauseMsg:? ) -> value vl_newMsg{
|
| timer t_wait
|
| t_wait.start(pl_wait)
|
| t_wait.timeout
|
| p_LGenBase_Tester.send( vl_newMsg );
|
| repeat;
|
| }
|
| [] p_LGenBase_Tester.receive(EPTF_LGenBase_TcMgmt_GroupFinishActionListTypeMsg:? ) -> value vl_oldMsg{
|
| timer t_wait
|
| t_wait.start(pl_wait)
|
| t_wait.timeout
|
| p_LGenBase_Tester.send( vl_oldMsg );
|
| repeat;
|
| }
|
| [] T_guard.timeout
|
| {
|
| setverdict ( fail );
|
| }
|
| [] vl_client.done {}
|
| };
|
|
|
| }
|
|
|
| testcase tc_LGenBase_Test_externalExecInternal()
|
| runs on LGenBase_Tester_CT {
|
| f_LGenBase_Test_execExternalExec(c_EPTF_LGenBase_Test_externalExecLessNofStart, internal, 100,c_EPTF_LGenBase_Test_externalExecLessNofStart, {0,1,1,0,0,0,0})
|
| }
|
|
|
| testcase tc_LGenBase_Test_externalExecOldInternal()
|
| runs on LGenBase_Tester_CT {
|
| f_LGenBase_Test_execExternalExec(c_EPTF_LGenBase_Test_externalExecLessNofStart, oldver, 100,c_EPTF_LGenBase_Test_externalExecLessNofStart, {0,0,1,1,1,0,0})
|
| }
|
|
|
| testcase tc_LGenBase_Test_externalExecNewInternal()
|
| runs on LGenBase_Tester_CT {
|
| f_LGenBase_Test_execExternalExec(c_EPTF_LGenBase_Test_externalExecLessNofStart, newver, 100,c_EPTF_LGenBase_Test_externalExecLessNofStart, {0,1,1,0,0,1,1})
|
| }
|
|
|
| testcase tc_LGenBase_Test_externalExecOldExternal()
|
| runs on LGenBase_Tester_CT {
|
| f_LGenBase_Test_execExternalExec(c_EPTF_LGenBase_Test_externalExecGtNofStart, oldver, 100,c_EPTF_LGenBase_Test_externalExecNofStart, {0,0,1,0,1,0,0})
|
| }
|
|
|
| testcase tc_LGenBase_Test_externalExecNewExternal()
|
| runs on LGenBase_Tester_CT {
|
| f_LGenBase_Test_execExternalExec(c_EPTF_LGenBase_Test_externalExecGtNofStart, newver, 100,c_EPTF_LGenBase_Test_externalExecNofStart, {1,0,1,0,0,0,1})
|
| }
|
|
|
| ///////////////////////////////////////////////////////////
|
| // Testcase: tc_LGenBase_Test_listenToMultipleEvents
|
| //
|
| // Purpose:
|
| // Testcase to check declaration of multiple events in FSM table
|
| //
|
| // Action:
|
| // - Declares two FSMs with an integer variable
|
| // - Listeners to multiple input event ranges are declared to modify the value of variable
|
| // - Unhandled event listener declared to FSM1
|
| // - CatchAll event listener declared to FSM2
|
| // - After sending events variable is compared with expected values
|
| ///////////////////////////////////////////////////////////
|
| testcase tc_LGenBase_Test_listenToMultipleEvents() runs on EPTF_LGenBase_VarAndStatTest_CT{
|
| f_EPTF_LGenBase_init("tc_LGenBase_Test_fsmVariables");
|
| v_LGenBase_VarAndStatTest_behav := f_EPTF_LGenBase_declareBehaviorType("b1", -1, null, null, null);
|
| var integer vl_addTwo1 := f_EPTF_LGenBase_declareFsmEvent("b1","addTwo1");
|
| var integer vl_noListen := f_EPTF_LGenBase_declareFsmEvent("b1","noListen");
|
| var integer vl_addTwo2 := f_EPTF_LGenBase_declareFsmEvent("b1","addTwo2");
|
| var integer vl_addTwo3 := f_EPTF_LGenBase_declareFsmEvent("b1","addTwo3");
|
| var integer vl_addTwo4 := f_EPTF_LGenBase_declareFsmEvent("b1","addTwo4");
|
| var integer vl_addTwo5 := f_EPTF_LGenBase_declareFsmEvent("b1","addTwo5");
|
| var integer vl_addThree := f_EPTF_LGenBase_declareFsmEvent("b1","addThree");
|
| var integer vl_setTo := f_EPTF_LGenBase_declareFsmEvent("b1","setTo");
|
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("et1", {"b1"});
|
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({"eg1", "et1", 1})
|
| log("------ Before declareFSMTable")
|
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable(
|
| {
|
| name := "tc_LGenBase_Test_listenToMultipleEvents_FSM",
|
| fsmParams :=
|
| {
|
| {stateList := {"idle"}},
|
| {varList :=
|
| {
|
| {
|
| name := "var1",
|
| initValue := {intVal := 0},
|
| scope := FSM
|
| }
|
| }
|
| }
|
| },
|
| table := {
|
| extendedTable := {
|
| {
|
| events2Listen := {
|
| events := {
|
| { singleEvent := {"b1","setTo", fsm} }
|
| }
|
| },
|
| cellRow := {
|
| classicCellRow := {
|
| //state[0]==idle
|
| {
|
| {
|
| {"LGenBase: Set variable",{varParams := {"var1",{intVal := 1}}}}
|
| },
|
| omit, omit
|
| }
|
| } // classicCellRow
|
| } // cellRow
|
| },
|
| {
|
| events2Listen := {
|
| events := {
|
| { singleEvent := {"b1","addTwo1", fsm} },
|
| { eventRange := {"b1","addTwo2", "addTwo4", fsm} }, // event range
|
| { eventRange := {"b1","addTwo3", "addTwo5", fsm} }, // overlapped range
|
| { eventList := {"b1", { "addTwo3", "addTwo5", "addTwo4" }, fsm} }, // event list
|
| { eventList := {"b1", {}, fsm} } // empty list
|
| }
|
| },
|
| cellRow := {
|
| classicCellRow := {
|
| //state[0]==idle
|
| {
|
| {
|
| {"LGenBase: Increment variable",{varParams := {"var1",{intVal := 2}}}}
|
| },
|
| omit, omit
|
| }
|
| } // classicCellRow
|
| } // cellRow
|
| },
|
| {
|
| events2Listen := {
|
| events := { { singleEvent := {"b1","addThree", fsm} } }
|
| },
|
| cellRow := {
|
| classicCellRow := {
|
| {//state[0]==idle
|
| {//Cell
|
| {"LGenBase: Increment variable",{varParams := {"var1",{intVal := 3}}}}
|
| },
|
| omit, omit
|
| }
|
| } // classicCellRow
|
| } // cellRow
|
| },
|
| {
|
| events2Listen := { unhandled:= {} },
|
| cellRow := {
|
| classicCellRow := {
|
| {//state[0]==idle
|
| {//Cell
|
| {"LGenBase: Set variable",{varParams := {"var1",{intVal := 100}}}},
|
| {"LGenBase: Increment variable",{varParams := {"var1",{intVal := 2}}}}
|
| },
|
| omit, omit
|
| }
|
| } // classicCellRow
|
| } // cellRow
|
| }
|
| }
|
| } // extendedTable
|
| }
|
| );
|
| //log("-------------Log FSM Table",v_LGenBase_fsmTables)
|
|
|
| log("------ Before 2nd declareFSMTable")
|
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable(
|
| {
|
| name := "tc_LGenBase_Test_listenToMultipleEvents_FSM2",
|
| fsmParams :=
|
| {
|
| {stateList := {"idle"}},
|
| {varList :=
|
| {
|
| {
|
| name := "var1",
|
| initValue := {intVal := 0},
|
| scope := FSM
|
| }
|
| }
|
| }
|
| },
|
| table := {
|
| extendedTable := {
|
| {
|
| events2Listen := {
|
| events := {
|
| { singleEvent := {"b1","setTo", fsm} }
|
| }
|
| },
|
| cellRow := {
|
| classicCellRow := {
|
| //state[0]==idle
|
| {
|
| {
|
| {"LGenBase: Set variable",{varParams := {"var1",{intVal := 1}}}}
|
| },
|
| omit, omit
|
| }
|
| } // classicCellRow
|
| } // cellRow
|
| },
|
| {
|
| events2Listen := {
|
| events := {
|
| { singleEvent := {"b1","addTwo1", fsm} },
|
| { eventRange := {"b1","addTwo2", "addTwo4", fsm} },
|
| { eventRange := {"b1","addTwo3", "addTwo5", fsm} },
|
| { eventList := {"b1", { "addTwo3", "addTwo5", "addTwo4" }, fsm} },
|
| { eventList := {"b1", {}, fsm} }
|
| }
|
| },
|
| cellRow := {
|
| classicCellRow := {
|
| //state[0]==idle
|
| {
|
| {
|
| {"LGenBase: Increment variable",{varParams := {"var1",{intVal := 2}}}}
|
| },
|
| omit, omit
|
| }
|
| } // classicCellRow
|
| } // cellRow
|
| },
|
| {
|
| events2Listen := { catchAll:= {} },
|
| cellRow := {
|
| classicCellRow := {
|
| {//state[0]==idle
|
| {//Cell
|
| {"LGenBase: Increment variable",{varParams := {"var1",{intVal := 5}}}},
|
| {"LGenBase: Increment variable",{varParams := {"var1",{intVal := 3}}}}
|
|
|
| },
|
| omit, omit
|
| }
|
| } // classicCellRow
|
| } // cellRow
|
| }
|
| }
|
| } // extendedTable
|
| }
|
| );
|
| //log("-------------Log 2nd FSM Table",v_LGenBase_fsmTables)
|
| v_dummyInt := f_EPTF_LGenBase_declareTcType2({
|
| "TC1",
|
| "tc_LGenBase_Test_listenToMultipleEvents_FSM",
|
| "et1",
|
| ""
|
| })
|
| v_dummyInt := f_EPTF_LGenBase_declareTcType2({
|
| "TC2",
|
| "tc_LGenBase_Test_listenToMultipleEvents_FSM2",
|
| "et1",
|
| ""
|
| })
|
|
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
|
| { "SC1",
|
| {
|
| {"TC1",{{target := {cpsToReach := 0.0}}}},
|
| {"TC2",{{target := {cpsToReach := 0.0}}}}
|
| },
|
| {}
|
| })
|
|
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false)
|
| var EPTF_Var_DirectContent vl_content;
|
|
|
| /////////////////////////////////////////////////////////////
|
| // test listening event ranges and unhandled events with FSM1
|
| log("Test FSM1");
|
| var integer vl_var1 := f_EPTF_Var_getId(f_EPTF_LGenBase_varNameOfFSMVar(0,0,"var1"))
|
| if(vl_var1 < 0){
|
| f_EPTF_Base_stop();
|
| }
|
| //set to 1
|
| log("Set to 1");
|
| f_EPTF_LGenBase_dispatchEvent({ { v_LGenBase_VarAndStatTest_behav, vl_setTo, {0,0}, omit}, {} });
|
| f_EPTF_Var_getContent(vl_var1, vl_content);
|
| if(not match(vl_content, {intVal := 1})){
|
| log(match(vl_content, {intVal := 1}))
|
| setverdict ( fail );
|
| }
|
| // increment with 2
|
| log("Add 2");
|
| f_EPTF_LGenBase_dispatchEvent({ { v_LGenBase_VarAndStatTest_behav, vl_addTwo1, {0,0}, omit}, {} });
|
| f_EPTF_Var_getContent(vl_var1, vl_content);
|
| if(not match(vl_content, {intVal := 3})){
|
| log(match(vl_content, {intVal := 3}))
|
| setverdict ( fail );
|
| }
|
| // increment with 2
|
| log("Add 2");
|
| f_EPTF_LGenBase_dispatchEvent({ { v_LGenBase_VarAndStatTest_behav, vl_addTwo2, {0,0}, omit}, {} });
|
| f_EPTF_Var_getContent(vl_var1, vl_content);
|
| if(not match(vl_content, {intVal := 5})){
|
| log(match(vl_content, {intVal := 5}))
|
| setverdict ( fail );
|
| }
|
| // increment with 2
|
| log("Add 2");
|
| f_EPTF_LGenBase_dispatchEvent({ { v_LGenBase_VarAndStatTest_behav, vl_addTwo3, {0,0}, omit}, {} });
|
| f_EPTF_Var_getContent(vl_var1, vl_content);
|
| if(not match(vl_content, {intVal := 7})){
|
| log(match(vl_content, {intVal := 7}))
|
| setverdict ( fail );
|
| }
|
| // increment with 2
|
| log("Add 2");
|
| f_EPTF_LGenBase_dispatchEvent({ { v_LGenBase_VarAndStatTest_behav, vl_addTwo4, {0,0}, omit}, {} });
|
| f_EPTF_Var_getContent(vl_var1, vl_content);
|
| if(not match(vl_content, {intVal := 9})){
|
| log(match(vl_content, {intVal := 9}))
|
| setverdict ( fail );
|
| }
|
| // increment with 2
|
| log("Add 2");
|
| f_EPTF_LGenBase_dispatchEvent({ { v_LGenBase_VarAndStatTest_behav, vl_addTwo5, {0,0}, omit}, {} });
|
| f_EPTF_Var_getContent(vl_var1, vl_content);
|
| if(not match(vl_content, {intVal := 11})){
|
| log(match(vl_content, {intVal := 11}))
|
| setverdict ( fail );
|
| }
|
| // set to 1
|
| log("Set to 1");
|
| f_EPTF_LGenBase_dispatchEvent({ { v_LGenBase_VarAndStatTest_behav, vl_setTo, {0,0}, omit}, {} });
|
| f_EPTF_Var_getContent(vl_var1, vl_content);
|
| if(not match(vl_content, {intVal := 1})){
|
| log(match(vl_content, {intVal := 1}))
|
| setverdict ( fail );
|
| }
|
| // send event which doesn't have listener -> shall be forwarded to unhandled listener
|
| log("Dispatch event does not have listener -> unhandled");
|
| f_EPTF_LGenBase_dispatchEvent({ { v_LGenBase_VarAndStatTest_behav, vl_noListen, {0,0}, omit}, {} });
|
| f_EPTF_Var_getContent(vl_var1, vl_content);
|
| if(not match(vl_content, {intVal := 102})){
|
| log(match(vl_content, {intVal := 102}))
|
| setverdict ( fail );
|
| }
|
| // increment with 3
|
| log("Add 3");
|
| f_EPTF_LGenBase_dispatchEvent({ { v_LGenBase_VarAndStatTest_behav, vl_addThree, {0,0}, omit}, {} });
|
| f_EPTF_Var_getContent(vl_var1, vl_content);
|
| if(not match(vl_content, {intVal := 105})){
|
| log(match(vl_content, {intVal := 105}))
|
| setverdict ( fail );
|
| }
|
|
|
| ////////////////////////////////////////////////////////////
|
| // test catchAll with FSM2
|
| log("Test FSM2");
|
| vl_var1 := f_EPTF_Var_getId(f_EPTF_LGenBase_varNameOfFSMVar(0,1,"var1"))
|
| if(vl_var1 < 0){
|
| f_EPTF_Base_stop();
|
| }
|
| //set to 1 - catchall increments with 8
|
| log("Set to 1");
|
| f_EPTF_LGenBase_dispatchEvent({ { v_LGenBase_VarAndStatTest_behav, vl_setTo, {0,1}, omit}, {} });
|
| f_EPTF_Var_getContent(vl_var1, vl_content);
|
| if(not match(vl_content, {intVal := 9})){
|
| log(match(vl_content, {intVal := 9}))
|
| setverdict ( fail );
|
| }
|
| // increment with 2 - catchall increments with 8
|
| log("Add 2");
|
| f_EPTF_LGenBase_dispatchEvent({ { v_LGenBase_VarAndStatTest_behav, vl_addTwo1, {0,1}, omit}, {} });
|
| f_EPTF_Var_getContent(vl_var1, vl_content);
|
| if(not match(vl_content, {intVal := 19})){
|
| log(match(vl_content, {intVal := 19}))
|
| setverdict ( fail );
|
| }
|
| // send event which doesn't have listener - catchall increments with 8
|
| log("Dispatch event does not have listener, but catchAll handles");
|
| f_EPTF_LGenBase_dispatchEvent({ { v_LGenBase_VarAndStatTest_behav, vl_noListen, {0,1}, omit}, {} });
|
| f_EPTF_Var_getContent(vl_var1, vl_content);
|
| if(not match(vl_content, {intVal := 27})){
|
| log(match(vl_content, {intVal := 27}))
|
| setverdict ( fail );
|
| }
|
|
|
| setverdict ( pass );
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
|
|
| group fsmLogging{
|
| type component EPTF_LGenBaseTestFsmLogging_CT extends EPTF_LGenBase_Test_CT{
|
| const EPTF_CharstringList c_LGenBaseTestFsmLogging_emptyLogs := {"","","",""}
|
| const EPTF_CharstringList c_LGenBaseTestFsmLogging_varNames := {
|
| "single shot","FSM","default FSM"
|
| }
|
| const integer c_LGenBaseTestFsmLogging_singleShotLog := 0
|
| const integer c_LGenBaseTestFsmLogging_fsmDebugLog := 1
|
| const integer c_LGenBaseTestFsmLogging_fsmDefaultDebugLog := 2
|
| var EPTF_CharstringList v_LGenBaseTestFsmLogging_logs := c_LGenBaseTestFsmLogging_emptyLogs
|
| }
|
| function f_EPTF_LGenBase_Test_fsmLoggingPostproc(
|
| in integer pl_idx,
|
| in EPTF_IntegerList pl_argList)
|
| runs on EPTF_LGenBaseTestFsmLogging_CT{
|
| var EPTF_Var_DirectContent vl_temp
|
| f_EPTF_Var_getContent(pl_idx, vl_temp)
|
| v_LGenBaseTestFsmLogging_logs[pl_argList[0]] :=
|
| v_LGenBaseTestFsmLogging_logs[pl_argList[0]] & vl_temp.charstringVal
|
| }
|
|
|
| function f_EPTF_LGenBase_Test_fsmLoggingCheckVarEmpty(in EPTF_BooleanList pl_list)
|
| runs on EPTF_LGenBaseTestFsmLogging_CT{
|
| for ( var integer vl_i := 0; vl_i < sizeof(pl_list) ; vl_i := vl_i+1 ){
|
| if(pl_list[vl_i] and "" != v_LGenBaseTestFsmLogging_logs[vl_i]){
|
| log("The variable containing logs of "&c_LGenBaseTestFsmLogging_varNames[vl_i]&
|
| " should be empty instead of "&v_LGenBaseTestFsmLogging_logs[vl_i])
|
| }
|
| if(not pl_list[vl_i] and "" == v_LGenBaseTestFsmLogging_logs[vl_i]){
|
| log("The variable containing logs of "&c_LGenBaseTestFsmLogging_varNames[vl_i]&" should not be empty.")
|
| }
|
| }
|
| }
|
|
|
| testcase tc_LGenBase_Test_fsmLogging()
|
| runs on EPTF_LGenBaseTestFsmLogging_CT{
|
| f_EPTF_LGenBase_init("fsmLogging");
|
| f_EPTF_LGenBase_enableLocalMask(c_EPTF_LGenBase_loggingClassIdx_DebugFSMEventDispatch);
|
| const integer c_entities := 6
|
| v_dummyInt := f_EPTF_LGenBase_declareBehaviorType("b1", -1, null, null, null);
|
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("et1", {"b1"});
|
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({"eg1", "et1", c_entities})
|
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable(
|
| valueof(t_EPTF_LGenBase_Test_simpleResponse(
|
| c_EPTF_LGenBase_Test_fsmNameSimpleResponseSucc,
|
| c_EPTF_LGenBase_stepName_trafficSuccess)))
|
|
|
| v_dummyInt := f_EPTF_LGenBase_declareTrafficCaseType({
|
| name := "TC_Succ",
|
| fsmName := c_EPTF_LGenBase_Test_fsmNameSimpleResponseSucc,
|
| entityType := "et1",
|
| tcParams := {}
|
| })
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3({
|
| name := "SC1",
|
| tcList := {
|
| {
|
| tcName := "TC_A0",
|
| tcParamsList := {
|
| {trafficStartFinish := {
|
| {nrOfExecStart := {count := c_entities,actions := {}}}
|
| }
|
| },
|
| {tcTypeName := "TC_Succ"},
|
| {target := {cpsToReach := 15.0}},
|
| {enableEntitiesAtStart := true},
|
| {enabledAtStart := true}
|
| }
|
| }
|
| },
|
| scParamsList := {}
|
| })
|
| v_dummyInt := f_EPTF_LGenBase_addSingleShotDebugPostproc(
|
| {refers(f_EPTF_LGenBase_Test_fsmLoggingPostproc),{c_LGenBaseTestFsmLogging_singleShotLog}})
|
| v_dummyInt := f_EPTF_LGenBase_addFsmDebugPostproc(
|
| {refers(f_EPTF_LGenBase_Test_fsmLoggingPostproc),{c_LGenBaseTestFsmLogging_fsmDebugLog}})
|
| f_EPTF_LGenBase_addFsmDefaultDebugPostproc(
|
| {refers(f_EPTF_LGenBase_Test_fsmLoggingPostproc), {c_LGenBaseTestFsmLogging_fsmDefaultDebugLog}})
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false)
|
| var integer vl_fsmDebugVar
|
| if(not f_EPTF_LGenBase_setFSMDebug(0, 0, vl_fsmDebugVar)){
|
| setverdict(fail)
|
| f_EPTF_Base_stop()
|
| }
|
| f_EPTF_LGenBase_singleShotTcByIdx(0, 0, true)
|
| log("Logs after the first event dispatch with special FSM debug: ",
|
| "\nv_LGenBaseTestFsmLogging_singleShotLog: ",v_LGenBaseTestFsmLogging_logs[c_LGenBaseTestFsmLogging_singleShotLog],
|
| "\nv_LGenBaseTestFsmLogging_fsmDebugLog: ",v_LGenBaseTestFsmLogging_logs[c_LGenBaseTestFsmLogging_fsmDebugLog],
|
| "\nv_LGenBaseTestFsmLogging_fsmDefaultDebugLog: ",v_LGenBaseTestFsmLogging_logs[c_LGenBaseTestFsmLogging_fsmDefaultDebugLog])
|
| //v_LGenBaseTestFsmLogging_singleShotLog must be the substring of v_LGenBaseTestFsmLogging_singleFsmDebugLog
|
| if(v_LGenBaseTestFsmLogging_logs[c_LGenBaseTestFsmLogging_singleShotLog] !=
|
| substr(v_LGenBaseTestFsmLogging_logs[c_LGenBaseTestFsmLogging_fsmDebugLog],0,
|
| lengthof(v_LGenBaseTestFsmLogging_logs[c_LGenBaseTestFsmLogging_singleShotLog]))){
|
| log("The special FSM debug must begin with the single shot log.")
|
| log(v_LGenBaseTestFsmLogging_logs[c_LGenBaseTestFsmLogging_singleShotLog])
|
| log(v_LGenBaseTestFsmLogging_logs[c_LGenBaseTestFsmLogging_fsmDebugLog])
|
| setverdict(fail)
|
| }
|
| f_EPTF_LGenBase_Test_fsmLoggingCheckVarEmpty({false,false,true})
|
| v_LGenBaseTestFsmLogging_logs := c_LGenBaseTestFsmLogging_emptyLogs
|
| f_EPTF_LGenBase_closeFSMDebug(0, 0)
|
|
|
| f_EPTF_LGenBase_singleShotTcByIdx(0, 0, true)
|
| f_EPTF_LGenBase_Test_fsmLoggingCheckVarEmpty({false,true,false})
|
| v_LGenBaseTestFsmLogging_logs := c_LGenBaseTestFsmLogging_emptyLogs
|
|
|
| v_dummyBool := f_EPTF_LGenBase_startEntity("eg1", "SC1", "TC_A0", 0)
|
| f_EPTF_LGenBase_Test_fsmLoggingCheckVarEmpty({true,true,false})
|
| v_LGenBaseTestFsmLogging_logs := c_LGenBaseTestFsmLogging_emptyLogs
|
|
|
| f_EPTF_LGenBase_disableLocalMask(c_EPTF_LGenBase_loggingClassIdx_DebugFSMEventDispatch);
|
| v_dummyBool := f_EPTF_LGenBase_startEntity("eg1", "SC1", "TC_A0", 0)
|
| f_EPTF_LGenBase_Test_fsmLoggingCheckVarEmpty({true,true,true})
|
| v_LGenBaseTestFsmLogging_logs := c_LGenBaseTestFsmLogging_emptyLogs
|
|
|
| f_EPTF_LGenBase_singleShotTcByIdx(0, 0, true)
|
| f_EPTF_LGenBase_Test_fsmLoggingCheckVarEmpty({false,true,true})
|
| v_LGenBaseTestFsmLogging_logs := c_LGenBaseTestFsmLogging_emptyLogs
|
|
|
| f_EPTF_LGenBase_singleShotTcByIdx(0, 0, false)
|
| f_EPTF_LGenBase_Test_fsmLoggingCheckVarEmpty({true,true,true})
|
| v_LGenBaseTestFsmLogging_logs := c_LGenBaseTestFsmLogging_emptyLogs
|
|
|
| if(not f_EPTF_LGenBase_setFSMDebug(0, 0, vl_fsmDebugVar)){
|
| setverdict(fail)
|
| f_EPTF_Base_stop()
|
| }
|
| f_EPTF_LGenBase_singleShotTcByIdx(0, 0, false)
|
| f_EPTF_LGenBase_Test_fsmLoggingCheckVarEmpty({true,false,true})
|
| v_LGenBaseTestFsmLogging_logs := c_LGenBaseTestFsmLogging_emptyLogs
|
|
|
| setverdict(pass)
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
| }
|
|
|
| group testFinished{
|
| function f_EPTF_LGenBase_Test_testFinishedListener(
|
| EPTF_LGenBase_ReportedEventDescriptor pl_event,
|
| EPTF_IntegerList pl_listenerArgs)
|
| runs on EPTF_LGenBase_Test_CT{
|
| if(tsp_EPTF_LGenBaseTestDebug) {
|
| log(%definitionId&log2str(pl_event))
|
| }
|
| v_LGenBase_testFinished := true
|
| }
|
|
|
| testcase tc_LGenBase_Test_testFinished()
|
| runs on EPTF_LGenBase_Test_CT{
|
| f_EPTF_LGenBase_init("fsmLogging");
|
| const integer c_entities := 6
|
| v_dummyInt := f_EPTF_LGenBase_declareBehaviorType("b1", -1, null, null, null);
|
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("et1", {"b1"});
|
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({"eg1", "et1", c_entities})
|
| v_dummyInt := f_EPTF_LGenBase_addGeneralEventListener(
|
| c_EPTF_LGenBase_bIdx,
|
| c_EPTF_LGenBase_inputIdx_testMgmt_testFinished,
|
| refers(f_EPTF_LGenBase_Test_testFinishedListener), {})
|
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable(
|
| valueof(t_EPTF_LGenBase_Test_simpleResponse(
|
| c_EPTF_LGenBase_Test_fsmNameSimpleResponseSucc,
|
| c_EPTF_LGenBase_stepName_trafficSuccess)))
|
|
|
| v_dummyInt := f_EPTF_LGenBase_declareTrafficCaseType({
|
| name := "TC_Succ",
|
| fsmName := c_EPTF_LGenBase_Test_fsmNameSimpleResponseSucc,
|
| entityType := "et1",
|
| tcParams := {}
|
| })
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3({
|
| name := "SC1",
|
| tcList := {
|
| {
|
| tcName := "TC_A0",
|
| tcParamsList := {
|
| {trafficStartFinish := {
|
| {nrOfExecStart := {count := c_entities,actions := {}}},
|
| {nrOfSuccesses := {count := c_entities,actions := {{testFinished := {}}}}}
|
| }
|
| },
|
| {tcTypeName := "TC_Succ"},
|
| {target := {cpsToReach := 15.0}},
|
| {enableEntitiesAtStart := true},
|
| {enabledAtStart := true}
|
| }
|
| }
|
| },
|
| scParamsList := {}
|
| })
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"})
|
| if(f_EPTF_LGenBase_wait4TestFinished()){
|
| setverdict ( pass );
|
| }
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
| }
|
|
|
| group finishMask{
|
| template EPTF_LGenBase_ConditionTrue t_EPTF_LGenBase_ConditionTrue(
|
| in boolean pl_nrOfExecStart:= true,
|
| in boolean pl_nrOfSuccesses:= true,
|
| in boolean pl_nrOfFails:= true,
|
| in boolean pl_nrOfErrors:= true,
|
| in boolean pl_nrOfTimeouts:= true,
|
| in boolean pl_nrOfRangeLoop:= true,
|
| in boolean pl_execTime:= true,
|
| in boolean pl_entitiesFinished:= true,
|
| in boolean pl_availableEntitiesFinished:= true,
|
| in boolean pl_customFinishCondition:= true,
|
| in boolean pl_anythingFinished:= true
|
| ) := {
|
| nrOfExecStart := pl_nrOfExecStart,
|
| nrOfSuccesses := pl_nrOfSuccesses,
|
| nrOfFails := pl_nrOfFails,
|
| nrOfErrors := pl_nrOfErrors,
|
| nrOfTimeouts := pl_nrOfTimeouts,
|
| nrOfRangeLoop := pl_nrOfRangeLoop,
|
| execTime := pl_execTime,
|
| entitiesFinished := pl_entitiesFinished,
|
| availableEntitiesFinished := pl_availableEntitiesFinished,
|
| customFinishCondition := pl_customFinishCondition,
|
| anythingFinished := pl_anythingFinished
|
| }
|
|
|
| testcase tc_EPTF_LGenBase_Test_finishMaskExecStart()
|
| runs on EPTF_LGenBase_ActionsPerCondition_CT{
|
| f_EPTF_LGenBase_actionsPerConditionInit()
|
| //Test execTime
|
| f_EPTF_LGenBase_setGroupFinishConditionMask(valueof(t_EPTF_LGenBase_ConditionTrue(pl_nrOfExecStart := false)))
|
| var EPTF_LGenBase_ScenarioTypeDeclarator vl_sc := c_EPTF_LGenBase_Test_actionsPerConditionInitScenario
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList)
|
| f_EPTF_Base_stop(inconc)
|
| }
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[0].nrOfExecStart)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[0])
|
| f_EPTF_Base_stop(inconc)
|
| }
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[1].nrOfSuccesses)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[1])
|
| f_EPTF_Base_stop(inconc)
|
| }
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[0].nrOfExecStart.count := 20
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[0].nrOfExecStart.actions[0].customFinishFunction := "MustNotBeCalled"
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[1].nrOfSuccesses.count := 30
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[1].nrOfSuccesses.actions[0].customFinishFunction := "MustBeCalled"
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(vl_sc)
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0", "Scenario_A"}, true)
|
| if(f_EPTF_LGenBase_wait4TestFinished()){
|
| if(2 != v_LGenBase_ActionsPerCondition_actionCalled){
|
| log(match(2, v_LGenBase_ActionsPerCondition_actionCalled))
|
| setverdict(fail)
|
| }else{
|
| setverdict(pass)
|
| }
|
| }
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
|
|
| testcase tc_EPTF_LGenBase_Test_finishMaskNrOfSuccesses()
|
| runs on EPTF_LGenBase_ActionsPerCondition_CT{
|
| f_EPTF_LGenBase_actionsPerConditionInit()
|
| //Test Successes
|
| f_EPTF_LGenBase_setGroupFinishConditionMask(valueof(t_EPTF_LGenBase_ConditionTrue(pl_nrOfSuccesses := false)))
|
| var EPTF_LGenBase_ScenarioTypeDeclarator vl_sc := c_EPTF_LGenBase_Test_actionsPerConditionInitScenario
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList)
|
| f_EPTF_Base_stop(inconc)
|
| }
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[1].nrOfSuccesses)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[1])
|
| f_EPTF_Base_stop(inconc)
|
| }
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[1].nrOfSuccesses.count := 20
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[1].nrOfSuccesses.actions[0].customFinishFunction := "MustNotBeCalled"
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[0].nrOfExecStart)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[0])
|
| f_EPTF_Base_stop(inconc)
|
| }
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[0].nrOfExecStart.count := 30
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[0].nrOfExecStart.actions[0].customFinishFunction := "MustBeCalled"
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(vl_sc)
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0", "Scenario_A"}, true)
|
| if(f_EPTF_LGenBase_wait4TestFinished()){
|
| if(2 != v_LGenBase_ActionsPerCondition_actionCalled){
|
| log(match(2, v_LGenBase_ActionsPerCondition_actionCalled))
|
| setverdict(fail)
|
| }else{
|
| setverdict(pass)
|
| }
|
| }
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
|
|
| testcase tc_EPTF_LGenBase_Test_finishMaskNrOfFails()
|
| runs on EPTF_LGenBase_ActionsPerCondition_CT{
|
| f_EPTF_LGenBase_actionsPerConditionInit()
|
| //Test Fails
|
| f_EPTF_LGenBase_setGroupFinishConditionMask(valueof(t_EPTF_LGenBase_ConditionTrue(pl_nrOfFails := false)))
|
| var EPTF_LGenBase_ScenarioTypeDeclarator vl_sc := c_EPTF_LGenBase_Test_actionsPerConditionInitScenario
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList)
|
| f_EPTF_Base_stop(inconc)
|
| }
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[2].nrOfFails)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[2])
|
| f_EPTF_Base_stop(inconc)
|
| }
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[1].tcTypeName)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList)
|
| f_EPTF_Base_stop(inconc)
|
| }
|
| vl_sc.tcList[0].tcParamsList[1].tcTypeName := "TC_Fail"
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[2].nrOfFails.count := 20
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[2].nrOfFails.actions[0].customFinishFunction := "MustNotBeCalled"
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[0].nrOfExecStart)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[0])
|
| f_EPTF_Base_stop(inconc)
|
| }
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[0].nrOfExecStart.count := 30
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[0].nrOfExecStart.actions[0].customFinishFunction := "MustBeCalled"
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(vl_sc)
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0", "Scenario_A"}, true)
|
| if(f_EPTF_LGenBase_wait4TestFinished()){
|
| if(2 != v_LGenBase_ActionsPerCondition_actionCalled){
|
| log(match(2, v_LGenBase_ActionsPerCondition_actionCalled))
|
| setverdict(fail)
|
| }else{
|
| setverdict(pass)
|
| }
|
| }
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
|
|
| testcase tc_EPTF_LGenBase_Test_finishMaskNrOfErrors()
|
| runs on EPTF_LGenBase_ActionsPerCondition_CT{
|
| f_EPTF_LGenBase_actionsPerConditionInit()
|
| //Test Errors
|
| f_EPTF_LGenBase_setGroupFinishConditionMask(valueof(t_EPTF_LGenBase_ConditionTrue(pl_nrOfErrors := false)))
|
| var EPTF_LGenBase_ScenarioTypeDeclarator vl_sc := c_EPTF_LGenBase_Test_actionsPerConditionInitScenario
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList)
|
| f_EPTF_Base_stop(inconc)
|
| }
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[8].nrOfErrors)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[8])
|
| f_EPTF_Base_stop(inconc)
|
| }
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[8].nrOfErrors.count := 20
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[8].nrOfErrors.actions:={{customFinishFunction := "MustNotBeCalled"}}
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[0].nrOfExecStart)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[0])
|
| f_EPTF_Base_stop(inconc)
|
| }
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[0].nrOfExecStart.count := 30
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[0].nrOfExecStart.actions[0].customFinishFunction := "MustBeCalled"
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[1].tcTypeName)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList)
|
| f_EPTF_Base_stop(inconc)
|
| }
|
| vl_sc.tcList[0].tcParamsList[1].tcTypeName := "TC_Error"
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(vl_sc)
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0", "Scenario_A"}, true)
|
| if(f_EPTF_LGenBase_wait4TestFinished()){
|
| if(2 != v_LGenBase_ActionsPerCondition_actionCalled){
|
| log(match(2, v_LGenBase_ActionsPerCondition_actionCalled))
|
| setverdict(fail)
|
| }else{
|
| setverdict(pass)
|
| }
|
| }
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
|
|
| testcase tc_EPTF_LGenBase_Test_finishMaskNrOfTimeouts()
|
| runs on EPTF_LGenBase_ActionsPerCondition_CT{
|
| f_EPTF_LGenBase_actionsPerConditionInit()
|
| //Test Timeouts
|
| f_EPTF_LGenBase_setGroupFinishConditionMask(valueof(t_EPTF_LGenBase_ConditionTrue(pl_nrOfTimeouts := false)))
|
| var EPTF_LGenBase_ScenarioTypeDeclarator vl_sc := c_EPTF_LGenBase_Test_actionsPerConditionInitScenario
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList)
|
| f_EPTF_Base_stop(inconc)
|
| }
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[9].nrOfTimeouts)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[9])
|
| f_EPTF_Base_stop(inconc)
|
| }
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[9].nrOfTimeouts.count := 20
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[9].nrOfTimeouts.actions:={{customFinishFunction := "MustNotBeCalled"}}
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[0].nrOfExecStart)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[0])
|
| f_EPTF_Base_stop(inconc)
|
| }
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[0].nrOfExecStart.count := 30
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[0].nrOfExecStart.actions[0].customFinishFunction := "MustBeCalled"
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[1].tcTypeName)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList)
|
| f_EPTF_Base_stop(inconc)
|
| }
|
| vl_sc.tcList[0].tcParamsList[1].tcTypeName := "TC_Timeout"
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(vl_sc)
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0", "Scenario_A"}, true)
|
| if(f_EPTF_LGenBase_wait4TestFinished()){
|
| if(2 != v_LGenBase_ActionsPerCondition_actionCalled){
|
| log(match(2, v_LGenBase_ActionsPerCondition_actionCalled))
|
| setverdict(fail)
|
| }else{
|
| setverdict(pass)
|
| }
|
| }
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
|
|
| testcase tc_EPTF_LGenBase_Test_finishMaskNrOfRangeLoop()
|
| runs on EPTF_LGenBase_ActionsPerCondition_CT{
|
| f_EPTF_LGenBase_actionsPerConditionInit()
|
| //Test RangeLoop
|
| f_EPTF_LGenBase_setGroupFinishConditionMask(valueof(t_EPTF_LGenBase_ConditionTrue(pl_nrOfRangeLoop := false)))
|
| var EPTF_LGenBase_ScenarioTypeDeclarator vl_sc := c_EPTF_LGenBase_Test_actionsPerConditionInitScenario
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList)
|
| f_EPTF_Base_stop(inconc)
|
| }
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[3].nrOfRangeLoop)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[3])
|
| f_EPTF_Base_stop(inconc)
|
| }
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[3].nrOfRangeLoop.count := 2
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[3].nrOfRangeLoop.actions[0].customFinishFunction := "MustNotBeCalled"
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[0].nrOfExecStart)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[0])
|
| f_EPTF_Base_stop(inconc)
|
| }
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[0].nrOfExecStart.count := 30
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[0].nrOfExecStart.actions[0].customFinishFunction := "MustBeCalled"
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(vl_sc)
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0", "Scenario_A"}, true)
|
| if(f_EPTF_LGenBase_wait4TestFinished()){
|
| if(2 != v_LGenBase_ActionsPerCondition_actionCalled){
|
| log(match(2, v_LGenBase_ActionsPerCondition_actionCalled))
|
| setverdict(fail)
|
| }else{
|
| setverdict(pass)
|
| }
|
| }
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
|
|
| testcase tc_EPTF_LGenBase_Test_finishMaskEntitiesFinished()
|
| runs on EPTF_LGenBase_ActionsPerCondition_CT{
|
| f_EPTF_LGenBase_actionsPerConditionInit()
|
| //Test EntitiesFinished
|
| f_EPTF_LGenBase_setGroupFinishConditionMask(valueof(t_EPTF_LGenBase_ConditionTrue(pl_entitiesFinished := false)))
|
| var EPTF_LGenBase_ScenarioTypeDeclarator vl_sc := c_EPTF_LGenBase_Test_actionsPerConditionInitScenario
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList)
|
| f_EPTF_Base_stop(inconc)
|
| }
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[4].entitiesFinished)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[4])
|
| f_EPTF_Base_stop(inconc)
|
| }
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[4].entitiesFinished.actions[0].customFinishFunction := "MustNotBeCalled"
|
|
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[10].availableEntitiesFinished)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[10])
|
| f_EPTF_Base_stop(inconc)
|
| }
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[10].availableEntitiesFinished.actions[0].customFinishFunction := "MustBeCalled"
|
|
|
| vl_sc.tcList[0].tcParamsList[sizeof(vl_sc.tcList[0].tcParamsList)] := {
|
| entityFinishConditions := {{nrOfExecStart := 1}}
|
| }
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(vl_sc)
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0", "Scenario_A"}, true)
|
| if(f_EPTF_LGenBase_wait4TestFinished()){
|
| if(2 != v_LGenBase_ActionsPerCondition_actionCalled){
|
| log(match(2, v_LGenBase_ActionsPerCondition_actionCalled))
|
| setverdict(fail)
|
| }else{
|
| setverdict(pass)
|
| }
|
| }
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
|
|
| testcase tc_EPTF_LGenBase_Test_finishMaskAvailableEntitiesFinished()
|
| runs on EPTF_LGenBase_ActionsPerCondition_CT{
|
| const integer c_eCount := 50
|
| const integer c_eDisable := 20
|
| f_EPTF_LGenBase_actionsPerConditionInit(c_eCount)
|
| //Test AvailableEntitiesFinished
|
| f_EPTF_LGenBase_setGroupFinishConditionMask(valueof(t_EPTF_LGenBase_ConditionTrue(pl_availableEntitiesFinished := false)))
|
| var EPTF_LGenBase_ScenarioTypeDeclarator vl_sc := c_EPTF_LGenBase_Test_actionsPerConditionInitScenario
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList)
|
| f_EPTF_Base_stop(inconc)
|
| }
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[10].availableEntitiesFinished)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[10])
|
| f_EPTF_Base_stop(inconc)
|
| }
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[10].availableEntitiesFinished.actions:={{customFinishFunction := "MustNotBeCalled"}}
|
|
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[4].entitiesFinished)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[4])
|
| f_EPTF_Base_stop(inconc)
|
| }
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[4].entitiesFinished.actions[0].customFinishFunction := "MustBeCalled"
|
|
|
| vl_sc.tcList[0].tcParamsList[sizeof(vl_sc.tcList[0].tcParamsList)] := {
|
| entityFinishConditions := {{nrOfExecStart := 1}}
|
| }
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(vl_sc)
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0", "Scenario_A"}, false)
|
| f_EPTF_LGenBase_enableScenarioOnEntityGroup(0, 0, true)
|
| if(f_EPTF_LGenBase_wait4TestFinished()){
|
| if(2 != v_LGenBase_ActionsPerCondition_actionCalled){
|
| log(match(2, v_LGenBase_ActionsPerCondition_actionCalled))
|
| setverdict(fail)
|
| }else{
|
| setverdict(pass)
|
| }
|
| }
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
|
|
|
|
| testcase tc_EPTF_LGenBase_Test_finishMaskCustomFinish()
|
| runs on EPTF_LGenBase_ActionsPerCondition_CT{
|
| f_EPTF_LGenBase_actionsPerConditionInit()
|
| //Test CustomFinish
|
| f_EPTF_LGenBase_setGroupFinishConditionMask(valueof(t_EPTF_LGenBase_ConditionTrue(pl_customFinishCondition := false)))
|
| var EPTF_LGenBase_ScenarioTypeDeclarator vl_sc := c_EPTF_LGenBase_Test_actionsPerConditionInitScenario
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList)
|
| f_EPTF_Base_stop(inconc)
|
| }
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[5].customFinish)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[5])
|
| f_EPTF_Base_stop(inconc)
|
| }
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[5].customFinish.functionName := "ConditionTrue"
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[5].customFinish.actions[0].customFinishFunction := "MustNotBeCalled"
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[0].nrOfExecStart.count := 30
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[0].nrOfExecStart.actions[0].customFinishFunction := "MustBeCalled"
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(vl_sc)
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0", "Scenario_A"}, true)
|
| if(f_EPTF_LGenBase_wait4TestFinished()){
|
| if(2 != v_LGenBase_ActionsPerCondition_actionCalled){
|
| log(match(2, v_LGenBase_ActionsPerCondition_actionCalled))
|
| setverdict(fail)
|
| }else{
|
| setverdict(pass)
|
| }
|
| }
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
| testcase tc_EPTF_LGenBase_Test_finishMaskExecTime() runs on EPTF_LGenBase_ActionsPerCondition_CT{
|
| f_EPTF_LGenBase_actionsPerConditionInit()
|
| //Test ExecTime
|
| f_EPTF_LGenBase_setGroupFinishConditionMask(valueof(t_EPTF_LGenBase_ConditionTrue(pl_execTime := false)))
|
| var EPTF_LGenBase_ScenarioTypeDeclarator vl_sc := c_EPTF_LGenBase_Test_actionsPerConditionInitScenario
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList)
|
| f_EPTF_Base_stop(inconc)
|
| }
|
| if(not ischosen(vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[6].execTime)){
|
| log(%definitionId,": ",vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[6])
|
| f_EPTF_Base_stop(inconc)
|
| }
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[6].execTime.time := 2.0
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[6].execTime.actions[0].customFinishFunction := "MustNotBeCalled"
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[0].nrOfExecStart.count := 40
|
| vl_sc.tcList[0].tcParamsList[0].trafficStartFinish[0].nrOfExecStart.actions[0].customFinishFunction := "MustBeCalled"
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(vl_sc)
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0", "Scenario_A"}, true)
|
| if(f_EPTF_LGenBase_wait4TestFinished()){
|
| if(2 != v_LGenBase_ActionsPerCondition_actionCalled){
|
| log(match(2, v_LGenBase_ActionsPerCondition_actionCalled))
|
| setverdict(fail)
|
| }else{
|
| setverdict(pass)
|
| }
|
| }
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
| }
|
|
|
| group execActionsAfterStop{
|
| const integer c_EPTF_LGenBase_Test_execActionsAfterStopStartCount := 20
|
| const charstring c_EPTF_LGenBase_Test_fsmNameDelayed := "EPTF_FSM_Tc_Delayed"
|
|
|
| function f_EPTF_LGenBase_Test_execActionsAfterStopStartCounter(
|
| in integer pl_tcAbsIdx,
|
| in integer pl_eAbsIdx)
|
| runs on EPTF_LGenBase_Test_CT {
|
| if(tsp_EPTF_LGenBaseTestDebug){
|
| log(%definitionId)
|
| }
|
| v_LGenBase_Test_trafficCaseStartedCounter := v_LGenBase_Test_trafficCaseStartedCounter + 1
|
| if(v_LGenBase_Test_trafficCaseStartedCounter >= c_EPTF_LGenBase_Test_execActionsAfterStopStartCount){
|
| v_LGenBase_testFinished := true
|
| }
|
| }
|
|
|
| function f_EPTF_LGenBase_testExecActionsAfterStopInit(
|
| in integer pl_eCount := 100,
|
| in float pl_cps := 10.0)
|
| runs on EPTF_LGenBase_Test_CT{
|
| f_EPTF_LGenBase_init("actionsPerCondition");
|
| v_dummyInt := f_EPTF_LGenBase_declareBehaviorType("b1", -1, null, null, null);
|
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("Entity_Tc_A", {"b1"});
|
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({name := "eg0", eType := "Entity_Tc_A", eCount := pl_eCount})
|
| //v_dummyInt := f_EPTF_LGenBase_declareFunction("MustBeCalled",{customFinishFunction := refers(f_EPTF_LGenBase_actionsPerConditionMustBeCalled)});
|
| v_dummyInt := f_EPTF_LGenBase_declareFunction("MustNotBeCalled",{customFinishFunction := refers(f_EPTF_LGenBase_actionsPerConditionMustNotBeCalled)});
|
| v_dummyInt := f_EPTF_LGenBase_addGeneralEventListener(
|
| c_EPTF_LGenBase_bIdx,
|
| c_EPTF_LGenBase_inputIdx_testMgmt_testFinished,
|
| refers(f_EPTF_LGenBase_Test_testFinishedListener), {})
|
| v_dummyInt := f_EPTF_LGenBase_addGeneralEventListener(
|
| c_EPTF_LGenBase_bIdx,
|
| c_EPTF_LGenBase_inputIdx_testMgmt_scenarioFinished,
|
| refers(f_EPTF_LGenBase_Test_testFinishedListener), {})
|
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable(
|
| valueof(t_EPTF_LGenBase_Test_delayedResponse(
|
| c_EPTF_LGenBase_Test_fsmNameDelayed,
|
| c_EPTF_LGenBase_stepName_trafficSuccess)))
|
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable(
|
| valueof(t_EPTF_LGenBase_Test_simpleResponse(
|
| c_EPTF_LGenBase_Test_fsmNameSimpleResponseSucc,
|
| c_EPTF_LGenBase_stepName_trafficSuccess)))
|
| v_dummyInt := f_EPTF_LGenBase_declareTcType2({
|
| name := "TC_Delayed",
|
| fsmName := c_EPTF_LGenBase_Test_fsmNameDelayed,
|
| entityType := "Entity_Tc_A",
|
| customEntitySucc := ""
|
| })
|
| v_dummyInt := f_EPTF_LGenBase_declareTcType2({
|
| name := "TC_Succ",
|
| fsmName := c_EPTF_LGenBase_Test_fsmNameSimpleResponseSucc,
|
| entityType := "Entity_Tc_A",
|
| customEntitySucc := ""
|
| })
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
|
| {
|
| name := "Scenario_Simple",
|
| tcList := {
|
| {
|
| tcName := "TC_A0",
|
| tcParamsList := {
|
| {trafficStartFinish := {
|
| {nrOfExecStart := {count := c_EPTF_LGenBase_Test_execActionsAfterStopStartCount + 1,actions := {{customFinishFunction := "MustNotBeCalled"}}}},
|
| {nrOfSuccesses := {count := c_EPTF_LGenBase_Test_execActionsAfterStopStartCount,actions := {{customFinishFunction := "MustNotBeCalled"}}}}
|
| }
|
| },
|
| {tcTypeName := "TC_Delayed"},
|
| {target := {cpsToReach := pl_cps}},
|
| {enableEntitiesAtStart := true},
|
| {enabledAtStart := true},
|
| {trafficFinishedActions := {
|
| {customFinishFunction := "MustNotBeCalled"}
|
| }
|
| },
|
| {ranges := {
|
| {name := "public id", enableSplit := true, baseOffset := 0, count := 3},
|
| {name := "user id", enableSplit := false, baseOffset := 0, count := 2}
|
| }
|
| }
|
| }
|
| }
|
| },
|
| scParamsList := {}
|
| })
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
|
| {
|
| name := "Scenario_Joined",
|
| tcList := {
|
| {
|
| tcName := "TC_A0",
|
| tcParamsList := {
|
| {trafficStartFinish := {
|
| {nrOfExecStart := {count := 200,actions := {{customFinishFunction := "MustNotBeCalled"}}}},
|
| {nrOfSuccesses := {count := 200,actions := {{customFinishFunction := "MustNotBeCalled"}}}}
|
| }
|
| },
|
| {tcTypeName := "TC_Succ"},//Note: this must be the second parameter in the test
|
| {target := {cpsToReach := pl_cps}},
|
| {enableEntitiesAtStart := true},
|
| {enabledAtStart := true},
|
| {ranges := {
|
| {name := "public id", enableSplit := true, baseOffset := 0, count := 3},
|
| {name := "user id", enableSplit := false, baseOffset := 0, count := 2}
|
| }
|
| }
|
| }
|
| },
|
| {
|
| tcName := "TC_A1",
|
| tcParamsList := {
|
| {trafficStartFinish := {
|
| {nrOfExecStart := {count := 30,actions := {{customFinishFunction := "MustNotBeCalled"}}}},
|
| {nrOfSuccesses := {count := 30,actions := {{customFinishFunction := "MustNotBeCalled"}}}}
|
| }
|
| },
|
| {tcTypeName := "TC_Succ"},//Note: this must be the second parameter in the test
|
| {target := {cpsToReach := pl_cps}},
|
| {enableEntitiesAtStart := true},
|
| {enabledAtStart := false},
|
| {trafficFinishedActions := {
|
| {customFinishFunction := "MustNotBeCalled"}
|
| }
|
| },
|
| {ranges := {
|
| {name := "public id", enableSplit := true, baseOffset := 0, count := 3},
|
| {name := "user id", enableSplit := false, baseOffset := 0, count := 2}
|
| }
|
| }
|
| }
|
| }
|
| },
|
| scParamsList := {}
|
| })
|
| }
|
| testcase tc_EPTF_LGenBase_Test_execActionsAfterStop_stopNormalTC()
|
| runs on EPTF_LGenBase_ActionsPerCondition_CT{
|
| f_EPTF_LGenBase_testExecActionsAfterStopInit()
|
| f_EPTF_LGenBase_registerTrafficStartedFn(
|
| refers(f_EPTF_LGenBase_Test_execActionsAfterStopStartCounter))
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0", "Scenario_Simple"}, true)
|
| if(f_EPTF_LGenBase_wait4TestFinished()){
|
| f_EPTF_LGenBase_stopTrafficCase("eg0", "Scenario_Simple", "TC_A0")
|
| if(not f_EPTF_LGenBase_wait4TestFinished(1.0, false)){
|
| setverdict(pass)
|
| }
|
| }
|
| f_EPTF_Base_cleanup_CT()
|
| }
|
|
|
| type component EPTF_LGenBase_startDelay_CT extends EPTF_LGenBase_Test_CT{
|
| const float c_delay := 3.0
|
| timer t3
|
| }
|
|
|
| function f_EPTF_LGenBase_Test_tcStartedListener(
|
| EPTF_LGenBase_ReportedEventDescriptor pl_event,
|
| EPTF_IntegerList pl_listenerArgs)
|
| runs on EPTF_LGenBase_startDelay_CT{
|
| if(tsp_EPTF_LGenBaseTestDebug) {log(%definitionId)}
|
| t3.start( 4444444.4 )
|
| }
|
|
|
| testcase tc_EPTF_LGenBase_Test_startDelay()
|
| runs on EPTF_LGenBase_startDelay_CT{
|
| f_EPTF_LGenBase_init("actionsPerCondition");
|
| v_dummyInt := f_EPTF_LGenBase_declareBehaviorType("b1", -1, null, null, null);
|
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("Entity_Tc_A", {"b1"});
|
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({name := "eg0", eType := "Entity_Tc_A", eCount := 2})
|
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable({
|
| name := "stop",
|
| fsmParams := {
|
| {stateList := {"idle"}}
|
| },
|
| table := {
|
| classicTable := {
|
| {eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
|
| cellRow := {
|
| {{
|
| {c_EPTF_LGenBase_stepName_testFinished, omit}
|
| }, omit, omit}
|
| }
|
| }
|
| }
|
| }
|
| })
|
| v_dummyInt := f_EPTF_LGenBase_addGeneralEventListener(
|
| c_EPTF_LGenBase_bIdx,
|
| c_EPTF_LGenBase_inputIdx_testMgmt_testFinished,
|
| refers(f_EPTF_LGenBase_Test_testFinishedListener), {})
|
| v_dummyInt := f_EPTF_LGenBase_addGeneralEventListener(
|
| c_EPTF_LGenBase_bIdx,
|
| c_EPTF_LGenBase_inputIdx_testMgmt_trafficCaseStarted,
|
| refers(f_EPTF_LGenBase_Test_tcStartedListener), {})
|
| v_dummyInt := f_EPTF_LGenBase_declareTcType2({
|
| name := "TC_Succ",
|
| fsmName := "stop",
|
| entityType := "Entity_Tc_A",
|
| customEntitySucc := ""
|
| })
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
|
| {
|
| name := "Scenario_Simple",
|
| tcList := {
|
| {
|
| tcName := "TC_A0",
|
| tcParamsList := {
|
| {tcTypeName := "TC_Succ"},
|
| {startDelay := c_delay},
|
| {target := {cpsToReach := 20.0}},
|
| {enableEntitiesAtStart := true},
|
| {enabledAtStart := true}
|
| }
|
| }
|
| },
|
| scParamsList := {}
|
| })
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0", "Scenario_Simple"}, false)
|
| f_EPTF_LGenBase_startTrafficCaseByIdx(0)
|
| if(f_EPTF_LGenBase_wait4TestFinished()){
|
| var float vl_delay := t3.read
|
| if(match(vl_delay,(c_delay* 0.9 .. c_delay*1.1) )){
|
| setverdict(pass)
|
| }else{
|
| log(match(vl_delay,(c_delay* 0.9 ..c_delay*1.1)))
|
| setverdict(fail)
|
| }
|
| log(match(vl_delay,(c_delay*0.9 ..c_delay*1.1)))
|
| }
|
| t3.stop
|
| f_EPTF_Base_cleanup_CT()
|
| }
|
| }
|
|
|
| testcase tc_EPTF_LGenBase_Test_runningAfterEntitiesFinished()
|
| runs on EPTF_LGenBase_ActionsPerCondition_CT{
|
| const integer c_eCount := 3
|
| f_EPTF_LGenBase_actionsPerConditionInit(c_eCount)
|
| //Test execTime
|
| var EPTF_LGenBase_ScenarioTypeDeclarator vl_sc := {
|
| name := "Scenario_A",
|
| tcList := {
|
| {
|
| tcName := "TC_A0",
|
| tcParamsList := {
|
| {tcTypeName := "TC_Succ"},//Note: this must be the second parameter in the test
|
| {target := {cpsToReach := 10.0}},
|
| {enableEntitiesAtStart := true},
|
| {enabledAtStart := true},
|
| {entityFinishConditions := {{nrOfExecStart := 1}}}
|
| }
|
| }
|
| },
|
| scParamsList := {
|
| //{enabled := false}
|
| }
|
| }
|
|
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(vl_sc)
|
| timer t1
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0", "Scenario_A"}, true)
|
| t1.start(0.5)
|
| t1.timeout
|
| if(c_EPTF_LGenBase_tcStateRunning == f_EPTF_LGenBase_getTcState(0) and
|
| c_eCount == f_EPTF_LGenBase_nrOfBusyEntities(0) ){
|
| setverdict(pass)
|
| }else{
|
| //log(v_LGenBase_trafficCases)
|
| setverdict(fail)
|
| }
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
|
|
| testcase tc_EPTF_LGenBase_Test_runningAfterEntitiesFinished2()
|
| runs on EPTF_LGenBase_ActionsPerCondition_CT{
|
| const integer c_eCount := 1
|
| f_EPTF_LGenBase_testExecActionsAfterStopInit(c_eCount)
|
| v_dummyInt := f_EPTF_LGenBase_PhaseList_store( {
|
| name := "BasicPhases",
|
| phases :=
|
| {
|
| { name := "preamble", enabled := true },
|
| { name := "loadgen" , enabled := true },
|
| { name := "postamble",enabled := true }
|
| }
|
| }
|
| )
|
| var EPTF_LGenBase_ScenarioTypeDeclarator vl_sc := {
|
| name := "scDialToneManagementCallOrig_dtmA",
|
| tcList := {
|
| {
|
| tcName := "tcDialToneManagementRegistration_dtmA",
|
| tcParamsList := {
|
| {tcTypeName := "TC_Delayed"},
|
| {target := {cpsToReach := 3.000000}},
|
| {enableEntitiesAtStart := true },
|
| {enabledAtStart := false},
|
| {
|
| params := {
|
| {
|
| aName := "IMS",
|
| pName := "scenario",
|
| pValue := "scDialToneManagementCallOrig_dtmA"
|
| },
|
| {
|
| aName := "IMS",
|
| pName := "mainTC",
|
| pValue := "tcDialToneManagementCallOrig_dtmA"
|
| }
|
| }
|
| },
|
| {entityFinishConditions := {
|
| {nrOfSuccesses := 1},
|
| {nrOfFails := 3}
|
| }
|
| },
|
| {
|
| entityFinishActions := {
|
| {
|
| enableEntity4Tc := {
|
| tcName := "tcSsc_Activate_dtmA",
|
| aMode := enableIfPreviousSuccess
|
| }
|
| },
|
| {
|
| enableEntity4Tc := {
|
| tcName := "tcDialToneManagementReRegistration_dtmA",
|
| aMode := enableIfPreviousSuccess
|
| }
|
| }
|
| }
|
| }
|
| }
|
| },
|
| {
|
| tcName := "tcSsc_Activate_dtmA",
|
| tcParamsList := {
|
| {tcTypeName := "TC_Delayed"},
|
| {target := {cpsToReach := 3.000000}},
|
| {enableEntitiesAtStart := false},
|
| {enabledAtStart := false},
|
| {
|
| params := {
|
| {
|
| aName := "IMS",
|
| pName := "scenario",
|
| pValue := "scDialToneManagementCallOrig_dtmA"
|
| },
|
| {
|
| aName := "IMS",
|
| pName := "ownTC",
|
| pValue := "tcSsc_Activate"
|
| },
|
| {
|
| aName := "IMS",
|
| pName := "mainTC",
|
| pValue := "tcDialToneManagementCallOrig_dtmA"
|
| }
|
| }
|
| },
|
| {entityFinishConditions := {
|
| {nrOfSuccesses := 1},
|
| {nrOfFails := 3}
|
| }
|
| },
|
| {
|
| entityFinishActions := {
|
| {
|
| enableEntity4Tc := {
|
| tcName := "tcDialToneManagementCallOrig_dtmA",
|
| aMode := enableIfPreviousSuccess
|
| }
|
| }
|
| }
|
| }
|
| }
|
| },
|
| {
|
| tcName := "tcDialToneManagementCallOrig_dtmA",
|
| tcParamsList := {
|
| {tcTypeName := "TC_Delayed"},
|
| {target := {cpsToReach := 3.000000}},
|
| {enableEntitiesAtStart := false},
|
| {enabledAtStart := false},
|
| {entityFinishConditions := {
|
| {nrOfSuccesses := 1},
|
| {nrOfFails := 1}
|
| }
|
| },
|
| {
|
| entityFinishActions := {
|
| {
|
| enableEntity4Tc := {
|
| tcName := "tcSsc_Deactivate_dtmA",
|
| aMode := enableIfPreviousSuccess
|
| }
|
| }
|
| }
|
| }
|
| }
|
| },
|
| {
|
| tcName := "tcDialToneManagementReRegistration_dtmA",
|
| tcParamsList := {
|
| {tcTypeName := "TC_Delayed"},
|
| {target := {cpsToReach := 3.000000}},
|
| {enableEntitiesAtStart := false},
|
| {enabledAtStart := false},
|
| {
|
| trafficStartFinish := {
|
| {
|
| entitiesFinished := {actions := {}}
|
| }
|
| }
|
| },
|
| {
|
| entityFinishConditions := {
|
| {nrOfSuccesses := 1},
|
| {nrOfFails := 3}
|
| }
|
| }
|
| }
|
| },
|
| {
|
| tcName := "tcSsc_Deactivate_dtmA",
|
| tcParamsList := {
|
| {tcTypeName := "TC_Delayed"},
|
| {target := {cpsToReach := 3.000000}},
|
| {enableEntitiesAtStart := false },
|
| {enabledAtStart := false},
|
| {
|
| params := {
|
| {
|
| aName := "IMS",
|
| pName := "scenario",
|
| pValue := "scDialToneManagementCallOrig_dtmA"
|
| },
|
| {
|
| aName := "IMS",
|
| pName := "ownTC",
|
| pValue := "tcSsc_Deactivate"
|
| },
|
| {
|
| aName := "IMS",
|
| pName := "mainTC",
|
| pValue := "tcDialToneManagementCallOrig_dtmA"
|
| }
|
| }
|
| },
|
| {entityFinishConditions := {
|
| {nrOfSuccesses := 1},
|
| {nrOfFails := 2}
|
| }
|
| },
|
| {
|
| entityFinishActions := {
|
| {
|
| enableEntity4Tc := {
|
| tcName := "tcDialToneManagementDeRegistration_dtmA",
|
| aMode := available
|
| }
|
| }
|
| }
|
| }
|
| }
|
| },
|
| {
|
| tcName := "tcDialToneManagementDeRegistration_dtmA",
|
| tcParamsList := {
|
| {tcTypeName := "TC_Delayed"},
|
| {target := {cpsToReach := 3.000000}},
|
| {enableEntitiesAtStart := false},
|
| {enabledAtStart := false},
|
| {
|
| entityFinishConditions := {
|
| {nrOfSuccesses := 1},
|
| {nrOfFails := 3}
|
| }
|
| },
|
| {
|
| entityFinishActions := {
|
| {
|
| enableEntity4Tc := {
|
| tcName := "tcDialToneManagementRegistration_dtmA",
|
| aMode := available
|
| }
|
| }
|
| }
|
| },
|
| {
|
| params := {
|
| {
|
| aName := "IMS",
|
| pName := "reRegStatus",
|
| pValue := "created"
|
| }
|
| }
|
| }
|
| }
|
| }
|
| },
|
| scParamsList := {
|
| {enabled := true},
|
| {phaseListName := "BasicPhases"},
|
| {
|
| phaseFinishConditions := {
|
| {
|
| phase := "preamble",
|
| conditions := {
|
| {
|
| tcFinished := "tcSsc_Activate_dtmA"
|
| }
|
| }
|
| },
|
| {
|
| phase := "loadgen",
|
| conditions := {
|
| {
|
| tcFinished := "tcDialToneManagementCallOrig_dtmA"
|
| }
|
| }
|
| },
|
| {
|
| phase := "postamble",
|
| conditions := {
|
| {
|
| tcFinished := "tcDialToneManagementDeRegistration_dtmA"
|
| }
|
| }
|
| }
|
| }
|
| },
|
| {
|
| phaseStateChangeActions := {
|
| {
|
| phase := "preamble",
|
| state := RUNNING,
|
| actions := {
|
| {restoreScenario := ""},
|
| {reportActualPhaseFinished := ""}
|
| }
|
| },
|
| {
|
| phase := "preamble",
|
| state := SKIPPING,
|
| actions := {
|
| {reportActualPhaseFinished := ""}
|
| }
|
| },
|
| {
|
| phase := "preamble",
|
| state := STOPPING ,
|
| actions := {
|
| {reportActualPhaseFinished := ""}
|
| }
|
| },
|
| {
|
| phase := "loadgen",
|
| state := RUNNING,
|
| actions := {
|
| {startTc := "tcSsc_Deactivate_dtmA"},
|
| {startTc := "tcSsc_Activate_dtmA"},
|
| {startTc := "tcDialToneManagementCallOrig_dtmA"},
|
| {startTc := "tcDialToneManagementRegistration_dtmA"},
|
| {startTc := "tcDialToneManagementReRegistration_dtmA"},
|
| {startTc := "tcDialToneManagementDeRegistration_dtmA"}
|
| }
|
| },
|
| {
|
| phase := "loadgen",
|
| state := STOPPING,
|
| actions := {
|
| {disableTc := "tcDialToneManagementCallOrig_dtmA"},
|
| {disableTc := "tcDialToneManagementRegistration_dtmA"},
|
| {disableTc := "tcDialToneManagementReRegistration_dtmA"},
|
| {disableTc := "tcDialToneManagementDeRegistration_dtmA"},
|
| {disableTc := "tcSsc_Activate_dtmA"},
|
| {disableTc := "tcSsc_Deactivate_dtmA"}
|
| }
|
| },
|
| {
|
| phase := "loadgen",
|
| state := SKIPPING ,
|
| actions := {
|
| {reportActualPhaseFinished := ""}
|
| }
|
| },
|
| {
|
| phase := "postamble",
|
| state := RUNNING,
|
| actions := {
|
| {disableTc := "tcSsc_Deactivate_dtmA"},
|
| {disableTc := "tcSsc_Activate_dtmA"},
|
| {disableTc := "tcDialToneManagementCallOrig_dtmA"},
|
| {disableTc := "tcDialToneManagementRegistration_dtmA"},
|
| {disableTc := "tcDialToneManagementReRegistration_dtmA"},
|
| {disableTc := "tcDialToneManagementDeRegistration_dtmA"}
|
| }
|
| },
|
| {
|
| phase := "postamble",
|
| state := STOPPING,
|
| actions := {
|
| {reportActualPhaseFinished := ""}
|
| }
|
| },
|
| {
|
| phase := "postamble",
|
| state := SKIPPING,
|
| actions := {
|
| {reportActualPhaseFinished := ""}
|
| }
|
| }
|
| }
|
| }
|
| }
|
| }
|
|
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(vl_sc)
|
| timer t1
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0", "scDialToneManagementCallOrig_dtmA"}, false)
|
| f_EPTF_LGenBase_startPhase("eg0", "scDialToneManagementCallOrig_dtmA", "loadgen", null, {})
|
| t1.start(25.0)
|
| t1.timeout
|
| if(c_EPTF_LGenBase_tcStateRunning == f_EPTF_LGenBase_getTcState(0) and
|
| c_EPTF_LGenBase_tcStateRunning == f_EPTF_LGenBase_getTcState(1) and
|
| c_EPTF_LGenBase_tcStateRunning == f_EPTF_LGenBase_getTcState(2) ){
|
| setverdict(pass)
|
| }else{
|
| //log(v_LGenBase_trafficCases)
|
| setverdict(fail)
|
| }
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
|
|
| //For tc_EPTF_LGenBase_Test_listening2TimerEvents
|
| function f_EPTF_LGenBase_Test_setPass(in EPTF_LGenBase_TestStepArgs pl_ptr)
|
| runs on EPTF_LGenBase_CT{
|
| if(pl_ptr.reportedEvent.event.bIdx == c_EPTF_LGenBase_specialBIdx_timerTimeout and
|
| pl_ptr.reportedEvent.event.iIdx == 2 ){
|
| setverdict(pass)
|
| }else{
|
| setverdict(fail)
|
| }
|
| }
|
|
|
| testcase tc_EPTF_LGenBase_Test_listening2TimerEvents()
|
| runs on EPTF_LGenBase_ActionsPerCondition_CT{
|
| f_EPTF_LGenBase_init("listening2TimerEvents");
|
| v_dummyInt := f_EPTF_LGenBase_declareBehaviorType("b1", -1, null, null, null);
|
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("Entity_Tc_A", {"b1"});
|
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({name := "eg0", eType := "Entity_Tc_A", eCount := 5})
|
| v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior,{"setPass", refers( f_EPTF_LGenBase_Test_setPass )})
|
| const float c_delay := 0.3
|
| var integer
|
| v_fsm := f_EPTF_LGenBase_declareFSMTable(
|
| {
|
| name := c_EPTF_LGenBase_Test_fsmNameDelayed,
|
| fsmParams := {
|
| {stateList := {"idle", "busy"}},
|
| {timerList := {
|
| {"dummy1",c_delay},
|
| {"dummy2",c_delay},
|
| {"timer",c_delay}
|
| }}
|
| },
|
| table := {
|
| classicTable := {
|
| {eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
|
| cellRow := {
|
| {{{c_EPTF_LGenBase_stepName_timerStart, {timerName := "timer"}}}, omit, "busy"},
|
| {omit, omit, omit}
|
| }
|
| },
|
| {eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_stopTC,fsm},
|
| cellRow := {
|
| {{{c_EPTF_LGenBase_stepName_entityStopped, omit}}, omit, omit},
|
| {{
|
| {c_EPTF_LGenBase_stepName_timerCancel, {timerName := "timer"}},
|
| {c_EPTF_LGenBase_stepName_entityStopped, omit},
|
| {"setPass", omit}
|
| }, omit, "idle"}
|
| }
|
| },
|
| {eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_abortTC,fsm},
|
| cellRow := {
|
| {{{c_EPTF_LGenBase_stepName_entityAborted, omit}}, omit, omit},
|
| {{
|
| {c_EPTF_LGenBase_stepName_timerCancel, {timerName := "timer"}},
|
| {c_EPTF_LGenBase_stepName_entityAborted, omit},
|
| {"setPass", omit}
|
| }, omit, "idle"}
|
| }
|
| },
|
| {eventToListen := {c_EPTF_LGenBase_specialBName_timerTimeout,"timer",fsm},
|
| cellRow := {
|
| {omit, omit, omit},
|
| {{{"setPass", omit}}, omit, "idle"}
|
| }
|
| }
|
| }
|
| }
|
| })
|
|
|
|
|
| v_dummyInt := f_EPTF_LGenBase_activateFsm(0, v_fsm, 0, -1)
|
| f_EPTF_LGenBase_dispatchEvent(
|
| {{c_EPTF_LGenBase_bIdx, c_EPTF_LGenBase_inputIdx_testMgmt_startTC,
|
| {0,0}, omit}, {} })
|
| timer t_wait
|
| var float vl_wait := c_delay; // f_EPTF_LGenBase_getDuration4TimerAtFsmCtxByName is private
|
| t_wait.start(vl_wait+0.2)
|
| t_wait.timeout
|
| if(pass != getverdict){setverdict ( fail )}
|
| f_EPTF_Base_cleanup_CT();
|
| }
|
| //TODO 2 events in FSM: start/stop chrono
|
| //From the main task send 1st event-wait-2nd event-check chrono content
|
| testcase tc_EPTF_LGenBase_Test_chrono()
|
| runs on EPTF_LGenBase_Test_CT{
|
| f_EPTF_LGenBase_init("")
|
| const integer c_entities := 6
|
| const EPTF_StatMeasure_StatParams c_stat95Params := {
|
| percentile95 := {
|
| scale := {
|
| min := 0.0,
|
| max := int2float(c_entities/*-1*/)/10.0,
|
| n := c_entities+1,
|
| scale := linear}
|
| }
|
| }
|
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable(
|
| {
|
| name := "chronoFSM",
|
| fsmParams := {
|
| {stateList := {"idle"}}
|
| ,{varList := {
|
| {name := "vf_rtt", initValue := {floatVal := 0.0}, scope := TC}
|
| }}
|
| ,{statMeasWithParamsList := {
|
| {
|
| name := "chrono_rtt",
|
| providerVarName := "",
|
| targetVarName := "vf_95",
|
| statMeasParams := {
|
| statType := chrono},
|
| scope := FSM
|
| },
|
| {
|
| name := "p95_rtt",
|
| providerVarName := "vf_95",
|
| targetVarName := "",
|
| statMeasParams := {
|
| params := c_stat95Params
|
| },
|
| scope := TC
|
| }
|
| }}
|
| },
|
| table := {
|
| classicTable := {
|
| {eventToListen := { bName := "EPTF_CLL_LGenBase", iName := "LGenBase: Start_the_traffic_case!", eventType := fsm },
|
| cellRow := {
|
| //state==idle
|
| {actionList := omit,
|
| nextStateCalculation := omit,
|
| nextState := omit
|
| }
|
| }
|
| }
|
| }
|
| }//table
|
| }//fsm //XCAPget_DOT:}
|
| )
|
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable(
|
| {
|
| name := "XCAP_getFsm2",
|
| fsmParams := {
|
| {stateList := {"idle"}}
|
| ,{varList := {
|
| {name := "vf_rtt", initValue := {floatVal := 0.0}, scope := FSM}
|
| ,{name := "vf_95", initValue := {floatVal := 0.0}, scope := TC}
|
| ,{name := "vFSM2", initValue := {intVal := 2}, scope := FSM}
|
| }}
|
| ,{statMeasStatList := {
|
| {name := "mean_rtt", varName := "vf_95",statType := mean, scope := TC},
|
| {name := "p95", varName := "vf_95",statType := percentile95, scope := TC}
|
| }}
|
| ,{statHandlerStatList := {
|
| {name := "shTC2-1",
|
| providers := {
|
| {statMeas := "p95"}
|
| },
|
| statMethod := c_EPTF_StatHandler_Method_Percentile95,
|
| statResetValue := {floatVal := 0.0},
|
| scope := TC
|
| }
|
| ,{name := "shTC2-2",
|
| providers := {
|
| {varList := {"vf_rtt"}}
|
| },
|
| statMethod := c_EPTF_StatHandler_Method_Min,
|
| statResetValue := {floatVal := 1.0},
|
| scope := TC
|
| }
|
| ,{name := "shTC2-3",
|
| providers := {
|
| {varList := {"vf_95"}}
|
| },
|
| statMethod := c_EPTF_StatHandler_Method_Max,
|
| statResetValue := {floatVal := 2.0},
|
| scope := TC
|
| }
|
| }}
|
| },
|
| table := {
|
| classicTable := {
|
| {eventToListen := { bName := "EPTF_CLL_LGenBase", iName := "LGenBase: Start_the_traffic_case!", eventType := fsm },
|
| cellRow := {
|
| //state==idle
|
| {actionList := omit,
|
| nextStateCalculation := omit,
|
| nextState := omit
|
| }
|
| }
|
| }
|
| }
|
| }//table
|
| }//fsm //XCAPget_DOT:}
|
| )
|
| v_dummyInt := f_EPTF_LGenBase_declareBehaviorType("b1", -1, null, null, null);
|
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("Entity_Tc_A", {"b1"});
|
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({name := "eg0", eType := "Entity_Tc_A", eCount := 5})
|
| v_dummyInt := f_EPTF_LGenBase_declareTcType2({
|
| name := "TC_Delayed",
|
| fsmName := "XCAP_getFsm",
|
| entityType := "Entity_Tc_A",
|
| customEntitySucc := ""
|
| })
|
| v_dummyInt := f_EPTF_LGenBase_declareTcType2({
|
| name := "TC_Delayed2",
|
| fsmName := "XCAP_getFsm2",
|
| entityType := "Entity_Tc_A",
|
| customEntitySucc := ""
|
| })
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
|
| {
|
| name := "Scenario_Simple",
|
| tcList := {
|
| { tcName := "TC_Delayed",
|
| tcParamsList := {
|
| {target := {cpsToReach := 1111.0}}
|
| }},
|
| { tcName := "TC_Delayed2",
|
| tcParamsList := {{target := {cpsToReach := 1111.0}}}
|
| }
|
| },
|
| scParamsList := {}
|
| })
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0", "Scenario_Simple"},false)
|
| }
|
| group fsmVars4TCStatHandler{
|
| testcase tc_EPTF_LGenBase_Test_stat()
|
| runs on EPTF_LGenBase_Test_CT{
|
| f_EPTF_LGenBase_init("")
|
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable(
|
| {
|
| name := "statFSM",
|
| fsmParams := {
|
| {stateList := {"idle"}}
|
| ,{varList := {
|
| {name := "vf_providerFSMVar", initValue := {floatVal := 1.0}, scope := FSM}
|
| ,{name := "vf_providerTCVar", initValue := {floatVal := 1.0}, scope := TC}
|
| }}
|
| ,{statHandlerStatList := {
|
| {
|
| name := "shTC1",
|
| providers := {
|
| {varList := {"vf_providerFSMVar"}}
|
| },
|
| statMethod := c_EPTF_StatHandler_Method_Sum,
|
| statResetValue := {floatVal := 0.0},
|
| scope := TC
|
| }
|
| ,{
|
| name := "shTC2",
|
| providers := {
|
| {varList := {"vf_providerTCVar"}}
|
| },
|
| statMethod := c_EPTF_StatHandler_Method_Sum,
|
| statResetValue := {floatVal := 0.0},
|
| scope := TC
|
| }
|
| }}
|
| },
|
| table := {
|
| classicTable := {
|
| {eventToListen := { bName := "EPTF_CLL_LGenBase", iName := "LGenBase: Start_the_traffic_case!", eventType := fsm },
|
| cellRow := {
|
| //state==idle
|
| {actionList := omit,
|
| nextStateCalculation := omit,
|
| nextState := omit
|
| }
|
| }
|
| }
|
| }
|
| }//table
|
| }//fsm //XCAPget_DOT:}
|
| )
|
| const integer c_eCount := 5
|
| v_dummyInt := f_EPTF_LGenBase_declareBehaviorType("b1", -1, null, null, null);
|
| v_dummyInt := f_EPTF_LGenBase_declareEntityType("Entity_Tc_A", {"b1"});
|
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({name := "eg_base", eType := "Entity_Tc_A", eCount := 3})
|
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({name := "eg_base2", eType := "Entity_Tc_A", eCount := 7})
|
| v_dummyInt := f_EPTF_LGenBase_createEntityGroup({name := "eg0", eType := "Entity_Tc_A", eCount := c_eCount})
|
| v_dummyInt := f_EPTF_LGenBase_declareTcType2({
|
| name := "statTC",
|
| fsmName := "statFSM",
|
| entityType := "Entity_Tc_A",
|
| customEntitySucc := ""
|
| })
|
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
|
| {
|
| name := "Scenario_Simple",
|
| tcList := {
|
| { tcName := "statTC0",
|
| tcParamsList := {
|
| {tcTypeName := "statTC"},
|
| {target := {cpsToReach := 1111.0}}
|
| }
|
| },
|
| { tcName := "statTC",
|
| tcParamsList := {{target := {cpsToReach := 1111.0}}}
|
| }
|
| },
|
| scParamsList := {}
|
| })
|
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg0", "Scenario_Simple"},false)
|
| var integer vl_stat1 := f_EPTF_LGenBase_fsmVarIdOfTCStat("shTC1", 1)
|
| var integer vl_stat2 := f_EPTF_LGenBase_fsmVarIdOfTCStat("shTC2", 1)
|
| var EPTF_Var_DirectContent vl_content
|
| f_EPTF_Var_getContent(vl_stat1, vl_content)
|
| if(int2float(c_eCount) == vl_content.floatVal){
|
| setverdict(pass)
|
| }else{
|
| setverdict(fail)
|
| log(match(int2float(c_eCount),vl_content.floatVal))
|
| }
|
| f_EPTF_Var_getContent(vl_stat2, vl_content)
|
| if(1.0 == vl_content.floatVal){
|
| setverdict(pass)
|
| }else{
|
| setverdict(fail)
|
| log(match(1.0,vl_content.floatVal))
|
| }
|
| f_EPTF_Base_cleanup_CT()
|
| }
|
| }
|
|
|
| ///////////////////////////////////////////////////////////
|
| // control part
|
| ///////////////////////////////////////////////////////////
|
|
|
| control
|
| {
|
| execute(tc_EPTF_LGenBase_Test_declareStepAndFunction());
|
| //execute(tc_EPTF_LGenBase_Test_addRemoveListeners());
|
| execute(tc_EPTF_LGenBase_Test_activateListeners());
|
| execute(tc_EPTF_LGenBase_Test_entityCounts());
|
| execute(tc_EPTF_LGenBase_Test_entityCounts2());
|
| execute(tc_LGenBase_Test_externalTemplates());
|
| execute(tc_LGenBase_Test_externalTemplates_fixedPosition());
|
| execute(tc_LGenBase_Test_extendTemplateType())
|
| execute(tc_LGenBase_Test_configureTemplateSet());
|
| execute(tc_LGenBase_Test_fsmVariables());
|
| execute(tc_LGenBase_Test_fsmVariables2());
|
| execute(tc_EPTF_LGenBase_Test_registerPhases());
|
| execute(tc_LGenBase_Test_fsmEntityFinishSucc());
|
| execute(tc_LGenBase_Test_fsmEntityFinishSuccRandom())
|
| execute(tc_EPTF_LGenBase_Test_weightedScStart())
|
| execute(tc_EPTF_LGenBase_Test_weightedScStartTC())
|
| execute(tc_EPTF_LGenBase_Test_weightedScStartAuto())
|
| execute(tc_LGenBase_Test_rangeLoop())
|
| execute(tc_EPTF_LGenBase_Test_actionsPerConditionExecStart())
|
| execute(tc_EPTF_LGenBase_Test_actionsPerConditionNrOfSuccesses())
|
| execute(tc_EPTF_LGenBase_Test_actionsPerConditionNrOfFails())
|
| execute(tc_EPTF_LGenBase_Test_actionsPerConditionNrOfRangeLoop())
|
| execute(tc_EPTF_LGenBase_Test_actionsPerConditionEntitiesFinished())
|
| execute(tc_EPTF_LGenBase_Test_actionsPerConditionCustomFinish())
|
| execute(tc_EPTF_LGenBase_Test_actionsPerConditionExecTime())
|
| execute(tc_EPTF_LGenBase_Test_actionsPerConditionExecTime_TimeoutAfterFinish())
|
| execute(tc_EPTF_LGenBase_Test_actionsPerConditionCombined())
|
| execute(tc_LGenBase_Test_randomlySelectedEntities());
|
| execute(tc_EPTF_LGenBase_Test_actionsPerConditionEntitiesFinishedTimeout())
|
| execute(tc_EPTF_LGenBase_Test_actionsPerConditionEntitiesFinishedNofError())
|
| execute(tc_EPTF_LGenBase_Test_actionsPerConditionNrOfErrors())
|
| execute(tc_EPTF_LGenBase_Test_actionsPerConditionNrOfTimeouts())
|
| execute(tc_EPTF_LGenBase_Test_actionsPerConditionAvailableEntitiesFinished())
|
| execute(tc_LGenBase_Test_externalExecInternal())
|
| execute(tc_LGenBase_Test_externalExecOldInternal())
|
| execute(tc_LGenBase_Test_externalExecNewInternal())
|
| execute(tc_LGenBase_Test_externalExecOldExternal())
|
| execute(tc_LGenBase_Test_externalExecNewExternal())
|
| execute(tc_LGenBase_Test_listenToMultipleEvents())
|
| execute(tc_LGenBase_Test_fsmLogging())
|
| execute(tc_LGenBase_Test_testFinished())
|
| execute(tc_EPTF_LGenBase_Test_finishMaskExecStart())
|
| execute(tc_EPTF_LGenBase_Test_finishMaskNrOfSuccesses())
|
| execute(tc_EPTF_LGenBase_Test_finishMaskNrOfFails())
|
| execute(tc_EPTF_LGenBase_Test_finishMaskNrOfRangeLoop())
|
| execute(tc_EPTF_LGenBase_Test_finishMaskEntitiesFinished())
|
| execute(tc_EPTF_LGenBase_Test_finishMaskCustomFinish())
|
| execute(tc_EPTF_LGenBase_Test_finishMaskExecTime())
|
| execute(tc_EPTF_LGenBase_Test_finishMaskNrOfErrors())
|
| execute(tc_EPTF_LGenBase_Test_finishMaskNrOfTimeouts())
|
| execute(tc_EPTF_LGenBase_Test_finishMaskAvailableEntitiesFinished())
|
| execute(tc_LGenBase_Test_fsmVariables2Int())
|
| execute(tc_EPTF_LGenBase_Test_statCreate())
|
| execute(tc_EPTF_LGenBase_Test_execActionsAfterStop_stopNormalTC())
|
| execute(tc_EPTF_LGenBase_Test_startDelay())
|
| execute(tc_EPTF_LGenBase_Test_runningAfterEntitiesFinished())
|
| execute(tc_EPTF_LGenBase_Test_runningAfterEntitiesFinished2())
|
| // execute(tc_EPTF_LGenBase_Test_statList()) // commented - f_EPTF_LGenBase_getStatisticsOfTcs is private
|
| execute(tc_EPTF_LGenBase_Test_listening2TimerEvents())
|
| execute(tc_EPTF_LGenBase_Test_stat())
|
| }
|
|
|
| } // end of module
|