blob: 0b58414207b37b7a03fa5718878ae1833fddb12e [file] [log] [blame]
///////////////////////////////////////////////////////////////////////////////
// //
// Copyright (c) 2000-2017 Ericsson Telecom AB //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v2.0 //
// which accompanies this distribution, and is available at //
// https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html //
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
//
// Purpose:
// This module provides functions for testing R7 functionalities and bugfixes
// of LGenBase
//
// Module depends on:
// -
//
// Current Owner:
// László Skumát (ELSZSKU)
//
// Last Review Date:
// -
//
///////////////////////////////////////////////////////////////
module EPTF_LGenBase_Test_TestcasesR8
// [.objid{ itu_t(0) identified_organization(4) etsi(0)
// identified_organization(127) ericsson(5) testing(0)
// <put further nodes here if needed>}]
{
import from EPTF_CLL_Scheduler_Definitions all;
import from EPTF_CLL_LGenBaseStats_Definitions all;
import from EPTF_CLL_LGenBaseStats_Functions all;
import from EPTF_LGenBase_Test_Functions all;
import from EPTF_CLL_LGenBase_StepFunctions all;
import from EPTF_LGenBase_Test_Definitions all;
import from EPTF_CLL_Common_Definitions all;
import from EPTF_CLL_Variable_Functions all;
import from EPTF_CLL_LGenBase_Functions all;
import from EPTF_CLL_LGenBase_TrafficFunctions all;
import from EPTF_CLL_LGenBase_ConfigDefinitions all;
import from EPTF_CLL_LGenBase_ConfigFunctions all;
import from EPTF_LGenBase_Test_TestcasesR3 all;
import from EPTF_CLL_LGenBase_EventHandlingFunctions all;
import from EPTF_CLL_Base_Functions all;
import from EPTF_CLL_LGenBase_Definitions all;
import from EPTF_CLL_Variable_Definitions all;
import from EPTF_CLL_StatMeasure_Functions { function f_EPTF_StatMeasure_getStat_max };
import from EPTF_CLL_RBTScheduler_Functions all;
function f_LGenBase_Test_checkFSMVarOfDiff(in EPTF_LGenBase_TestStepArgs pl_ptr)
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_checkFSMVar(pl_ptr, "TCvarA", c_EPTF_LGenBase_fsmObjectScopeTC, 23.0, 4)
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_fsmVarDiffInitVal
//
// Purpose:
// This is a negative test case.
// Declares more than one FSM for a traffic case
// The FSMs have almost the same varList but with different initValues.
// A proper error message should appear.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_fsmVarDiffInitVal()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_fsmVariables_init()
f_EPTF_Base_setExpectedErrorMsg("*FSM variable*TCvarA*"
&c_LGenBase_Test_fsmVariablesFSMName&"v2*is already defined*"
&c_LGenBase_Test_fsmVariablesFSMName&"v1*")
v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input5");
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmVariablesFSM);
v_dummyInt := f_EPTF_LGenBase_declareFunction("checkFSMVarDiff", {testStepFunction:= refers(f_LGenBase_Test_checkFSMVarOfDiff)})
v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"checkVarEqual",refers( f_EPTF_LGenBase_checkVarEqual)})
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmVariablesFSMDiff :=
{
name := c_LGenBase_Test_fsmVariablesFSMName&"v1",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "TCvarA",
initValue := {floatVal := 23.0},
scope := TC
},
{
name := "TCvarA2",
initValue := {floatVal := 21.0},
scope := TC
},
{
name := "TCvar2ofFSM1",
initValue := {floatVal := 2.0},
scope := TC
}
}
}
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{{"checkFSMVarDiff",{varNames := {"TCvarA"}}}}, omit, omit}
}
},
{eventToListen := {"b1","input2",fsm},
cellRow := {
//state[0]==idle
{{{"checkVarEqual",{varParams := {"TCvar2ofFSM1",{floatVal := 2.0}}}}}, omit, omit}
}
},
{eventToListen := {"b1","input3",fsm},
cellRow := {
//state[0]==idle
{{{"checkVarEqual",{varParams := {"TCvar2ofFSM1",{floatVal := 9.5}}}}}, omit, omit}
}
}
}
}
}
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmVariablesFSMDiff2 :=
{
name := c_LGenBase_Test_fsmVariablesFSMName&"v2",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "TCvarA",
initValue := {floatVal := 2.0},
scope := TC
},
{
name := "TCvarA2",
initValue := {floatVal := 21.0},
scope := TC
},
{
name := "TCvar2ofFSM1",
initValue := {floatVal := 2.0},
scope := TC
}
}
}
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{{"checkFSMVarDiff",{varNames := {"TCvarA"}}}}, omit, omit}
}
},
{eventToListen := {"b1","input2",fsm},
cellRow := {
//state[0]==idle
{{{"checkVarEqual",{varParams := {"TCvar2ofFSM1",{floatVal := 2.0}}}}}, omit, omit}
}
},
{eventToListen := {"b1","input3",fsm},
cellRow := {
//state[0]==idle
{{{"checkVarEqual",{varParams := {"TCvar2ofFSM1",{floatVal := 9.5}}}}}, omit, omit}
}
}
}
}
}
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmVariablesFSMDiff);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmVariablesFSMDiff2);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{
c_LGenBase_Test_fsmVariablesFSMName&"v1",
c_LGenBase_Test_fsmVariablesFSMName&"v2"
}
}
}
},
{"TC2",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{
c_LGenBase_Test_fsmVariablesFSMName&"v1",
c_LGenBase_Test_fsmVariablesFSMName&"v2"
}
}
}
}
},
{}
})
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false)
f_EPTF_Base_cleanup_CT();
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_fsmVarTcScope
//
// Purpose:
// Declares more than one FSM for a traffic case
// It checks if a variable with TC scope is shared between the FSMs of the TC.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_fsmVarTcScope()
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);
v_dummyInt := f_EPTF_LGenBase_declareFunction("checkFSMVarDiff", {testStepFunction:= refers(f_LGenBase_Test_checkFSMVarOfDiff)})
v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"checkVarEqual",refers( f_EPTF_LGenBase_checkVarEqual)})
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmVariablesFSMDiff :=
{
name := c_LGenBase_Test_fsmVariablesFSMName&"v1",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "TCvarA",
initValue := {floatVal := 23.0},
scope := TC
},
{
name := "TCvarA2",
initValue := {floatVal := 21.0},
scope := TC
},
{
name := "TCvar2ofFSM1",
initValue := {floatVal := 2.0},
scope := TC
}
}
}
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{{"checkVarEqual",{varParams := {"TCvarA",{floatVal := 24.0}}}}}, omit, omit}
}
}
}
}
}
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmVariablesFSMDiff2 :=
{
name := c_LGenBase_Test_fsmVariablesFSMName&"v2",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "TCvarA",
initValue := {floatVal := 23.0},
scope := 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 := {"TCvarA",{floatVal := 1.0}}}},
{c_EPTF_LGenBase_stepName_dispatchEventToSibling,{
eventToSibling := {c_LGenBase_Test_fsmVariablesFSMName&"v1","b1","input1",omit}}
}
}, omit, omit}
}
}
}
}
}
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmVariablesFSMDiff);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmVariablesFSMDiff2);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{
c_LGenBase_Test_fsmVariablesFSMName&"v1",
c_LGenBase_Test_fsmVariablesFSMName&"v2"
}
}
}
},
{"TC2",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{
c_LGenBase_Test_fsmVariablesFSMName&"v1",
c_LGenBase_Test_fsmVariablesFSMName&"v2"
}
}
}
}
},
{}
})
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false)
var EPTF_LGenBase_ReportedEventDescriptor vl_trigger := c_EPTF_LGenBase_emptyReportedEventDescriptor
vl_trigger.event.bIdx := c_EPTF_LGenBase_bIdx
vl_trigger.event.iIdx := c_EPTF_LGenBase_inputIdx_testMgmt_startTC
vl_trigger.event.target.eIdx := 1
vl_trigger.event.target.fsmCtxIdx := 1
f_EPTF_LGenBase_dispatchEvent(vl_trigger)
f_EPTF_Base_cleanup_CT();
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_fsmVarFsmScope
//
// Purpose:
// Declares more than one FSM for a traffic case
// These FSMs are declaring the "same" variable with FSM scope.
// These two variables need to be handled separately.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_fsmVarFsmScope()
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);
v_dummyInt := f_EPTF_LGenBase_declareFunction("checkFSMVarDiff", {testStepFunction:= refers(f_LGenBase_Test_checkFSMVarOfDiff)})
v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"checkVarEqual",refers( f_EPTF_LGenBase_checkVarEqual)})
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmVariablesFSMDiff :=
{
name := c_LGenBase_Test_fsmVariablesFSMName&"v1",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "TCvarA",
initValue := {floatVal := 23.0},
scope := FSM
}
}
}
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{{"checkVarEqual",{varParams := {"TCvarA",{floatVal := 23.0}}}}}, omit, omit}
}
}
}
}
}
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmVariablesFSMDiff2 :=
{
name := c_LGenBase_Test_fsmVariablesFSMName&"v2",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "TCvarA",
initValue := {floatVal := 23.0},
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 := {"TCvarA",{floatVal := 1.0}}}},
{c_EPTF_LGenBase_stepName_dispatchEventToSibling,{
eventToSibling := {c_LGenBase_Test_fsmVariablesFSMName&"v1","b1","input1",omit}}
}
}, omit, omit}
}
}
}
}
}
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmVariablesFSMDiff);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmVariablesFSMDiff2);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{
c_LGenBase_Test_fsmVariablesFSMName&"v1",
c_LGenBase_Test_fsmVariablesFSMName&"v2"
}
}
}
},
{"TC2",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{
c_LGenBase_Test_fsmVariablesFSMName&"v1",
c_LGenBase_Test_fsmVariablesFSMName&"v2"
}
}
}
}
},
{}
})
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false)
var EPTF_LGenBase_ReportedEventDescriptor vl_trigger := c_EPTF_LGenBase_emptyReportedEventDescriptor
vl_trigger.event.bIdx := c_EPTF_LGenBase_bIdx
vl_trigger.event.iIdx := c_EPTF_LGenBase_inputIdx_testMgmt_startTC
vl_trigger.event.target.eIdx := 1
vl_trigger.event.target.fsmCtxIdx := 1
f_EPTF_LGenBase_dispatchEvent(vl_trigger)
f_EPTF_Base_cleanup_CT();
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_fsmVarDiffType
//
// Purpose:
// This is a negative test case.
// Declares more than one FSM for a traffic case
// The FSMs have almost the same varList but with different types.
// A proper error message should appear.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_fsmVarDiffType()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_fsmVariables_init()
f_EPTF_Base_setExpectedErrorMsg("*FSM variable*TCvarA2*"
&c_LGenBase_Test_fsmVariablesFSMName&"v2*is already defined*"
&c_LGenBase_Test_fsmVariablesFSMName&"v1*")
v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input5");
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmVariablesFSM);
v_dummyInt := f_EPTF_LGenBase_declareFunction("checkFSMVarDiff", {testStepFunction:= refers(f_LGenBase_Test_checkFSMVarOfDiff)})
v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"checkVarEqual",refers( f_EPTF_LGenBase_checkVarEqual)})
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmVariablesFSMDiff :=
{
name := c_LGenBase_Test_fsmVariablesFSMName&"v1",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "TCvarA",
initValue := {floatVal := 23.0},
scope := TC
},
{
name := "TCvarA2",
initValue := {intVal := 21},
scope := TC
},
{
name := "TCvar2ofFSM1",
initValue := {floatVal := 2.0},
scope := TC
}
}
}
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{{"checkFSMVarDiff",{varNames := {"TCvarA"}}}}, omit, omit}
}
},
{eventToListen := {"b1","input2",fsm},
cellRow := {
//state[0]==idle
{{{"checkVarEqual",{varParams := {"TCvar2ofFSM1",{floatVal := 2.0}}}}}, omit, omit}
}
},
{eventToListen := {"b1","input3",fsm},
cellRow := {
//state[0]==idle
{{{"checkVarEqual",{varParams := {"TCvar2ofFSM1",{floatVal := 9.5}}}}}, omit, omit}
}
}
}
}
}
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmVariablesFSMDiff2 :=
{
name := c_LGenBase_Test_fsmVariablesFSMName&"v2",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "TCvarA",
initValue := {floatVal := 23.0},
scope := TC
},
{
name := "TCvarA2",
initValue := {floatVal := 21.0},
scope := TC
},
{
name := "TCvar2ofFSM1",
initValue := {floatVal := 2.0},
scope := TC
}
}
}
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{{"checkFSMVarDiff",{varNames := {"TCvarA"}}}}, omit, omit}
}
},
{eventToListen := {"b1","input2",fsm},
cellRow := {
//state[0]==idle
{{{"checkVarEqual",{varParams := {"TCvar2ofFSM1",{floatVal := 2.0}}}}}, omit, omit}
}
},
{eventToListen := {"b1","input3",fsm},
cellRow := {
//state[0]==idle
{{{"checkVarEqual",{varParams := {"TCvar2ofFSM1",{floatVal := 9.5}}}}}, omit, omit}
}
}
}
}
}
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmVariablesFSMDiff);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmVariablesFSMDiff2);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{
c_LGenBase_Test_fsmVariablesFSMName&"v1",
c_LGenBase_Test_fsmVariablesFSMName&"v2"
}
}
}
},
{"TC2",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{
c_LGenBase_Test_fsmVariablesFSMName&"v1",
c_LGenBase_Test_fsmVariablesFSMName&"v2"
}
}
}
}
},
{}
})
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false)
f_EPTF_Base_cleanup_CT();
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_fsmVariablesFSMList
//
// Purpose:
// Declares more than one FSM for a traffic case
// Runs the <tc_LGenBase_Test_fsmVariables> for
// all the sibling FSMs of a traffic case.
// Tests also if the varID of the FSM scope variables
// in the sibling FSMs are the same
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_fsmVariablesFSMList()
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);
v_dummyInt := f_EPTF_LGenBase_declareFunction("checkFSMVarDiff", {testStepFunction:= refers(f_LGenBase_Test_checkFSMVarOfDiff)})
v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"checkVarEqual",refers( f_EPTF_LGenBase_checkVarEqual)})
var EPTF_LGenBase_FsmTableDeclarator vl_fsm := c_LGenBase_Test_fsmVariablesFSM
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmVariablesFSMDiff :=
{
name := c_LGenBase_Test_fsmVariablesFSMName&"Diff",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "FSMvar1",
initValue := {floatVal := 21.0},
scope := FSM
},
{
name := "TCvarA",
initValue := {floatVal := 23.0},
scope := TC
},
{
name := "TCvarA2",
initValue := {floatVal := 21.0},
scope := TC
},
{
name := "TCvar2ofFSM1",
initValue := {floatVal := 2.0},
scope := TC
}
}
},
{statMeasWithParamsList := {
{
name := "minTCVarA",
providerVarName := "TCvarA",
targetVarName := "",
statMeasParams := {
statType := min},
scope := TC
}
}
}
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{{"checkFSMVarDiff",{varNames := {"TCvarA"}}}}, omit, omit}
}
},
{eventToListen := {"b1","input2",fsm},
cellRow := {
//state[0]==idle
{{{"checkVarEqual",{varParams := {"TCvar2ofFSM1",{floatVal := 2.0}}}}}, omit, omit}
}
},
{eventToListen := {"b1","input3",fsm},
cellRow := {
//state[0]==idle
{{{"checkVarEqual",{varParams := {"TCvar2ofFSM1",{floatVal := 9.5}}}}}, omit, omit}
}
}
}
}
}
vl_fsm.name := c_LGenBase_Test_fsmVariablesFSMName&"2"
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(vl_fsm);
vl_fsm.name := c_LGenBase_Test_fsmVariablesFSMName&"3"
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(vl_fsm);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmVariablesFSMDiff);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{
c_LGenBase_Test_fsmVariablesFSMName,
c_LGenBase_Test_fsmVariablesFSMName&"2",
c_LGenBase_Test_fsmVariablesFSMName&"Diff",
c_LGenBase_Test_fsmVariablesFSMName&"3"
}
}
}
},
{"TC2",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{
c_LGenBase_Test_fsmVariablesFSMName,
c_LGenBase_Test_fsmVariablesFSMName&"2",
c_LGenBase_Test_fsmVariablesFSMName&"3"
}
}
}
}
},
{}
})
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false)
action("FSM#0")
f_LGenBase_Test_fsmVariablesCheck()
action("FSM#1")
f_LGenBase_Test_fsmVariablesCheck(1)
action("FSM#1")
f_LGenBase_Test_fsmVariablesCheck(3)
f_EPTF_LGenBase_dispatchEvent({
{v_LGenBase_VarAndStatTest_behav,0,{1,2},omit},
{}
})
if(not isvalue(v_LGenBase_VarAndStatTest_stepsPassed[4])){
setverdict(inconc,"Checking the TC variable of the different FSM has not been called.")
}
//Check if the content of TCvar2ofFSM1 in FSM#2 is 2.0
f_EPTF_LGenBase_dispatchEvent({
{v_LGenBase_VarAndStatTest_behav,1,{1,2},omit},
{}
})
//Set the content of TCvar2ofFSM1 to 9.5 in FSM#1
f_EPTF_LGenBase_dispatchEvent({
{v_LGenBase_VarAndStatTest_behav,4,{1,1},omit},
{}
})
//Check if the content of TCvar2ofFSM1 in FSM#2 is 9.5
f_EPTF_LGenBase_dispatchEvent({
{v_LGenBase_VarAndStatTest_behav,2,{1,2},omit},
{}
})
f_EPTF_Base_cleanup_CT();
}
function f_LGenBase_Test_declareFsmWithVariables(
in charstring pl_fsmName,
in EPTF_LGenBase_FsmVarDeclaratorList pl_vars)
runs on EPTF_LGenBase_VarAndStatTest_CT
{
var EPTF_LGenBase_FsmTableDeclarator vl_fsm :=
{
name := pl_fsmName,
fsmParams := {
{stateList := {"idle"}},
{varList := pl_vars}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{omit, omit, omit}
}
}
}
}
}
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(vl_fsm);
}
function f_LGenBase_Test_Neg_siblingFsmVariables(
in charstring pl_expectedErrMsg,
in EPTF_LGenBase_FsmVarDeclaratorList pl_varsOfFsm1,
in EPTF_LGenBase_FsmVarDeclaratorList pl_varsOfFsm2)
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_fsmVariables_init(3, "siblingFsmVariables");
f_EPTF_Base_setExpectedErrorMsg(pl_expectedErrMsg);
f_LGenBase_Test_declareFsmWithVariables("FSM1", pl_varsOfFsm1);
f_LGenBase_Test_declareFsmWithVariables("FSM2", pl_varsOfFsm2);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{"SC1",
{
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList := {"FSM1", "FSM2"}}
}
}
},
{}
});
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false)
f_EPTF_Base_cleanup_CT();
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_siblingFsmVariables_differentInitValue
//
// Purpose:
// This is a negative test case.
// Declares two sibling FSMs with the same variable name but different init value.
// A proper error message should appear.
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_siblingFsmVariables_differentInitValue()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_Neg_siblingFsmVariables(
"*VarA*already defined*different initial value*",
{{name := "VarA", initValue := {floatVal := 23.0}, scope := SiblingFSM}},
{{name := "VarA", initValue := {floatVal := 13.0}, scope := SiblingFSM}});
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_siblingFsmVariables_differentType
//
// Purpose:
// This is a negative test case.
// Declares two sibling FSMs with the same variable name but different type.
// A proper error message should appear.
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_siblingFsmVariables_differentType()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_Neg_siblingFsmVariables(
"*VarA*FSM2*already defined*FSM1*different initial value*",
{{name := "VarA", initValue := {floatVal := 23.0}, scope := SiblingFSM}},
{{name := "VarA", initValue := {intVal := 23}, scope := SiblingFSM}});
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_siblingFsmVariables_differentScope1
//
// Purpose:
// This is a negative test case.
// Declares two sibling FSMs with the same variable name but different scope (SiblingFSM, FSM).
// A proper error message should appear.
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_siblingFsmVariables_differentScope1()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_Neg_siblingFsmVariables(
"*scope*", // FIXME
{{name := "VarA", initValue := {floatVal := 23.0}, scope := SiblingFSM}},
{{name := "VarA", initValue := {floatVal := 23.0}, scope := FSM}});
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_siblingFsmVariables_differentScope1
//
// Purpose:
// This is a negative test case.
// Declares two sibling FSMs with the same variable name but different scope (SiblingFSM, TC).
// A proper error message should appear.
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_siblingFsmVariables_differentScope2()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_Neg_siblingFsmVariables(
"*scope*", // FIXME
{{name := "VarA", initValue := {floatVal := 23.0}, scope := SiblingFSM}},
{{name := "VarA", initValue := {floatVal := 23.0}, scope := TC}});
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_siblingFsmVariables_differentScope3
//
// Purpose:
// This is a negative test case.
// Declares two sibling FSMs with the same variable name but different scope (FSM, TC).
// A proper error message should appear.
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_siblingFsmVariables_differentScope3()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_Neg_siblingFsmVariables(
"*scope*", // FIXME
{{name := "VarA", initValue := {floatVal := 23.0}, scope := FSM}},
{{name := "VarA", initValue := {floatVal := 23.0}, scope := TC}});
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_siblingFsmVariables_differentScope4
//
// Purpose:
// This is a negative test case.
// Declares two sibling FSMs with the same variable name but different scope (FSM, SiblingFSM).
// A proper error message should appear.
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_siblingFsmVariables_differentScope4()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_Neg_siblingFsmVariables(
"*scope*", // FIXME
{{name := "VarA", initValue := {floatVal := 23.0}, scope := FSM}},
{{name := "VarA", initValue := {floatVal := 23.0}, scope := SiblingFSM}});
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_siblingFsmVariables_differentScope5
//
// Purpose:
// This is a negative test case.
// Declares two sibling FSMs with the same variable name but different scope (TC, SiblingFSM).
// A proper error message should appear.
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_siblingFsmVariables_differentScope5()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_Neg_siblingFsmVariables(
"*scope*", // FIXME
{{name := "VarA", initValue := {floatVal := 23.0}, scope := TC}},
{{name := "VarA", initValue := {floatVal := 23.0}, scope := SiblingFSM}});
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_siblingFsmVariables_differentScope6
//
// Purpose:
// This is a negative test case.
// Declares two sibling FSMs with the same variable name but different scope (TC, FSM).
// A proper error message should appear.
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_siblingFsmVariables_differentScope6()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_Neg_siblingFsmVariables(
"*scope*", // FIXME
{{name := "VarA", initValue := {floatVal := 23.0}, scope := TC}},
{{name := "VarA", initValue := {floatVal := 23.0}, scope := FSM}});
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_siblingFsmVariables_redefinition
//
// Purpose:
// This is a negative test case.
// Declares two sibling FSMs with the one of the FSMs having a redefinition of its variable.
// A proper error message should appear.
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_siblingFsmVariables_redefinition()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_Neg_siblingFsmVariables(
"*VarA*already defined*",
{{name := "VarA", initValue := {floatVal := 23.0}, scope := SiblingFSM},
{name := "VarA", initValue := {floatVal := 23.0}, scope := SiblingFSM}},
{{name := "VarB", initValue := {floatVal := 33.0}, scope := SiblingFSM}});
}
group varAndStatWithSiblings{
function f_LGenBase_Test_checkVarId(in EPTF_LGenBase_TestStepArgs pl_ptr)
runs on EPTF_LGenBase_VarAndStatTest_CT
{
var integer vl_varId := pl_ptr.stepArgs[0];
var integer vl_varIdFromStep := f_EPTF_LGenBase_fsmVarIdFromStep(pl_ptr);
if (vl_varIdFromStep != vl_varId) {
setverdict(fail,%definitionId&": ", match(vl_varIdFromStep,vl_varId));
f_EPTF_Base_stopAll(none);
}
}
function f_LGenBase_Test_checkStatMeasId(in EPTF_LGenBase_TestStepArgs pl_ptr)
runs on EPTF_LGenBase_VarAndStatTest_CT
{
var integer vl_statId := pl_ptr.stepArgs[0];
var integer vl_statIdFromStep := f_EPTF_LGenBase_fsmStatMeasIdFromStep(pl_ptr);
if (vl_statIdFromStep != vl_statId) {
setverdict(fail,%definitionId&": ", match(vl_statIdFromStep,vl_statId));
f_EPTF_Base_stopAll(none);
}
}
function f_LGenBase_Test_checkStatHandlerId(in EPTF_LGenBase_TestStepArgs pl_ptr)
runs on tc_LGenBase_Test_VarAndStatWithSiblings_CT
{
var charstring vl_statName := f_EPTF_LGenBase_fsmStatisticNameOfStep(pl_ptr);
if (v_VarAndStatWithSiblings_expectedStatName != vl_statName) {
setverdict(fail,%definitionId&": ", match(v_VarAndStatWithSiblings_expectedStatName,vl_statName));
f_EPTF_Base_stopAll(none);
}
}
const integer c_eBase := 10;
const EPTF_CharstringList c_VarAndStatWithSiblings_inputs := {
""
}
type component tc_LGenBase_Test_VarAndStatWithSiblings_CT extends EPTF_LGenBase_VarAndStatTest_CT{
var integer v_VarAndStatWithSiblings_TC1Id := -1;
var integer v_VarAndStatWithSiblings_TC2Id := -1;
var EPTF_IntegerList v_VarAndStatWithSiblings_inputIds := {};
var integer v_VarAndStatWithSiblings_fsmCtxOfSibling2InTC1 := -1;
var integer v_VarAndStatWithSiblings_fsmCtxOfSibling1InTC2 := -1;
var integer v_VarAndStatWithSiblings_fsmCtxOfSibling4InTC2 := -1;
var integer v_VarAndStatWithSiblings_fsmCtxOfE2Sibling4InTC2 := -1;
var charstring v_VarAndStatWithSiblings_expectedStatName := "";
}
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_fsmTCStatsForSiblingFSMs
//
// Purpose:
// TODO : copy paste from fsmVariablesFSMList
// Declares more than one FSM for a traffic case
// Runs the <tc_LGenBase_Test_fsmVariables> for
// all the sibling FSMs of a traffic case.
// Tests also if the varID of the FSM scope variables
// in the sibling FSMs are the same
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_fsmTCStatsForSiblingFSMs()
runs on tc_LGenBase_Test_VarAndStatWithSiblings_CT{
f_LGenBase_Test_fsmVariables_init(pl_firstGroupSize := c_eBase)
v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input5");
var integer vl_checkStatMeasIdEventId := f_EPTF_LGenBase_declareFsmEvent("b1","checkStatMeasId");
var integer vl_checkStatHandlerNameEventId := f_EPTF_LGenBase_declareFsmEvent("b1","checkStatHandlerNameEventId");
var integer vl_checkStatHandlerNameEventId2 := f_EPTF_LGenBase_declareFsmEvent("b1","checkStatHandlerNameEventId2");
var integer vl_checkStatMeasIdEventId4 := f_EPTF_LGenBase_declareFsmEvent("b1","checkStatMeasId4");
var integer vl_checkVarId := f_EPTF_LGenBase_declareFsmEvent("b1","checkVarId");
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmVariablesFSM);
v_dummyInt := f_EPTF_LGenBase_declareFunction("checkFSMVarDiff", {testStepFunction:= refers(f_LGenBase_Test_checkFSMVarOfDiff)})
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, {"checkStatMeasId",refers( f_LGenBase_Test_checkStatMeasId)})
v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"checkVarId",refers( f_LGenBase_Test_checkVarId)})
v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"checkStatHandlerNameEventId",refers( f_LGenBase_Test_checkStatHandlerId)})
var EPTF_LGenBase_FsmTableDeclarator vl_fsm := c_LGenBase_Test_fsmVariablesFSM
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmVariablesFSMDummy :=
{
name := "DummyFSM",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "FSMvarDummyFSM0",
initValue := {floatVal := 21.0},
scope := FSM
},
{
name := "FSMvarDummyTC0",
initValue := {floatVal := 21.0},
scope := TC
},
{
name := "FSMvarDummySibling0",
initValue := {floatVal := 21.0},
scope := SiblingFSM
},
{
name := "FSMvarDummyFSM",
initValue := {floatVal := 21.0},
scope := FSM
},
{
name := "FSMvarDummyTC",
initValue := {floatVal := 21.0},
scope := TC
},
{
name := "FSMvarDummySibling",
initValue := {floatVal := 21.0},
scope := SiblingFSM
}
}
},
{statMeasWithParamsList := {
{
name := "minFSMvarDummyTC0",
providerVarName := "FSMvarDummyTC0",
targetVarName := "",
statMeasParams := {
statType := min},
scope := TC
},
{
name := "maxFSMvarDummySibling0",
providerVarName := "FSMvarDummySibling0",
targetVarName := "",
statMeasParams := {
statType := max},
scope := SiblingFSM
},
{
name := "maxFSMvarDummyFSM0",
providerVarName := "FSMvarDummyFSM0",
targetVarName := "",
statMeasParams := {
statType := max},
scope := FSM
}
}
}
},
table := {classicTable := {}}
}
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmVariablesFSMDiff :=
{
name := c_LGenBase_Test_fsmVariablesFSMName&"Diff",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "FSMvar1",
initValue := {floatVal := 21.0},
scope := FSM
},
{
name := "FSMvarDummyTC",
initValue := {floatVal := 21.0},
scope := TC
},
{
name := "FSMvarDummySibling",
initValue := {floatVal := 21.0},
scope := SiblingFSM
},
{
name := "TCvarA",
initValue := {floatVal := 23.0},
scope := TC
},
{
name := "TCvarSibling",
initValue := {intVal := 2},
scope := SiblingFSM
},
{
name := "TCvarA2",
initValue := {floatVal := 21.0},
scope := TC
},
{
name := "TCvar2ofFSM1",
initValue := {floatVal := 2.0},
scope := TC
}
}
},
{statMeasWithParamsList := {
{
name := "minTCVarA",
providerVarName := "TCvarA",
targetVarName := "",
statMeasParams := {
statType := min},
scope := TC
},
{
name := "minFSMVar1",
providerVarName := "FSMvar1",
targetVarName := "",
statMeasParams := {
statType := min},
scope := FSM
},
{
name := "minVarSibling",
providerVarName := "TCvarSibling",
targetVarName := "",
statMeasParams := {
statType := min},
scope := SiblingFSM
},
{
name := "maxTCVarA2",
providerVarName := "TCvarA2",
targetVarName := "",
statMeasParams := {
statType := max},
scope := TC
}
}
},
{statHandlerStatList := {
{
name := "shFSM",
providers := {
//{varList := {"FSMvar1"}}
},
statMethod := "Sum",
statResetValue := {floatVal := 0.0},
scope := FSM
},
{
name := "shSibling",
providers := {
//{varList := {"TCvarSibling"}}
},
statMethod := "Sum",
statResetValue := {intVal := 0},
scope := SiblingFSM
},
{
name := "shTC",
providers := {
//{varList := {"TCvarA"}}
},
statMethod := "Sum",
statResetValue := {floatVal := 0.0},
scope := TC
}
}}
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{{"checkFSMVarDiff",{varNames := {"TCvarA"}}}}, omit, omit}
}
},
{eventToListen := {"b1","input2",fsm},
cellRow := {
//state[0]==idle
{{{"checkVarEqual",{varParams := {"TCvar2ofFSM1",{floatVal := 2.0}}}}}, omit, omit}
}
},
{eventToListen := {"b1","input3",fsm},
cellRow := {
//state[0]==idle
{{{"checkVarEqual",{varParams := {"TCvar2ofFSM1",{floatVal := 9.5}}}}}, omit, omit}
}
},
{eventToListen := {"b1","checkStatMeasId",fsm},
cellRow := {
//state[0]==idle
{{{"checkStatMeasId",{statMeasParams := {"minTCVarA",omit}}}}, omit, omit}
}
},
{eventToListen := {"b1","checkStatHandlerNameEventId",fsm},
cellRow := {
//state[0]==idle
{{{"checkStatHandlerNameEventId",{statName := "shTC"}}}, omit, omit}
}
},
{eventToListen := {"b1","checkStatHandlerNameEventId2",fsm},
cellRow := {
//state[0]==idle
{{{"checkStatHandlerNameEventId",{statName := "shSibling"}}}, omit, omit}
}
},
{eventToListen := {"b1","checkStatMeasId4",fsm},
cellRow := {
//state[0]==idle
{{{"checkStatMeasId",{statMeasParams := {"minVarSibling",omit}}}}, omit, omit}
}
},
{eventToListen := {"b1","checkVarId",fsm},
cellRow := {
//state[0]==idle
{{{"checkVarId",{varParams := {"TCvarSibling",omit}}}}, omit, omit}
}
}
}
}
}
// define sibling FSM with different stats, an contains same stat also:
var EPTF_LGenBase_FsmTableDeclarator vl_LGenBase_Test_fsmVariablesFSMDiff2 := c_LGenBase_Test_fsmVariablesFSMDiff
vl_LGenBase_Test_fsmVariablesFSMDiff2.name := c_LGenBase_Test_fsmVariablesFSMDiff.name&"2";
vl_LGenBase_Test_fsmVariablesFSMDiff2.fsmParams[2].statMeasWithParamsList[sizeof(vl_LGenBase_Test_fsmVariablesFSMDiff2.fsmParams[2].statMeasWithParamsList)]
:= vl_LGenBase_Test_fsmVariablesFSMDiff2.fsmParams[2].statMeasWithParamsList[0];
vl_LGenBase_Test_fsmVariablesFSMDiff2.fsmParams[2].statMeasWithParamsList[0].name := "maxTCVarA"
vl_LGenBase_Test_fsmVariablesFSMDiff2.fsmParams[2].statMeasWithParamsList[0].statMeasParams.statType := max;
vl_fsm.name := c_LGenBase_Test_fsmVariablesFSMName&"2"
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(vl_fsm);
vl_fsm.name := c_LGenBase_Test_fsmVariablesFSMName&"3"
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmVariablesFSMDummy);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(vl_fsm);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmVariablesFSMDiff);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(vl_LGenBase_Test_fsmVariablesFSMDiff2);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{
c_LGenBase_Test_fsmVariablesFSMName,
c_LGenBase_Test_fsmVariablesFSMName&"2",
c_LGenBase_Test_fsmVariablesFSMName&"Diff",
c_LGenBase_Test_fsmVariablesFSMName&"3"
}
}
}
},
{"TC2",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{
"DummyFSM",
c_LGenBase_Test_fsmVariablesFSMName,
c_LGenBase_Test_fsmVariablesFSMName&"Diff",
c_LGenBase_Test_fsmVariablesFSMName&"2",
c_LGenBase_Test_fsmVariablesFSMName&"3",
vl_LGenBase_Test_fsmVariablesFSMDiff2.name
}
}
}
}
},
{}
})
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false)
//Fill data
//Traffic case indexes
v_VarAndStatWithSiblings_TC1Id := f_EPTF_LGenBase_trafficCaseId("eg1","SC1","TC1");
v_VarAndStatWithSiblings_TC2Id := f_EPTF_LGenBase_trafficCaseId("eg1","SC1","TC2");
//FSM ctx indexes
v_VarAndStatWithSiblings_fsmCtxOfSibling2InTC1 :=
f_EPTF_LGenBase_fsmCtxIdxOfSiblingInTc(1, pl_tcIdx:=v_VarAndStatWithSiblings_TC1Id, pl_siblingIdx:=3)
v_VarAndStatWithSiblings_fsmCtxOfSibling1InTC2 :=
f_EPTF_LGenBase_fsmCtxIdxOfSiblingInTc(1, pl_tcIdx:=v_VarAndStatWithSiblings_TC2Id, pl_siblingIdx:=2)
v_VarAndStatWithSiblings_fsmCtxOfSibling4InTC2 :=
f_EPTF_LGenBase_fsmCtxIdxOfSiblingInTc(1, pl_tcIdx:=v_VarAndStatWithSiblings_TC2Id, pl_siblingIdx:=5)
v_VarAndStatWithSiblings_fsmCtxOfE2Sibling4InTC2 :=
f_EPTF_LGenBase_fsmCtxIdxOfSiblingInTc(2, pl_tcIdx:=v_VarAndStatWithSiblings_TC2Id, pl_siblingIdx:=5)
{//Variable test
//Checks the following:
//Are the FSM variable contents equal with the declared initial contents at the beginning?
//Are the FSM variables different in different entities?
f_LGenBase_Test_fsmVariablesCheck(pl_eOffset := c_eBase)
f_LGenBase_Test_fsmVariablesCheck(1, pl_eOffset := c_eBase)
f_LGenBase_Test_fsmVariablesCheck(3, pl_eOffset := c_eBase)
//Sibling scope variables
// check if varID of stats in siblings are the same for different entities in the TC (TC1):
//Gets the varIds in different FSMs having the same FSM type
// In the first TC
var charstring vl_varName := f_EPTF_LGenBase_varNameOfSiblingFSMsVar(pl_tcIdx := v_VarAndStatWithSiblings_TC1Id, pl_eRelIdx:=1, pl_varName := "TCvarSibling")
var integer vl_varIdInTC1 := f_EPTF_Var_getId(vl_varName);
// In entity#1 of TC2
vl_varName := f_EPTF_LGenBase_varNameOfSiblingFSMsVar(v_VarAndStatWithSiblings_TC2Id, 1, "TCvarSibling")
var integer vl_varIdInTC2Entity1 := f_EPTF_Var_getId(vl_varName);
// In entity#2 of TC2
vl_varName := f_EPTF_LGenBase_varNameOfSiblingFSMsVar(v_VarAndStatWithSiblings_TC2Id, 2, "TCvarSibling")
var integer vl_varIdInTC2Entity2 := f_EPTF_Var_getId(vl_varName);
if (vl_varIdInTC1==-1) {
setverdict(fail,"TCvarSibling is missing in TC1")
f_EPTF_Base_stopAll(none);
}
if (vl_varIdInTC2Entity1==-1) {
setverdict(fail,"TCvarSibling is missing in TC2 entity#1")
f_EPTF_Base_stopAll(none);
}
if (vl_varIdInTC2Entity2==-1) {
setverdict(fail,"TCvarSibling is missing in TC2 entity#2")
f_EPTF_Base_stopAll(none);
}
if (vl_varIdInTC2Entity1==vl_varIdInTC1) {
setverdict(fail,"TCvarSibling is the same (",vl_varIdInTC2Entity1,") in TC1 and TC2 entity#1")
f_EPTF_Base_stopAll(none);
}
if (vl_varIdInTC2Entity1==vl_varIdInTC2Entity2) {
setverdict(fail,"TCvarSibling is the same (",vl_varIdInTC2Entity1,") for different entities ")
f_EPTF_Base_stopAll(none);
}
if (vl_varIdInTC2Entity2==vl_varIdInTC1) {
setverdict(fail,"TCvarSibling is the same (",vl_varIdInTC2Entity2,") in TC1 and TC2 entity#2")
f_EPTF_Base_stopAll(none);
}
//Check if the var IDs retrieved from the step arguments equal with the ones retrieved by API functions above
var EPTF_LGenBase_ReportedEventDescriptor vl_event := c_EPTF_LGenBase_emptyReportedEventDescriptor
vl_event.event.bIdx := v_LGenBase_VarAndStatTest_behav
vl_event.event.iIdx := vl_checkVarId
vl_event.event.target.eIdx := c_eBase+1
vl_event.event.target.fsmCtxIdx := v_VarAndStatWithSiblings_fsmCtxOfSibling2InTC1
vl_event.reportedArgs := {vl_varIdInTC1}
f_EPTF_LGenBase_dispatchEvent(vl_event);
//The variable ID must be the same in different sibling FSMs declaring the same var
vl_event.event.target.fsmCtxIdx := v_VarAndStatWithSiblings_fsmCtxOfSibling1InTC2
vl_event.reportedArgs := {vl_varIdInTC2Entity1}
f_EPTF_LGenBase_dispatchEvent(vl_event);
vl_event.event.target.fsmCtxIdx := v_VarAndStatWithSiblings_fsmCtxOfSibling4InTC2
vl_event.reportedArgs := {vl_varIdInTC2Entity1}
f_EPTF_LGenBase_dispatchEvent(vl_event);
vl_event.event.target.eIdx := c_eBase+2
vl_event.event.target.fsmCtxIdx := v_VarAndStatWithSiblings_fsmCtxOfE2Sibling4InTC2
vl_event.reportedArgs := {vl_varIdInTC2Entity2}
f_EPTF_LGenBase_dispatchEvent(vl_event);
//???
f_EPTF_LGenBase_dispatchEvent({
{v_LGenBase_VarAndStatTest_behav,0,{c_eBase+1,2},omit},
{}
})
if(not isvalue(v_LGenBase_VarAndStatTest_stepsPassed[4])){
setverdict(inconc,"Checking the TC variable of the different FSM has not been called.")
}
//Check if the content of TCvar2ofFSM1 in FSM#2 is 2.0
f_EPTF_LGenBase_dispatchEvent({
{v_LGenBase_VarAndStatTest_behav,1,{c_eBase+1,2},omit},
{}
})
//Set the content of TCvar2ofFSM1 to 9.5 in FSM#1
f_EPTF_LGenBase_dispatchEvent({
{v_LGenBase_VarAndStatTest_behav,4,{c_eBase+1,1},omit},
{}
})
//Check if the content of TCvar2ofFSM1 in FSM#2 is 9.5
f_EPTF_LGenBase_dispatchEvent({
{v_LGenBase_VarAndStatTest_behav,2,{c_eBase+1,2},omit},
{}
})
}//variable tests
{//group statMeas tests
//TC scope
//Get the statMeasIds
var integer vl_minTCVarAInTC1 := f_EPTF_LGenBase_fsmStatMeasIdOfTC(v_VarAndStatWithSiblings_TC1Id, "minTCVarA");
var integer vl_minTCVarAInTC2 := f_EPTF_LGenBase_fsmStatMeasIdOfTC(v_VarAndStatWithSiblings_TC2Id, "minTCVarA");
if (vl_minTCVarAInTC1==-1) {
setverdict(fail,"minTCVarA is missing in TC1")
f_EPTF_Base_stopAll(none);
}
if (vl_minTCVarAInTC2==-1) {
setverdict(fail,"minTCVarA is missing in TC2")
f_EPTF_Base_stopAll(none);
}
if (vl_minTCVarAInTC1==vl_minTCVarAInTC2) {
setverdict(fail,"minTCVarA is the same (",vl_minTCVarAInTC2,") in both traffic cases")
f_EPTF_Base_stopAll(none);
}
//Check minTCVarA statMeasIds reported in FSM declaration
var EPTF_LGenBase_ReportedEventDescriptor vl_event := c_EPTF_LGenBase_emptyReportedEventDescriptor
vl_event := c_EPTF_LGenBase_emptyReportedEventDescriptor;
vl_event.event.bIdx := v_LGenBase_VarAndStatTest_behav
vl_event.event.iIdx := vl_checkStatMeasIdEventId
//entity#1 in TC1
vl_event.event.target.eIdx := c_eBase+1
vl_event.event.target.fsmCtxIdx := v_VarAndStatWithSiblings_fsmCtxOfSibling2InTC1
vl_event.reportedArgs := {vl_minTCVarAInTC1}
f_EPTF_LGenBase_dispatchEvent(vl_event);
//entity#1 in TC2, siblingFSM#1
vl_event.event.target.eIdx := c_eBase+1
vl_event.event.target.fsmCtxIdx := v_VarAndStatWithSiblings_fsmCtxOfSibling1InTC2
vl_event.reportedArgs := {vl_minTCVarAInTC2}
f_EPTF_LGenBase_dispatchEvent(vl_event);
//entity#1 in TC2, siblingFSM#4
vl_event.event.target.fsmCtxIdx := v_VarAndStatWithSiblings_fsmCtxOfSibling4InTC2
vl_event.reportedArgs := {vl_minTCVarAInTC2}
f_EPTF_LGenBase_dispatchEvent(vl_event);
//entity#4 in TC2, siblingFSM#4
vl_event.event.target.eIdx := c_eBase+2
vl_event.event.target.fsmCtxIdx := v_VarAndStatWithSiblings_fsmCtxOfE2Sibling4InTC2
vl_event.reportedArgs := {vl_minTCVarAInTC2}
f_EPTF_LGenBase_dispatchEvent(vl_event);
//Sibling scope
var integer vl_minVarSiblingInTC1e1 := f_EPTF_LGenBase_fsmStatMeasIdOfSibling(v_VarAndStatWithSiblings_TC1Id, 1, "minVarSibling");
var integer vl_minVarSiblingInTC2e1 := f_EPTF_LGenBase_fsmStatMeasIdOfSibling(v_VarAndStatWithSiblings_TC2Id, 1, "minVarSibling");
var integer vl_minVarSiblingInTC2e2 := f_EPTF_LGenBase_fsmStatMeasIdOfSibling(v_VarAndStatWithSiblings_TC2Id, 2, "minVarSibling");
if (vl_minVarSiblingInTC1e1==-1) {
setverdict(fail,"minVarSibling is missing in TC1")
f_EPTF_Base_stopAll(none);
}
if (vl_minVarSiblingInTC2e1==-1) {
setverdict(fail,"minVarSibling is missing in TC2 entity1")
f_EPTF_Base_stopAll(none);
}
if (vl_minVarSiblingInTC2e2==-1) {
setverdict(fail,"minVarSibling is missing in TC2 entity2")
f_EPTF_Base_stopAll(none);
}
if (vl_minVarSiblingInTC1e1==vl_minVarSiblingInTC2e1) {
setverdict(fail,"minVarSibling is the same (",vl_minVarSiblingInTC1e1,") in both traffic cases")
f_EPTF_Base_stopAll(none);
}
if (vl_minVarSiblingInTC2e2==vl_minVarSiblingInTC2e1) {
setverdict(fail,"minVarSibling is the same (",vl_minVarSiblingInTC2e1,") in both entities")
f_EPTF_Base_stopAll(none);
}
//Check reported arguments
//minVarSibling stat
//in TC1
vl_event.event.target.eIdx := c_eBase+1
vl_event.event.iIdx := vl_checkStatMeasIdEventId4
vl_event.event.target.fsmCtxIdx := v_VarAndStatWithSiblings_fsmCtxOfSibling2InTC1
vl_event.reportedArgs := {vl_minVarSiblingInTC1e1}
f_EPTF_LGenBase_dispatchEvent(vl_event);
//in TC2 sibling1 e1
vl_event.event.target.eIdx := c_eBase+1
vl_event.event.target.fsmCtxIdx := v_VarAndStatWithSiblings_fsmCtxOfSibling1InTC2
vl_event.reportedArgs := {vl_minVarSiblingInTC2e1}
f_EPTF_LGenBase_dispatchEvent(vl_event);
//in TC2 sibling1 e2
vl_event.event.target.eIdx := c_eBase+2
vl_event.event.target.fsmCtxIdx := v_VarAndStatWithSiblings_fsmCtxOfSibling1InTC2
vl_event.reportedArgs := {vl_minVarSiblingInTC2e2}
f_EPTF_LGenBase_dispatchEvent(vl_event);
//in TC2 sibling4 e1
vl_event.event.target.eIdx := c_eBase+1
vl_event.event.target.fsmCtxIdx := v_VarAndStatWithSiblings_fsmCtxOfSibling4InTC2
vl_event.reportedArgs := {vl_minVarSiblingInTC2e1}
f_EPTF_LGenBase_dispatchEvent(vl_event);
}
{//group statHandler tests
//TC scope
//Get the statMeasIds
var integer vl_shTC1 := f_EPTF_LGenBase_fsmVarIdOfTCStat("shTC", v_VarAndStatWithSiblings_TC1Id);
var integer vl_shTC2 := f_EPTF_LGenBase_fsmVarIdOfTCStat("shTC", v_VarAndStatWithSiblings_TC2Id);
if (vl_shTC1==-1) {
setverdict(fail,"minTCVarA is missing in TC1")
f_EPTF_Base_stopAll(none);
}
if (vl_shTC2==-1) {
setverdict(fail,"minTCVarA is missing in TC2")
f_EPTF_Base_stopAll(none);
}
if (vl_shTC1==vl_shTC2) {
setverdict(fail,"minTCVarA is the same (",vl_shTC2,") in both traffic cases")
f_EPTF_Base_stopAll(none);
}
//Check minTCVarA statHandler reported in FSM declaration
var EPTF_LGenBase_ReportedEventDescriptor vl_event := c_EPTF_LGenBase_emptyReportedEventDescriptor
vl_event := c_EPTF_LGenBase_emptyReportedEventDescriptor;
vl_event.event.bIdx := v_LGenBase_VarAndStatTest_behav
vl_event.event.iIdx := vl_checkStatHandlerNameEventId
//entity#1 in TC1
vl_event.event.target.eIdx := c_eBase+1
vl_event.event.target.fsmCtxIdx := v_VarAndStatWithSiblings_fsmCtxOfSibling2InTC1
v_VarAndStatWithSiblings_expectedStatName := f_EPTF_LGenBase_varNameOfTCVar(v_VarAndStatWithSiblings_TC1Id, "shTC");
f_EPTF_LGenBase_dispatchEvent(vl_event);
//entity#1 in TC2, siblingFSM#1
vl_event.event.target.eIdx := c_eBase+1
vl_event.event.target.fsmCtxIdx := v_VarAndStatWithSiblings_fsmCtxOfSibling1InTC2
v_VarAndStatWithSiblings_expectedStatName := f_EPTF_LGenBase_varNameOfTCVar(v_VarAndStatWithSiblings_TC2Id, "shTC");
f_EPTF_LGenBase_dispatchEvent(vl_event);
//entity#1 in TC2, siblingFSM#4
vl_event.event.target.fsmCtxIdx := v_VarAndStatWithSiblings_fsmCtxOfSibling4InTC2
f_EPTF_LGenBase_dispatchEvent(vl_event);
//entity#4 in TC2, siblingFSM#4
vl_event.event.target.eIdx := c_eBase+2
vl_event.event.target.fsmCtxIdx := v_VarAndStatWithSiblings_fsmCtxOfE2Sibling4InTC2
f_EPTF_LGenBase_dispatchEvent(vl_event);
//Sibling statHandler
//Check reported arguments
//minVarSibling stat
//in TC1
vl_event.event.target.eIdx := c_eBase+1
vl_event.event.iIdx := vl_checkStatHandlerNameEventId2
vl_event.event.target.fsmCtxIdx := v_VarAndStatWithSiblings_fsmCtxOfSibling2InTC1
v_VarAndStatWithSiblings_expectedStatName := f_EPTF_LGenBase_varNameOfSiblingFSMsVar(v_VarAndStatWithSiblings_TC1Id, 1, "shSibling");
f_EPTF_LGenBase_dispatchEvent(vl_event);
//in TC2 sibling1 e1
vl_event.event.target.eIdx := c_eBase+1
vl_event.event.target.fsmCtxIdx := v_VarAndStatWithSiblings_fsmCtxOfSibling1InTC2
v_VarAndStatWithSiblings_expectedStatName := f_EPTF_LGenBase_varNameOfSiblingFSMsVar(v_VarAndStatWithSiblings_TC2Id, 1, "shSibling");
f_EPTF_LGenBase_dispatchEvent(vl_event);
//in TC2 sibling1 e2
vl_event.event.target.eIdx := c_eBase+2
vl_event.event.target.fsmCtxIdx := v_VarAndStatWithSiblings_fsmCtxOfSibling1InTC2
v_VarAndStatWithSiblings_expectedStatName := f_EPTF_LGenBase_varNameOfSiblingFSMsVar(v_VarAndStatWithSiblings_TC2Id, 2, "shSibling");
f_EPTF_LGenBase_dispatchEvent(vl_event);
//in TC2 sibling4 e1
vl_event.event.target.eIdx := c_eBase+1
vl_event.event.target.fsmCtxIdx := v_VarAndStatWithSiblings_fsmCtxOfSibling4InTC2
v_VarAndStatWithSiblings_expectedStatName := f_EPTF_LGenBase_varNameOfSiblingFSMsVar(v_VarAndStatWithSiblings_TC2Id, 1, "shSibling");
f_EPTF_LGenBase_dispatchEvent(vl_event);
}
f_EPTF_Base_cleanup_CT();
}
function f_LGenBase_Test_Neg_fsmStatMeas(
in charstring pl_expectedErrorMsg,
in charstring pl_provider1 := "TCvarA",
in charstring pl_provider2 := "TCvarA",
in charstring pl_target1 := "", // "" -> omit
in charstring pl_target2 := "", // "" -> omit
in EPTF_LGenBase_FSMStatMeasParams pl_statMeasParams1 := {statType := max},
in EPTF_LGenBase_FSMStatMeasParams pl_statMeasParams2 := {statType := max},
in EPTF_LGenBase_FsmObjectScopeDeclarator pl_varScope1 := TC,
in EPTF_LGenBase_FsmObjectScopeDeclarator pl_varScope2 := TC,
in EPTF_LGenBase_FsmObjectScopeDeclarator pl_statScope1 := TC,
in EPTF_LGenBase_FsmObjectScopeDeclarator pl_statScope2 := TC)
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_fsmVariables_init()
f_EPTF_Base_setExpectedErrorMsg(pl_expectedErrorMsg)
v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input5");
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmVariablesFSM);
v_dummyInt := f_EPTF_LGenBase_declareFunction("checkFSMVarDiff", {testStepFunction:= refers(f_LGenBase_Test_checkFSMVarOfDiff)})
v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"checkVarEqual",refers( f_EPTF_LGenBase_checkVarEqual)})
var EPTF_LGenBase_FsmTableDeclarator vl_fsm := c_LGenBase_Test_fsmVariablesFSM
var EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmVariablesFSMDiff :=
{
name := c_LGenBase_Test_fsmVariablesFSMName&"v1",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "TCvarA",
initValue := {floatVal := 23.0},
scope := pl_varScope1
},
{
name := "TCvarB",
initValue := {floatVal := 23.0},
scope := pl_varScope1
}
}
},
{ statMeasWithParamsList := {
{name := "test_stat", providerVarName := pl_provider1, targetVarName := omit, statMeasParams := pl_statMeasParams1, scope := pl_statScope1}
}}
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{{"checkFSMVarDiff",{varNames := {"TCvarA"}}}}, omit, omit}
}
}
}
}
}
var EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmVariablesFSMDiff2 :=
{
name := c_LGenBase_Test_fsmVariablesFSMName&"v2",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "TCvarA",
initValue := {floatVal := 23.0},
scope := pl_varScope2
},
{
name := "TCvarB",
initValue := {floatVal := 23.0},
scope := pl_varScope2
}
}
},
{ statMeasWithParamsList := {
{name := "test_stat", providerVarName := pl_provider2, targetVarName := omit, statMeasParams := pl_statMeasParams2, scope := pl_statScope2}
}}
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{{"checkFSMVarDiff",{varNames := {"TCvarA"}}}}, omit, omit}
}
}
}
}
}
if(lengthof(pl_target1) > 0) {
c_LGenBase_Test_fsmVariablesFSMDiff.fsmParams[2].statMeasWithParamsList[0].targetVarName := pl_target1;
}
if(lengthof(pl_target2) > 0) {
c_LGenBase_Test_fsmVariablesFSMDiff2.fsmParams[2].statMeasWithParamsList[0].targetVarName := pl_target2;
}
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmVariablesFSMDiff);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmVariablesFSMDiff2);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{
c_LGenBase_Test_fsmVariablesFSMName&"v1",
c_LGenBase_Test_fsmVariablesFSMName&"v2"
}
}
}
},
{"TC2",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{
c_LGenBase_Test_fsmVariablesFSMName&"v1",
c_LGenBase_Test_fsmVariablesFSMName&"v2"
}
}
}
}
},
{}
});
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false);
f_EPTF_Base_cleanup_CT();
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_fsmStatMeasDiffProvider1
//
// Purpose:
// This is a negative test case.
// Declares more than one FSM for a traffic case
// The FSMs have almost the same statMeasures but with different provider.
// The statMeasure stats are of TC scope.
// A proper error message should appear.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_fsmStatMeasDiffProvider1()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_Neg_fsmStatMeas(
pl_expectedErrorMsg := "*measured*provider*",
pl_provider2 := "TCvarB");
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_fsmStatMeasDiffProvider2
//
// Purpose:
// This is a negative test case.
// Declares more than one FSM for a traffic case
// The FSMs have almost the same statMeasures but with different provider.
// The statMeasure stats are of SiblingFSM scope.
// A proper error message should appear.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_fsmStatMeasDiffProvider2()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_Neg_fsmStatMeas(
pl_expectedErrorMsg := "*measured*provider*",
pl_provider2 := "TCvarB",
pl_varScope1 := SiblingFSM,
pl_varScope2 := SiblingFSM,
pl_statScope1 := SiblingFSM,
pl_statScope2 := SiblingFSM);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_fsmStatMeasDiffTarget1
//
// Purpose:
// This is a negative test case.
// Declares more than one FSM for a traffic case
// The FSMs have almost the same statMeasures but with different target.
// The statMeasure stats are of TC scope.
// A proper error message should appear.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_fsmStatMeasDiffTarget1()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_Neg_fsmStatMeas(
pl_expectedErrorMsg := "*measured*target*",
pl_target2 := "TCvarB");
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_fsmStatMeasDiffTarget2
//
// Purpose:
// This is a negative test case.
// Declares more than one FSM for a traffic case
// The FSMs have almost the same statMeasures but with different target.
// The statMeasure stats are of SiblingFSM scope.
// A proper error message should appear.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_fsmStatMeasDiffTarget2()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_Neg_fsmStatMeas(
pl_expectedErrorMsg := "*measured*target*",
pl_target2 := "TCvarB",
pl_varScope1 := SiblingFSM,
pl_varScope2 := SiblingFSM,
pl_statScope1 := SiblingFSM,
pl_statScope2 := SiblingFSM);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_fsmStatMeasDiffStatType1
//
// Purpose:
// This is a negative test case.
// Declares more than one FSM for a traffic case
// The FSMs have almost the same statMeasures but with different statType.
// The statMeasure stats are of TC scope.
// A proper error message should appear.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_fsmStatMeasDiffStatType1()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_Neg_fsmStatMeas(
pl_expectedErrorMsg := "*measured*parameters*",
pl_statMeasParams2 := {statType := min});
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_fsmStatMeasDiffStatType2
//
// Purpose:
// This is a negative test case.
// Declares more than one FSM for a traffic case
// The FSMs have almost the same statMeasures but with different statType.
// The statMeasure stats are of SiblingFSM scope.
// A proper error message should appear.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_fsmStatMeasDiffStatType2()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_Neg_fsmStatMeas(
pl_expectedErrorMsg := "*measured*parameters*",
pl_statMeasParams2 := {statType := min},
pl_varScope1 := SiblingFSM,
pl_varScope2 := SiblingFSM,
pl_statScope1 := SiblingFSM,
pl_statScope2 := SiblingFSM);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_fsmStatMeasDiffStatMeasParams1
//
// Purpose:
// This is a negative test case.
// Declares more than one FSM for a traffic case
// The FSMs have almost the same statMeasures but with different statMeasParams.
// The statMeasure stats are of TC scope.
// A proper error message should appear.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_fsmStatMeasDiffStatMeasParams1()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_Neg_fsmStatMeas(
pl_expectedErrorMsg := "*measured*parameters*",
pl_statMeasParams2 := {params := {max := {}}});
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_fsmStatMeasDiffStatMeasParams2
//
// Purpose:
// This is a negative test case.
// Declares more than one FSM for a traffic case
// The FSMs have almost the same statMeasures but with different statMeasParams.
// The statMeasure stats are of SiblingFSM scope.
// A proper error message should appear.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_fsmStatMeasDiffStatMeasParams2()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_Neg_fsmStatMeas(
pl_expectedErrorMsg := "*measured*parameters*",
pl_statMeasParams2 := {params := {max := {}}},
pl_varScope1 := SiblingFSM,
pl_varScope2 := SiblingFSM,
pl_statScope1 := SiblingFSM,
pl_statScope2 := SiblingFSM);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_fsmStatMeasDiffScope1
//
// Purpose:
// This is a negative test case.
// Declares more than one FSM for a traffic case
// The FSMs have almost the same statMeasures but with different Scope (SiblingFSM, FSM).
// A proper error message should appear.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_fsmStatMeasDiffScope1()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_Neg_fsmStatMeas(
pl_expectedErrorMsg := "*measured*scope*",
pl_provider1 := "",
pl_provider2 := "",
pl_statScope1 := SiblingFSM,
pl_statScope2 := FSM);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_fsmStatMeasDiffScope2
//
// Purpose:
// This is a negative test case.
// Declares more than one FSM for a traffic case
// The FSMs have almost the same statMeasures but with different Scope (SiblingFSM, TC).
// A proper error message should appear.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_fsmStatMeasDiffScope2()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_Neg_fsmStatMeas(
pl_expectedErrorMsg := "*measured*scope*",
pl_provider1 := "",
pl_provider2 := "",
pl_statScope1 := SiblingFSM,
pl_statScope2 := TC);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_fsmStatMeasDiffScope3
//
// Purpose:
// This is a negative test case.
// Declares more than one FSM for a traffic case
// The FSMs have almost the same statMeasures but with different Scope (FSM, SiblingFSM).
// A proper error message should appear.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_fsmStatMeasDiffScope3()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_Neg_fsmStatMeas(
pl_expectedErrorMsg := "*measured*scope*",
pl_provider1 := "",
pl_provider2 := "",
pl_statScope1 := FSM,
pl_statScope2 := SiblingFSM);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_fsmStatMeasDiffScope4
//
// Purpose:
// This is a negative test case.
// Declares more than one FSM for a traffic case
// The FSMs have almost the same statMeasures but with different Scope (FSM, TC).
// A proper error message should appear.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_fsmStatMeasDiffScope4()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_Neg_fsmStatMeas(
pl_expectedErrorMsg := "*measured*scope*",
pl_provider1 := "",
pl_provider2 := "",
pl_statScope1 := FSM,
pl_statScope2 := TC);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_fsmStatMeasDiffScope5
//
// Purpose:
// This is a negative test case.
// Declares more than one FSM for a traffic case
// The FSMs have almost the same statMeasures but with different Scope (TC, SiblingFSM).
// A proper error message should appear.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_fsmStatMeasDiffScope5()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_Neg_fsmStatMeas(
pl_expectedErrorMsg := "*measured*scope*",
pl_provider1 := "",
pl_provider2 := "",
pl_statScope1 := TC,
pl_statScope2 := SiblingFSM);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_fsmStatMeasDiffScope6
//
// Purpose:
// This is a negative test case.
// Declares more than one FSM for a traffic case
// The FSMs have almost the same statMeasures but with different Scope (TC, FSM).
// A proper error message should appear.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_fsmStatMeasDiffScope6()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_Neg_fsmStatMeas(
pl_expectedErrorMsg := "*measured*scope*",
pl_provider1 := "",
pl_provider2 := "",
pl_statScope1 := TC,
pl_statScope2 := FSM);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_fsmStatMeasDiffScope7
//
// Purpose:
// This is a negative test case.
// Declares more than one FSM for a traffic case
// The FSMs have almost the same statMeasures but with different Scope from the provider vars (TC, FSM).
// A proper error message should appear.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_fsmStatMeasDiffScope7()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_Neg_fsmStatMeas(
pl_expectedErrorMsg := "*measured*already defined*scope*",
pl_provider1 := "",
pl_varScope1 := TC,
pl_varScope2 := TC,
pl_statScope1 := TC,
pl_statScope2 := FSM);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_fsmStatMeasDiffScope8
//
// Purpose:
// This is a negative test case.
// Declares more than one FSM for a traffic case
// The FSMs have almost the same statMeasures but with different Scope from the provider vars (FSM, TC).
// A proper error message should appear.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_fsmStatMeasDiffScope8()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_Neg_fsmStatMeas(
pl_expectedErrorMsg := "*measured*already defined*scope*",
pl_provider1 := "",
pl_varScope1 := FSM,
pl_varScope2 := FSM,
pl_statScope1 := FSM,
pl_statScope2 := TC);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_fsmStatMeasCheck
//
// Purpose:
// It declares 2 FSMs in a TC with a variable with TC scope
// and a TC scoped statMeasure for checking the maximal value
// of this variable during text execution.
// A change in the variable in FSM1 should be seen in the
// statistic in FSM2 because it has TC scope.
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_fsmStatMeasCheck()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_fsmVariables_init()
var integer vl_behavior := f_EPTF_LGenBase_declareBehaviorType("testb1", -1, null, null, null, null);
var integer vl_event1 := f_EPTF_LGenBase_declareFsmEvent("testb1","testi1");
var integer vl_event2 := f_EPTF_LGenBase_declareFsmEvent("testb1","testi2");
var integer vl_event3 := f_EPTF_LGenBase_declareFsmEvent("testb1","testi3");
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmVariablesFSMDiff :=
{
name := c_LGenBase_Test_fsmVariablesFSMName&"v1",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "TCvarA",
initValue := {floatVal := 3.0},
scope := TC
}
}
},
{ statMeasWithParamsList := {
{name := "test_stat", providerVarName := "TCvarA", targetVarName := omit, statMeasParams := {statType := max}, scope := TC}
}}
},
table := {
classicTable := {
{eventToListen := {"testb1","testi2",fsm},
cellRow := {
//state[0]==idle
//second increase --> TCvarA=10
{{{c_EPTF_LGenBase_stepName_fsmVarInc,{varParams := {"TCvarA",{floatVal := 5.0}}}}}, omit, omit}
}
}
}
}
}
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmVariablesFSMDiff2 :=
{
name := c_LGenBase_Test_fsmVariablesFSMName&"v2",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "TCvarA",
initValue := {floatVal := 3.0},
scope := TC
}
}
},
{ statMeasWithParamsList := {
{name := "test_stat", providerVarName := "TCvarA", targetVarName := omit, statMeasParams := {statType := max}, scope := TC}
}}
},
table := {
classicTable := {
{eventToListen := {"testb1","testi1",fsm},
cellRow := {
//state[0]==idle
//first increase --> TCvarA=5
{{{c_EPTF_LGenBase_stepName_fsmVarInc,{varParams := {"TCvarA",{floatVal := 2.0}}}}}, omit, omit}
}
},
{eventToListen := {"testb1","testi3",fsm},
cellRow := {
//state[0]==idle
//first decrease (after all the increase) --> TCvarA=9
{{{c_EPTF_LGenBase_stepName_fsmVarDec,{varParams := {"TCvarA",{floatVal := 1.0}}}}}, omit, omit}
}
}
}
}
}
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmVariablesFSMDiff);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmVariablesFSMDiff2);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{
c_LGenBase_Test_fsmVariablesFSMName&"v1",
c_LGenBase_Test_fsmVariablesFSMName&"v2"
}
}
}
},
{"TC2",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{
c_LGenBase_Test_fsmVariablesFSMName&"v1",
c_LGenBase_Test_fsmVariablesFSMName&"v2"
}
}
}
}
},
{}
});
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false);
var EPTF_LGenBase_ReportedEventDescriptor vl_trigger := c_EPTF_LGenBase_emptyReportedEventDescriptor;
vl_trigger.event.bIdx := vl_behavior;
vl_trigger.event.iIdx := vl_event1;
vl_trigger.event.target.eIdx := 1;
vl_trigger.event.target.fsmCtxIdx := 1;//to the second FSM
f_EPTF_LGenBase_dispatchEvent(vl_trigger);
timer TL_1;
TL_1.start( 0.1 );
TL_1.timeout;
vl_trigger.event.iIdx := vl_event2;
vl_trigger.event.target.fsmCtxIdx := 0; //to the first FSM
f_EPTF_LGenBase_dispatchEvent(vl_trigger);
TL_1.start( 0.1 );
TL_1.timeout;
vl_trigger.event.iIdx := vl_event3;
vl_trigger.event.target.fsmCtxIdx := 1; //to the second FSM
f_EPTF_LGenBase_dispatchEvent(vl_trigger);
TL_1.start( 0.1 );
TL_1.timeout;
var integer vl_statIdx_intVar := 0; //TODO: magic number!
var EPTF_Var_DirectContent vl_statValue;
f_EPTF_StatMeasure_getStat_max(vl_statIdx_intVar, vl_statValue);
if (vl_statValue == {floatVal := 10.0}) {
setverdict ( pass );
} else
{
setverdict ( fail );
}
f_EPTF_Base_cleanup_CT();
}
function f_LGenBase_Test_Neg_fsmStatHandlersWithDiffProvider(
in EPTF_LGenBase_FsmObjectScopeDeclarator pl_scope)
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_fsmVariables_init()
f_EPTF_Base_setExpectedErrorMsg("*FSM statHandler*provider*")
f_EPTF_Base_setExpectedErrorMsg("*shTC1*"&c_LGenBase_Test_fsmVariablesFSMName&"v2*"&c_LGenBase_Test_fsmVariablesFSMName&"v1*provider*")
v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input5");
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmVariablesFSM);
v_dummyInt := f_EPTF_LGenBase_declareFunction("checkFSMVarDiff", {testStepFunction:= refers(f_LGenBase_Test_checkFSMVarOfDiff)})
v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"checkVarEqual",refers( f_EPTF_LGenBase_checkVarEqual)})
var EPTF_LGenBase_FsmTableDeclarator vl_fsm := c_LGenBase_Test_fsmVariablesFSM
var EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmVariablesFSMDiff :=
{
name := c_LGenBase_Test_fsmVariablesFSMName&"v1",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "TCvarA",
initValue := {floatVal := 23.0},
scope := TC
},
{
name := "TCvarB",
initValue := {floatVal := 23.0},
scope := TC
}
}
},
{statHandlerStatList := {
{
name := "shTC1",
providers := {
{varList := {"TCvarA"}}
},
statMethod := "Sum",
statResetValue := {floatVal := 0.0},
scope := pl_scope
}
}}
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{{"checkFSMVarDiff",{varNames := {"TCvarA"}}}}, omit, omit}
}
}
}
}
}
var EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmVariablesFSMDiff2 :=
{
name := c_LGenBase_Test_fsmVariablesFSMName&"v2",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "TCvarA",
initValue := {floatVal := 23.0},
scope := TC
},
{
name := "TCvarB",
initValue := {floatVal := 23.0},
scope := TC
}
}
},
{statHandlerStatList := {
{
name := "shTC1",
providers := {
{varList := {"TCvarB"}}
},
statMethod := "Sum",
statResetValue := {floatVal := 0.0},
scope := pl_scope
}
}}
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{{"checkFSMVarDiff",{varNames := {"TCvarA"}}}}, omit, omit}
}
}
}
}
}
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmVariablesFSMDiff);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmVariablesFSMDiff2);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{
c_LGenBase_Test_fsmVariablesFSMName&"v1",
c_LGenBase_Test_fsmVariablesFSMName&"v2"
}
}
}
},
{"TC2",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{
c_LGenBase_Test_fsmVariablesFSMName&"v1",
c_LGenBase_Test_fsmVariablesFSMName&"v2"
}
}
}
}
},
{}
});
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false);
f_EPTF_Base_cleanup_CT();
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_fsmStatHandlersWithDiffProvider1
//
// Purpose:
// This is a negative test case.
// Declares more than one FSM for a traffic case
// The FSMs have almost the same statHandlers but with different providers.
// The statHandler stats are of TC scope.
// A proper error message should appear.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_fsmStatHandlersWithDiffProvider1()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_Neg_fsmStatHandlersWithDiffProvider(TC);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_fsmStatHandlersWithDiffProvider2
//
// Purpose:
// This is a negative test case.
// Declares more than one FSM for a traffic case
// The FSMs have almost the same statHandlers but with different providers.
// The statHandler stats are of SiblingFSM scope.
// A proper error message should appear.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_fsmStatHandlersWithDiffProvider2()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_Neg_fsmStatHandlersWithDiffProvider(SiblingFSM);
}
function f_LGenBase_Test_Neg_fsmStatHandlersWithDiffResetValue(
in EPTF_LGenBase_FsmObjectScopeDeclarator pl_scope)
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_fsmVariables_init()
f_EPTF_Base_setExpectedErrorMsg("*shTC1*"&c_LGenBase_Test_fsmVariablesFSMName&"v2*"&c_LGenBase_Test_fsmVariablesFSMName&"v1*reset*")
v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input5");
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmVariablesFSM);
v_dummyInt := f_EPTF_LGenBase_declareFunction("checkFSMVarDiff", {testStepFunction:= refers(f_LGenBase_Test_checkFSMVarOfDiff)})
v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"checkVarEqual",refers( f_EPTF_LGenBase_checkVarEqual)})
var EPTF_LGenBase_FsmTableDeclarator vl_fsm := c_LGenBase_Test_fsmVariablesFSM
var EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmVariablesFSMDiff :=
{
name := c_LGenBase_Test_fsmVariablesFSMName&"v1",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "TCvarA",
initValue := {floatVal := 23.0},
scope := TC
}
}
},
{statHandlerStatList := {
{
name := "shTC1",
providers := {
{varList := {"TCvarA"}}
},
statMethod := "Sum",
statResetValue := {floatVal := 0.0},
scope := pl_scope
}
}}
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{{"checkFSMVarDiff",{varNames := {"TCvarA"}}}}, omit, omit}
}
}
}
}
}
var EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmVariablesFSMDiff2 :=
{
name := c_LGenBase_Test_fsmVariablesFSMName&"v2",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "TCvarA",
initValue := {floatVal := 23.0},
scope := TC
}
}
},
{statHandlerStatList := {
{
name := "shTC1",
providers := {
{varList := {"TCvarA"}}
},
statMethod := "Sum",
statResetValue := {floatVal := 1.0},
scope := pl_scope
}
}}
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{{"checkFSMVarDiff",{varNames := {"TCvarA"}}}}, omit, omit}
}
}
}
}
}
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmVariablesFSMDiff);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmVariablesFSMDiff2);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{
c_LGenBase_Test_fsmVariablesFSMName&"v1",
c_LGenBase_Test_fsmVariablesFSMName&"v2"
}
}
}
},
{"TC2",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{
c_LGenBase_Test_fsmVariablesFSMName&"v1",
c_LGenBase_Test_fsmVariablesFSMName&"v2"
}
}
}
}
},
{}
});
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false);
f_EPTF_Base_cleanup_CT();
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_fsmStatHandlersWithDiffResetValue1
//
// Purpose:
// This is a negative test case.
// Declares more than one FSM for a traffic case
// The FSMs have almost the same statHandlers but with different reset value.
// The statHandler stats are of TC scope.
// A proper error message should appear.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_fsmStatHandlersWithDiffResetValue1()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_Neg_fsmStatHandlersWithDiffResetValue(TC);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_fsmStatHandlersWithDiffResetValue2
//
// Purpose:
// This is a negative test case.
// Declares more than one FSM for a traffic case
// The FSMs have almost the same statHandlers but with different reset value.
// The statHandler stats are of SiblingFSM scope.
// A proper error message should appear.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_fsmStatHandlersWithDiffResetValue2()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_Neg_fsmStatHandlersWithDiffResetValue(SiblingFSM);
}
function f_LGenBase_Test_Neg_fsmStatHandlersWithDiffScope(
in charstring pl_expectedErrorMsg,
in EPTF_LGenBase_FsmObjectScopeDeclarator pl_scope1,
in EPTF_LGenBase_FsmObjectScopeDeclarator pl_scope2)
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_fsmVariables_init()
// f_EPTF_Base_setExpectedErrorMsg("*FSM statHandler*scope*")
f_EPTF_Base_setExpectedErrorMsg(pl_expectedErrorMsg)
v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input5");
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmVariablesFSM);
v_dummyInt := f_EPTF_LGenBase_declareFunction("checkFSMVarDiff", {testStepFunction:= refers(f_LGenBase_Test_checkFSMVarOfDiff)})
v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"checkVarEqual",refers( f_EPTF_LGenBase_checkVarEqual)})
var EPTF_LGenBase_FsmTableDeclarator vl_fsm := c_LGenBase_Test_fsmVariablesFSM
var EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmVariablesFSMDiff :=
{
name := c_LGenBase_Test_fsmVariablesFSMName&"v1",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "TCvarA",
initValue := {floatVal := 23.0},
scope := TC
}
}
},
{statHandlerStatList := {
{
name := "shTC1",
providers := {
{varList := {"TCvarA"}}
},
statMethod := "Sum",
statResetValue := {floatVal := 0.0},
scope := pl_scope1
}
}}
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{{"checkFSMVarDiff",{varNames := {"TCvarA"}}}}, omit, omit}
}
}
}
}
}
var EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmVariablesFSMDiff2 :=
{
name := c_LGenBase_Test_fsmVariablesFSMName&"v2",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "TCvarA",
initValue := {floatVal := 23.0},
scope := TC
}
}
},
{statHandlerStatList := {
{
name := "shTC1",
providers := {
{varList := {"TCvarA"}}
},
statMethod := "Sum",
statResetValue := {floatVal := 0.0},
scope := pl_scope2
}
}}
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{{"checkFSMVarDiff",{varNames := {"TCvarA"}}}}, omit, omit}
}
}
}
}
}
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmVariablesFSMDiff);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmVariablesFSMDiff2);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{
c_LGenBase_Test_fsmVariablesFSMName&"v1",
c_LGenBase_Test_fsmVariablesFSMName&"v2"
}
}
}
},
{"TC2",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{
c_LGenBase_Test_fsmVariablesFSMName&"v1",
c_LGenBase_Test_fsmVariablesFSMName&"v2"
}
}
}
}
},
{}
});
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false);
f_EPTF_Base_cleanup_CT();
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_fsmStatHandlersWithDiffScope1
//
// Purpose:
// This is a negative test case.
// Declares more than one FSM for a traffic case
// The FSMs have almost the same statHandlers but with different scope (SiblingFSM, FSM).
// A proper error message should appear.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_fsmStatHandlersWithDiffScope1()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_Neg_fsmStatHandlersWithDiffScope(
"*scope*",
SiblingFSM,
FSM);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_fsmStatHandlersWithDiffScope2
//
// Purpose:
// This is a negative test case.
// Declares more than one FSM for a traffic case
// The FSMs have almost the same statHandlers but with different scope (SiblingFSM, TC).
// A proper error message should appear.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_fsmStatHandlersWithDiffScope2()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_Neg_fsmStatHandlersWithDiffScope(
"*scope*",
SiblingFSM,
TC);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_fsmStatHandlersWithDiffScope3
//
// Purpose:
// This is a negative test case.
// Declares more than one FSM for a traffic case
// The FSMs have almost the same statHandlers but with different scope (FSM, SiblingFSM).
// A proper error message should appear.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_fsmStatHandlersWithDiffScope3()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_Neg_fsmStatHandlersWithDiffScope(
"*scope*",
FSM,
SiblingFSM);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_fsmStatHandlersWithDiffScope4
//
// Purpose:
// This is a negative test case.
// Declares more than one FSM for a traffic case
// The FSMs have almost the same statHandlers but with different scope (FSM, TC).
// A proper error message should appear.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_fsmStatHandlersWithDiffScope4()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_Neg_fsmStatHandlersWithDiffScope(
"*scope*",
FSM,
TC);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_fsmStatHandlersWithDiffScope5
//
// Purpose:
// This is a negative test case.
// Declares more than one FSM for a traffic case
// The FSMs have almost the same statHandlers but with different scope (TC, SiblingFSM).
// A proper error message should appear.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_fsmStatHandlersWithDiffScope5()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_Neg_fsmStatHandlersWithDiffScope(
"*scope*",
TC,
SiblingFSM);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_fsmStatHandlersWithDiffScope6
//
// Purpose:
// This is a negative test case.
// Declares more than one FSM for a traffic case
// The FSMs have almost the same statHandlers but with different scope (TC, FSM).
// A proper error message should appear.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_fsmStatHandlersWithDiffScope6()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_Neg_fsmStatHandlersWithDiffScope(
"*scope*",
TC,
FSM);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_Neg_fsmStatHandlersWithDiffMethod
//
// Purpose:
// This is a negative test case.
// Declares more than one FSM for a traffic case
// The FSMs have almost the same statHandlers but with different statMethod.
// A proper error message should appear.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_Neg_fsmStatHandlersWithDiffMethod()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_fsmVariables_init()
f_EPTF_Base_setExpectedErrorMsg("*shTC1*"&c_LGenBase_Test_fsmVariablesFSMName&"v2*"&c_LGenBase_Test_fsmVariablesFSMName&"v1*method*")
v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input5");
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmVariablesFSM);
v_dummyInt := f_EPTF_LGenBase_declareFunction("checkFSMVarDiff", {testStepFunction:= refers(f_LGenBase_Test_checkFSMVarOfDiff)})
v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"checkVarEqual",refers( f_EPTF_LGenBase_checkVarEqual)})
var EPTF_LGenBase_FsmTableDeclarator vl_fsm := c_LGenBase_Test_fsmVariablesFSM
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmVariablesFSMDiff :=
{
name := c_LGenBase_Test_fsmVariablesFSMName&"v1",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "TCvarA",
initValue := {floatVal := 23.0},
scope := TC
}
}
},
{statHandlerStatList := {
{
name := "shTC1",
providers := {
{varList := {"TCvarA"}}
},
statMethod := "Sum",
statResetValue := {floatVal := 0.0},
scope := TC
}
}}
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{{"checkFSMVarDiff",{varNames := {"TCvarA"}}}}, omit, omit}
}
}
}
}
}
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmVariablesFSMDiff2 :=
{
name := c_LGenBase_Test_fsmVariablesFSMName&"v2",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "TCvarA",
initValue := {floatVal := 23.0},
scope := TC
}
}
},
{statHandlerStatList := {
{
name := "shTC1",
providers := {
{varList := {"TCvarA"}}
},
statMethod := "Max",
statResetValue := {floatVal := 0.0},
scope := TC
}
}}
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{{"checkFSMVarDiff",{varNames := {"TCvarA"}}}}, omit, omit}
}
}
}
}
}
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmVariablesFSMDiff);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmVariablesFSMDiff2);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{
c_LGenBase_Test_fsmVariablesFSMName&"v1",
c_LGenBase_Test_fsmVariablesFSMName&"v2"
}
}
}
},
{"TC2",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{
c_LGenBase_Test_fsmVariablesFSMName&"v1",
c_LGenBase_Test_fsmVariablesFSMName&"v2"
}
}
}
}
},
{}
});
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false);
f_EPTF_Base_cleanup_CT();
}
const float c_fsmStatHandlerVarProviders_refreshSubscribersPeriod := 0.2
function f_LGenBase_Test_fsmStatHandlerVarProviders(
in EPTF_LGenBase_FsmObjectScopeDeclarator pl_providerScope,
in EPTF_LGenBase_FsmObjectScopeDeclarator pl_statScope,
in integer pl_expectedValue)
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_fsmVariables_init(3, "mtc");
v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input5");
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmVariablesFSM);
v_dummyInt := f_EPTF_LGenBase_declareFunction("checkFSMVarDiff", {testStepFunction:= refers(f_LGenBase_Test_checkFSMVarOfDiff)});
v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"checkVarEqual",refers( f_EPTF_LGenBase_checkVarEqual)});
var EPTF_LGenBase_FsmTableDeclarator vl_fsm1 :=
{
name := "myFSM1",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "TCvar",
initValue := {intVal := 23},
scope := pl_providerScope
}
}
},
{statHandlerStatList := {
{
name := "TCshstat",
providers := {
{varList := {"TCvar"}}
},
statMethod := "Sum",
statResetValue := {intVal := 0},
scope := pl_statScope
}
}}
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{{"checkFSMVarDiff",{varNames := {"TCvar"}}}}, omit, omit}
}
}
}
}
}
var EPTF_LGenBase_FsmTableDeclarator vl_fsm2 :=
{
name := "myFSM2",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "TCvar",
initValue := {intVal := 23},
scope := pl_providerScope
}
}
}
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{{"checkFSMVarDiff",{varNames := {"TCvar"}}}}, omit, omit}
}
}
}
}
}
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(vl_fsm1);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(vl_fsm2);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{
"myFSM1", "myFSM2"
}
}
}
}
},
{}
});
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false);
timer T_wait := c_fsmStatHandlerVarProviders_refreshSubscribersPeriod * 4.0;
T_wait.start;
T_wait.timeout;
var integer vl_value := -1;
select(pl_statScope) {
case(FSM) {
vl_value := f_EPTF_Var_getIntValue(f_EPTF_LGenBase_fsmVarIdOfFSMStat("TCshstat", 1, 0));
}
case(TC) {
vl_value := f_EPTF_Var_getIntValue(f_EPTF_LGenBase_fsmVarIdOfTCStat("TCshstat", 0));
}
case(SiblingFSM) {
vl_value := f_EPTF_Var_getIntValue(f_EPTF_LGenBase_fsmVarIdOfSiblingStat("TCshstat", 0, 1));
}
case else {
f_EPTF_Base_stop(inconc);
}
}
if(vl_value != pl_expectedValue) {
setverdict(fail, "value of statistics #1 "&int2str(vl_value)&" differs from expected value "&int2str(pl_expectedValue));
} else {
setverdict(pass);
}
action("TCshstat = ", vl_value);
f_EPTF_Base_cleanup_CT();
}
testcase tc_LGenBase_Test_fsmStatHandlerVarProviders1()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_fsmStatHandlerVarProviders(FSM, FSM, 23);
}
testcase tc_LGenBase_Test_fsmStatHandlerVarProviders2()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_fsmStatHandlerVarProviders(FSM, SiblingFSM, 46);
}
testcase tc_LGenBase_Test_fsmStatHandlerVarProviders3()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_fsmStatHandlerVarProviders(FSM, TC, 138);
}
testcase tc_LGenBase_Test_fsmStatHandlerVarProviders4()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_fsmStatHandlerVarProviders(SiblingFSM, SiblingFSM, 23);
}
testcase tc_LGenBase_Test_fsmStatHandlerVarProviders5()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_fsmStatHandlerVarProviders(SiblingFSM, TC, 69);
}
testcase tc_LGenBase_Test_fsmStatHandlerVarProviders6()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_fsmStatHandlerVarProviders(TC, TC, 23);
}
testcase tc_LGenBase_Test_fsmStatHandlerVarProviders7()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_fsmStatHandlerVarProviders(TC, FSM, 23);
}
testcase tc_LGenBase_Test_fsmStatHandlerVarProviders8()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_fsmStatHandlerVarProviders(TC, SiblingFSM, 23);
}
testcase tc_LGenBase_Test_fsmStatHandlerVarProviders9()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_fsmStatHandlerVarProviders(SiblingFSM, FSM, 23);
}
/*
testcase tc_LGenBase_Test_Neg_fsmStatHandlerVarProviders1()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_EPTF_Base_init_CT("mtc");
f_EPTF_Base_setExpectedAssertMsg("*Invalid FSM object scope*");
f_LGenBase_Test_fsmStatHandlerVarProviders(SiblingFSM, FSM, -1);
}
testcase tc_LGenBase_Test_Neg_fsmStatHandlerVarProviders2()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_EPTF_Base_init_CT("mtc");
f_EPTF_Base_setExpectedAssertMsg("*Invalid FSM object scope*");
f_LGenBase_Test_fsmStatHandlerVarProviders(TC, SiblingFSM, -1);
}
testcase tc_LGenBase_Test_Neg_fsmStatHandlerVarProviders3()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_EPTF_Base_init_CT("mtc");
f_EPTF_Base_setExpectedAssertMsg("*Invalid FSM object scope*");
f_LGenBase_Test_fsmStatHandlerVarProviders(TC, FSM, -1);
}
*/
function f_LGenBase_Test_fsmStatHandlerStatMeasProviders(
in EPTF_LGenBase_FsmObjectScopeDeclarator pl_providerScope,
in EPTF_LGenBase_FsmObjectScopeDeclarator pl_statScope,
in integer pl_expectedValue)
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_fsmVariables_init(3, "mtc");
v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input5");
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmVariablesFSM);
v_dummyInt := f_EPTF_LGenBase_declareFunction("checkFSMVarDiff", {testStepFunction:= refers(f_LGenBase_Test_checkFSMVarOfDiff)});
v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"checkVarEqual",refers( f_EPTF_LGenBase_checkVarEqual)});
var EPTF_LGenBase_FsmTableDeclarator vl_fsm1 :=
{
name := "myFSM1",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "TCvar",
initValue := {intVal := 23},
scope := pl_providerScope
}
}
},
{statMeasWithParamsList := {
{
name := "TCsmstat",
providerVarName := "TCvar",
targetVarName := "",
statMeasParams := {statType := max},
scope := pl_providerScope
}
}
},
{statHandlerStatList := {
{
name := "TCshstat",
providers := {
{statMeas := "TCsmstat"}
},
statMethod := "Sum",
statResetValue := {intVal := 0},
scope := pl_statScope
}
}}
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{{"checkFSMVarDiff",{varNames := {"TCvar"}}}}, omit, omit}
}
}
}
}
}
var EPTF_LGenBase_FsmTableDeclarator vl_fsm2 :=
{
name := "myFSM2",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "TCvar",
initValue := {intVal := 23},
scope := pl_providerScope
}
}
},
{statMeasWithParamsList := {
{
name := "TCsmstat",
providerVarName := "TCvar",
targetVarName := "",
statMeasParams := {statType := max},
scope := pl_providerScope
}
}
}
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{{"checkFSMVarDiff",{varNames := {"TCvar"}}}}, omit, omit}
}
}
}
}
}
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(vl_fsm1);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(vl_fsm2);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{
"myFSM1", "myFSM2"
}
}
}
}
},
{}
});
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false);
var charstring vl_varName := "";
select(pl_providerScope) {
case(FSM) {
vl_varName := f_EPTF_LGenBase_varNameOfFSMVar(pl_eIdx := 1, pl_fsmIdx := 0, pl_varName := "TCvar");
}
case(TC) {
vl_varName := f_EPTF_LGenBase_varNameOfTCVar(pl_tcIdx := 0, pl_varName := "TCvar");
}
case(SiblingFSM) {
vl_varName := f_EPTF_LGenBase_varNameOfSiblingFSMsVar(pl_tcIdx := 0, pl_eRelIdx := 1, pl_varName := "TCvar");
}
case else {
f_EPTF_Base_stop(inconc);
}
}
action("vl_varName = ", vl_varName);
action("f_EPTF_Var_getId(vl_varName) = ", f_EPTF_Var_getId(vl_varName));
timer T_wait := c_fsmStatHandlerVarProviders_refreshSubscribersPeriod + 1.0;
var EPTF_Var_DirectContent vl_content;
f_EPTF_Var_getContent(f_EPTF_Var_getId(vl_varName), vl_content);
vl_content.intVal := vl_content.intVal + 1;
f_EPTF_Var_adjustContent(f_EPTF_Var_getId(vl_varName), vl_content);
T_wait.start; T_wait.timeout;
vl_content.intVal := vl_content.intVal - 1;
f_EPTF_Var_adjustContent(f_EPTF_Var_getId(vl_varName), vl_content);
T_wait.start; T_wait.timeout;
// statMeas nem veszi figyelembe az initerteket, csak ha megvaltozik valamire,
// ezert mindegyik valtozot csokkentjuk majd noveljuk eggyel.
select(pl_providerScope) {
case(FSM) {
for ( var integer vl_eIdx := 0; vl_eIdx < 3 ; vl_eIdx := vl_eIdx+1 )
{
for ( var integer vl_fsmIdx := 0; vl_fsmIdx < 2 ; vl_fsmIdx := vl_fsmIdx+1 )
{
vl_varName := f_EPTF_LGenBase_varNameOfFSMVar(pl_eIdx := vl_eIdx, pl_fsmIdx := vl_fsmIdx, pl_varName := "TCvar");
f_EPTF_Var_getContent(f_EPTF_Var_getId(vl_varName), vl_content);
vl_content.intVal := vl_content.intVal - 1;
f_EPTF_Var_adjustContent(f_EPTF_Var_getId(vl_varName), vl_content);
vl_content.intVal := vl_content.intVal + 1;
f_EPTF_Var_adjustContent(f_EPTF_Var_getId(vl_varName), vl_content);
}
}
}
case(TC) {
//nothing to do - ez alapbol volt modositva fenn.
}
case(SiblingFSM) {
for ( var integer vl_eIdx := 0; vl_eIdx < 3 ; vl_eIdx := vl_eIdx+1 )
{
vl_varName := f_EPTF_LGenBase_varNameOfSiblingFSMsVar(pl_tcIdx := 0, pl_eRelIdx := vl_eIdx, pl_varName := "TCvar");
f_EPTF_Var_getContent(f_EPTF_Var_getId(vl_varName), vl_content);
vl_content.intVal := vl_content.intVal - 1;
f_EPTF_Var_adjustContent(f_EPTF_Var_getId(vl_varName), vl_content);
vl_content.intVal := vl_content.intVal + 1;
f_EPTF_Var_adjustContent(f_EPTF_Var_getId(vl_varName), vl_content);
}
}
case else {
f_EPTF_Base_stop(inconc);
}
}
T_wait.start; T_wait.timeout;
var integer vl_value := -1;
select(pl_statScope) {
case(FSM) {
vl_value := f_EPTF_Var_getIntValue(f_EPTF_LGenBase_fsmVarIdOfFSMStat("TCshstat", 1, 0));
}
case(TC) {
vl_value := f_EPTF_Var_getIntValue(f_EPTF_LGenBase_fsmVarIdOfTCStat("TCshstat", 0));
}
case(SiblingFSM) {
vl_value := f_EPTF_Var_getIntValue(f_EPTF_LGenBase_fsmVarIdOfSiblingStat("TCshstat", 0, 1));
}
case else {
f_EPTF_Base_stop(inconc);
}
}
if(vl_value != pl_expectedValue) {
setverdict(fail, "value of statistics #1 "&int2str(vl_value)&" differs from expected value "&int2str(pl_expectedValue));
} else {
setverdict(pass);
}
action("TCshstat = ", vl_value);
f_EPTF_Base_cleanup_CT();
}
testcase tc_LGenBase_Test_fsmStatHandlerStatMeasProviders1()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_fsmStatHandlerStatMeasProviders(FSM, FSM, 24);
}
testcase tc_LGenBase_Test_fsmStatHandlerStatMeasProviders2()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_fsmStatHandlerStatMeasProviders(FSM, SiblingFSM, 47);
}
testcase tc_LGenBase_Test_fsmStatHandlerStatMeasProviders3()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_fsmStatHandlerStatMeasProviders(FSM, TC, 139);
}
testcase tc_LGenBase_Test_fsmStatHandlerStatMeasProviders4()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_fsmStatHandlerStatMeasProviders(SiblingFSM, SiblingFSM, 24);
}
testcase tc_LGenBase_Test_fsmStatHandlerStatMeasProviders5()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_fsmStatHandlerStatMeasProviders(SiblingFSM, TC, 70);
}
testcase tc_LGenBase_Test_fsmStatHandlerStatMeasProviders6()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_fsmStatHandlerStatMeasProviders(TC, TC, 24);
}
testcase tc_LGenBase_Test_fsmStatHandlerStatMeasProviders7()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_fsmStatHandlerStatMeasProviders(TC, FSM, 24);
}
testcase tc_LGenBase_Test_fsmStatHandlerStatMeasProviders8()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_fsmStatHandlerStatMeasProviders(TC, SiblingFSM, 24);
}
testcase tc_LGenBase_Test_fsmStatHandlerStatMeasProviders9()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_fsmStatHandlerStatMeasProviders(SiblingFSM, FSM, 24);
}
testcase tc_LGenBase_Test_Neg_fsmStatHandlerStatMeasProviders1()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_EPTF_Base_init_CT("mtc");
f_EPTF_Base_setExpectedAssertMsg("*Invalid FSM object scope*");
f_LGenBase_Test_fsmStatHandlerStatMeasProviders(SiblingFSM, FSM, -1);
}
testcase tc_LGenBase_Test_Neg_fsmStatHandlerStatMeasProviders2()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_EPTF_Base_init_CT("mtc");
f_EPTF_Base_setExpectedAssertMsg("*Invalid FSM object scope*");
f_LGenBase_Test_fsmStatHandlerStatMeasProviders(TC, SiblingFSM, -1);
}
testcase tc_LGenBase_Test_Neg_fsmStatHandlerStatMeasProviders3()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_EPTF_Base_init_CT("mtc");
f_EPTF_Base_setExpectedAssertMsg("*Invalid FSM object scope*");
f_LGenBase_Test_fsmStatHandlerStatMeasProviders(TC, FSM, -1);
}
function f_LGenBase_Test_fsmStatHandlerStatHandlerProviders(
in EPTF_LGenBase_FsmObjectScopeDeclarator pl_providerScope,
in EPTF_LGenBase_FsmObjectScopeDeclarator pl_statScope,
in integer pl_expectedValue)
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_fsmVariables_init(3, "mtc");
v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1","input5");
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmVariablesFSM);
v_dummyInt := f_EPTF_LGenBase_declareFunction("checkFSMVarDiff", {testStepFunction:= refers(f_LGenBase_Test_checkFSMVarOfDiff)});
v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"checkVarEqual",refers( f_EPTF_LGenBase_checkVarEqual)});
var EPTF_LGenBase_FsmTableDeclarator vl_fsm1 :=
{
name := "myFSM1",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "TCvar",
initValue := {intVal := 23},
scope := pl_providerScope
}
}
},
{statHandlerStatList := {
{
name := "TCshstat_provider",
providers := {
{varList := {"TCvar"}}
},
statMethod := "Sum", // same scope, single provider, should be equal to the content of the provider
statResetValue := {intVal := 0},
scope := pl_providerScope
},
{
name := "TCshstat",
providers := {
{statHandler := "TCshstat_provider"}
},
statMethod := "Sum",
statResetValue := {intVal := 0},
scope := pl_statScope
}
}}
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{{"checkFSMVarDiff",{varNames := {"TCvar"}}}}, omit, omit}
}
}
}
}
}
var EPTF_LGenBase_FsmTableDeclarator vl_fsm2 :=
{
name := "myFSM2",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "TCvar",
initValue := {intVal := 23},
scope := pl_providerScope
}
}
},
{statHandlerStatList := {
{
name := "TCshstat_provider",
providers := {
{varList := {"TCvar"}}
},
statMethod := "Sum", // same scope, single provider, should be equal to the content of the provider
statResetValue := {intVal := 0},
scope := pl_providerScope
}
}}
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{{"checkFSMVarDiff",{varNames := {"TCvar"}}}}, omit, omit}
}
}
}
}
}
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(vl_fsm1);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(vl_fsm2);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{
"myFSM1", "myFSM2"
}
}
}
}
},
{}
});
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false);
timer T_wait := c_fsmStatHandlerVarProviders_refreshSubscribersPeriod + 1.0;
T_wait.start; T_wait.timeout;
var integer vl_value := -1;
select(pl_statScope) {
case(FSM) {
vl_value := f_EPTF_Var_getIntValue(f_EPTF_LGenBase_fsmVarIdOfFSMStat("TCshstat", 1, 0));
}
case(TC) {
vl_value := f_EPTF_Var_getIntValue(f_EPTF_LGenBase_fsmVarIdOfTCStat("TCshstat", 0));
}
case(SiblingFSM) {
vl_value := f_EPTF_Var_getIntValue(f_EPTF_LGenBase_fsmVarIdOfSiblingStat("TCshstat", 0, 1));
}
case else {
f_EPTF_Base_stop(inconc);
}
}
if(vl_value != pl_expectedValue) {
setverdict(fail, "value of statistics #1 "&int2str(vl_value)&" differs from expected value "&int2str(pl_expectedValue));
} else {
setverdict(pass);
}
action("TCshstat = ", vl_value);
f_EPTF_Base_cleanup_CT();
}
testcase tc_LGenBase_Test_fsmStatHandlerStatHandlerProviders1()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_fsmStatHandlerStatHandlerProviders(FSM, FSM, 23);
}
testcase tc_LGenBase_Test_fsmStatHandlerStatHandlerProviders2()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_fsmStatHandlerStatHandlerProviders(FSM, SiblingFSM, 46);
}
testcase tc_LGenBase_Test_fsmStatHandlerStatHandlerProviders3()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_fsmStatHandlerStatHandlerProviders(FSM, TC, 138);
}
testcase tc_LGenBase_Test_fsmStatHandlerStatHandlerProviders4()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_fsmStatHandlerStatHandlerProviders(SiblingFSM, SiblingFSM, 23);
}
testcase tc_LGenBase_Test_fsmStatHandlerStatHandlerProviders5()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_fsmStatHandlerStatHandlerProviders(SiblingFSM, TC, 69);
}
testcase tc_LGenBase_Test_fsmStatHandlerStatHandlerProviders6()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_fsmStatHandlerStatHandlerProviders(TC, TC, 23);
}
testcase tc_LGenBase_Test_fsmStatHandlerStatHandlerProviders7()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_fsmStatHandlerStatHandlerProviders(TC, FSM, 23);
}
testcase tc_LGenBase_Test_fsmStatHandlerStatHandlerProviders8()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_fsmStatHandlerStatHandlerProviders(TC, SiblingFSM, 23);
}
testcase tc_LGenBase_Test_fsmStatHandlerStatHandlerProviders9()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_LGenBase_Test_fsmStatHandlerStatHandlerProviders(SiblingFSM, FSM, 23);
}
testcase tc_LGenBase_Test_Neg_fsmStatHandlerStatHandlerProviders1()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_EPTF_Base_init_CT("mtc");
f_EPTF_Base_setExpectedAssertMsg("*Invalid FSM object scope*");
f_LGenBase_Test_fsmStatHandlerStatHandlerProviders(SiblingFSM, FSM, -1);
}
testcase tc_LGenBase_Test_Neg_fsmStatHandlerStatHandlerProviders2()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_EPTF_Base_init_CT("mtc");
f_EPTF_Base_setExpectedAssertMsg("*Invalid FSM object scope*");
f_LGenBase_Test_fsmStatHandlerStatHandlerProviders(TC, SiblingFSM, -1);
}
testcase tc_LGenBase_Test_Neg_fsmStatHandlerStatHandlerProviders3()
runs on EPTF_LGenBase_VarAndStatTest_CT
{
f_EPTF_Base_init_CT("mtc");
f_EPTF_Base_setExpectedAssertMsg("*Invalid FSM object scope*");
f_LGenBase_Test_fsmStatHandlerStatHandlerProviders(TC, FSM, -1);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_fsmVariablesFSMList
//
// Purpose:
// Tests if the
//
///////////////////////////////////////////////////////////
/* testcase tc_LGenBase_Test_statsFSMList()
runs on EPTF_LGenBase_CT{
const EPTF_LGenBase_FsmTableDeclarator c_fsm := {
name := "statsFSM1",
fsmParams := {
{stateList := {"idle"}},
{varList := {
{
name := "var1ofFSM1",
initValue := {floatVal := 1.0},
scope := FSM
}
}
},
{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 := {
}
}
}
}
*/
function f_LGenBase_Test_checkEventArgs(
in integer vl_eIdx,
in integer vl_expectedEIdx,
in integer vl_fsmCtxIdx,
in integer vl_expectedFsmCtxIdx,
in integer vl_behaviorIdx,
in integer vl_inputIdx,
in integer vl_varId,
in charstring pl_bName,
in charstring pl_iName,
in charstring pl_varName)
runs on EPTF_LGenBase_VarAndStatTest_CT
{
var integer vl_expectedInput := f_EPTF_LGenBase_inputNameIndex(pl_bName,pl_iName)
var integer vl_expectedBehav := f_EPTF_LGenBase_behaviorTypeNameIndex(pl_bName)
var integer vl_expectedVarId := -1
if("" != pl_varName){
vl_expectedVarId := f_EPTF_Var_getId(pl_varName)
}
if(vl_expectedBehav == v_LGenBase_VarAndStatTest_behav){
setverdict(pass)
}else{
setverdict(inconc," The calculated behavior index is ",vl_expectedBehav," instead of component variable ",v_LGenBase_VarAndStatTest_behav)
}
if(vl_eIdx == vl_expectedEIdx){
setverdict(pass)
}else{
setverdict(fail," The received entity index is ",vl_eIdx," but the entity of the FSM is ",vl_expectedEIdx)
}
if(vl_behaviorIdx == v_LGenBase_VarAndStatTest_behav){
setverdict(pass)
}else{
setverdict(fail," The received behavior idx is ",vl_behaviorIdx," instead of ",v_LGenBase_VarAndStatTest_behav)
}
if(vl_inputIdx == vl_expectedInput){
setverdict(pass)
}else{
setverdict(fail," The received input idx is ",vl_inputIdx," instead of ",vl_expectedInput)
}
if(vl_fsmCtxIdx == vl_expectedFsmCtxIdx){
setverdict(pass)
}else{
setverdict(fail," The received fsmCtxIdx is ",vl_fsmCtxIdx," instead of ",vl_expectedFsmCtxIdx)
}
if(vl_varId == vl_expectedVarId){
setverdict(pass)
}else{
setverdict(fail," The received varId is ",vl_varId," instead of ",vl_expectedVarId)
}
}
function f_LGenBase_Test_siblingDispatchCheckArgs1(in EPTF_LGenBase_TestStepArgs pl_ptr)
runs on EPTF_LGenBase_VarAndStatTest_CT
{
var integer vl_eIdx,
vl_fsmCtxIdx,
vl_behaviorIdx,
vl_inputIdx,
vl_varId
f_EPTF_LGenBase_fsmEventToSiblingFromStep(
pl_ptr,
vl_eIdx,
vl_fsmCtxIdx,
vl_behaviorIdx,
vl_inputIdx,
vl_varId)
var charstring vl_varName := f_EPTF_LGenBase_varNameOfFSMVar(pl_ptr.eIdx, pl_ptr.refContext.fCtxIdx, "FSMvar")
f_LGenBase_Test_checkEventArgs(
vl_eIdx,
pl_ptr.eIdx,
vl_fsmCtxIdx,
pl_ptr.refContext.fCtxIdx+1,
vl_behaviorIdx,
vl_inputIdx,
vl_varId,
"b1",
"input2",
vl_varName)
}
function f_LGenBase_Test_siblingDispatchCheckArgs2(in EPTF_LGenBase_TestStepArgs pl_ptr)
runs on EPTF_LGenBase_VarAndStatTest_CT
{
var integer vl_eIdx,
vl_fsmCtxIdx,
vl_behaviorIdx,
vl_inputIdx,
vl_varId
f_EPTF_LGenBase_fsmEventToSiblingFromStep(
pl_ptr,
vl_eIdx,
vl_fsmCtxIdx,
vl_behaviorIdx,
vl_inputIdx,
vl_varId)
f_LGenBase_Test_checkEventArgs(
vl_eIdx,
pl_ptr.eIdx,
vl_fsmCtxIdx,
pl_ptr.refContext.fCtxIdx+1,
vl_behaviorIdx,
vl_inputIdx,
vl_varId,
"b1",
"input2",
"")
}
function f_LGenBase_Test_siblingDispatchCheckArgs3(in EPTF_LGenBase_TestStepArgs pl_ptr)
runs on EPTF_LGenBase_VarAndStatTest_CT
{
var integer vl_eIdx,
vl_fsmCtxIdx,
vl_behaviorIdx,
vl_inputIdx,
vl_varId
f_EPTF_LGenBase_fsmEventToSiblingFromStep(
pl_ptr,
vl_eIdx,
vl_fsmCtxIdx,
vl_behaviorIdx,
vl_inputIdx,
vl_varId)
var integer vl_tcIdx := f_EPTF_LGenBase_tcIdxOfStep(pl_ptr)
var charstring vl_varName := f_EPTF_LGenBase_varNameOfTCVar(vl_tcIdx, "TCvar")
f_LGenBase_Test_checkEventArgs(
vl_eIdx,
pl_ptr.eIdx,
vl_fsmCtxIdx,
pl_ptr.refContext.fCtxIdx+1,
vl_behaviorIdx,
vl_inputIdx,
vl_varId,
"b1",
"input2",
vl_varName)
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_siblingDispatch1
//
// Purpose:
// Tests the correctness of the following test step functions : dispatchEventToSibling, postEventToSibling.
// Creates an fsm with an fsm variable and a testcase variable and a second sibling fsm with a testcase variable.
// Triggering manually the first fsm with startTC, we check that the basic index datas are correctly passed through
// the system. After that we test dispatching and posting the eventToSibling event by checking variable values which are
// set if the teststep of the second fsm receives the event.
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The tc is passed if the variable contains the correct values.
//
///////////////////////////////////////////////////////////
// Status: Ready, passed
testcase tc_LGenBase_Test_siblingDispatch1()
runs on EPTF_LGenBase_VarAndStatTest_CT{
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmSiblingFSM1 :=
{
name := "SiblingFSM1",
fsmParams := {
{stateList := {"idle","postcheck"}},
{varList :=
{
{
name := "FSMvar",
initValue := {integerlistVal := {1,2,3,4} },
scope := FSM
},
{
name := "TCvar",
initValue := {intVal := 0 },
scope := TC
}
/*, //Does not exist today
{
name := "SiblingFSMvar",
initValue := {integerlistVal := {9,10,11,12} },
scope := SiblingFSM
}*/
}
}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{{
{"siblingDispatchCheckArgs1",{
eventToSibling := {
"SiblingFSM2","b1","input2","FSMvar"}}
},
{"siblingDispatchCheckArgs2",{
eventToSibling := {
"SiblingFSM2","b1","input2",omit}}
},
{"siblingDispatchCheckArgs3",{
eventToSibling := {
"SiblingFSM2","b1","input2","TCvar"}}
},
{"checkVarEqual",{varParams := {"TCvar",{intVal := 0}}}},
{c_EPTF_LGenBase_stepName_dispatchEventToSibling,{
eventToSibling := {"SiblingFSM2","b1","input1","TCvar"}}
},
{"checkVarEqual",{varParams := {"TCvar",{intVal := 1}}}},
{c_EPTF_LGenBase_stepName_postEventToSibling,{
eventToSibling := {"SiblingFSM2","b1","input1","TCvar"}}
},
{"checkVarEqual",{varParams := {"TCvar",{intVal := 1}}}}
}, omit, "postcheck"},
//state[1]==postcheck
{{
{"checkVarEqual",{varParams := {"TCvar",{intVal := 2}}}}
}, omit, "postcheck"}
}
}
}
}
}
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmSiblingFSM2 :=
{
name := "SiblingFSM2",
fsmParams := {
{stateList := {"idle","state1"}},
{varList :=
{
{
name := "TCvar",
initValue := {intVal := 0 },
scope := TC
}
}
}
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{
{"LGenBase: Set variable",{varParams := {"TCvar",{intVal := 1}}}}
}, omit, "state1"},
//state[1]==state1
{{
{"LGenBase: Set variable",{varParams := {"TCvar",{intVal := 2}}}}
}, omit, omit}
}
}
}
}
}
f_LGenBase_Test_fsmVariables_init(3,"siblingDispatch1")
v_dummyInt := f_EPTF_LGenBase_declareFunction("siblingDispatchCheckArgs1", {testStepFunction:= refers(f_LGenBase_Test_siblingDispatchCheckArgs1)})
v_dummyInt := f_EPTF_LGenBase_declareFunction("siblingDispatchCheckArgs2", {testStepFunction:= refers(f_LGenBase_Test_siblingDispatchCheckArgs2)})
v_dummyInt := f_EPTF_LGenBase_declareFunction("siblingDispatchCheckArgs3", {testStepFunction:= refers(f_LGenBase_Test_siblingDispatchCheckArgs3)})
v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"checkVarEqual",refers( f_EPTF_LGenBase_checkIntVarEqual)})
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmSiblingFSM1);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmSiblingFSM2);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"DummyTcToLockFirstPlace",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"SiblingFSM2"}
}
}
},
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"SiblingFSM1","SiblingFSM2"}
}
}
}
},
{}
})
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false)
var EPTF_LGenBase_ReportedEventDescriptor vl_trigger := c_EPTF_LGenBase_emptyReportedEventDescriptor
vl_trigger.event.bIdx := c_EPTF_LGenBase_bIdx
vl_trigger.event.iIdx := c_EPTF_LGenBase_inputIdx_testMgmt_startTC
vl_trigger.event.target.eIdx := 1
vl_trigger.event.target.fsmCtxIdx := 1
f_EPTF_LGenBase_dispatchEvent(vl_trigger)
if(none == getverdict){
setverdict(fail,"The expected event handler has not been called.")
}
// to let altsteps to work:
timer t_wait := 0.1;
t_wait.start; t_wait.timeout;
f_EPTF_LGenBase_dispatchEvent(vl_trigger);
f_EPTF_Base_cleanup_CT()
}
function f_EPTF_LGenBase_checkIntVarEqual(
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.intVal,vl_varContent.intVal))
setverdict(fail)
}else{
log("The variables match!")
log(match(vl_param.intVal,vl_varContent.intVal))
setverdict(pass)
}
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_siblingFsm_Neg_activateFsm
//
// Purpose:
// Negative test - an fsm referring to a sibling fsm cannot be activated with activateFsm, it has only meaning within a traffic case.
//
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The tc is passed if the correct error message appears.
//
///////////////////////////////////////////////////////////
// Status: Ready, passed
testcase tc_LGenBase_Test_siblingFsm_Neg_activateFsm()
runs on EPTF_LGenBase_VarAndStatTest_CT{
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmSiblingFSM1 :=
{
name := "SiblingFSM1",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "TCvar",
initValue := {intVal := 0 },
scope := TC
}
}
}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_dispatchEventToSibling,{
eventToSibling := {"SiblingFSM2","b1","input1","TCvar"}}
}
}, omit, omit}
}
}
}
}
}
f_LGenBase_Test_fsmVariables_init(3,"siblingDispatch1")
f_EPTF_Base_setExpectedErrorMsg("*f_EPTF_LGenBase_activateFsm*sibling FSM*")
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmSiblingFSM1);
v_dummyInt := f_EPTF_LGenBase_activateFsm(pl_eIdx:= 0, pl_tIdx:= v_dummyInt, pl_sIdx:=0, pl_tcIdx:= 0)
f_EPTF_Base_cleanup_CT()
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_replyEvent
//
//
// Purpose:
// Tests the correctness of the following test step functions : dispatchReplyFromSibling, postReplyFromSibling.
// Creates an fsm with an fsm scope variable and a traffic case scope variable and a second sibling fsm with a traffic case variable.
// Triggering manually the first fsm with startTC, we test dispatching and posting the replyEvent event - replying to
// the previously dispatched and posted eventToSibling event by checking variable values which are
// set if the step receives the appropriate event.
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The tc is passed if the variable contains the correct values.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_replyEvent()
runs on EPTF_LGenBase_VarAndStatTest_CT{
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmSiblingFSM1 :=
{
name := "SiblingFSM1",
fsmParams := {
{stateList := {"idle","state2"}},
{varList :=
{
{
name := "FSMvar",
initValue := {integerlistVal := {1,2,3,4} },
scope := FSM
},
{
name := "TCvar",
initValue := {intVal := 0 },
scope := TC
}
}
}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_dispatchEventToSibling,{
eventToSibling := {"SiblingFSM2","b1","input1","TCvar"}}
},
{"checkVarEqual",{varParams := {"TCvar",{intVal := 2}}}}
}, omit, "state2"},
//state[1]==state2
{omit, omit, omit}
}
},
{eventToListen := {"b1","input2",fsm},
cellRow := {
//state[0]==idle
{{
{"checkVarEqual",{varParams := {"TCvar",{intVal := 1}}}},
{"LGenBase: Set variable",{varParams := {"TCvar",{intVal := 2}}}},
{c_EPTF_LGenBase_stepName_postEventToSibling,{
eventToSibling := {"SiblingFSM2","b1","input1","TCvar"}}
},
{"checkVarEqual",{varParams := {"TCvar",{intVal := 2}}}}
}, omit, "state2"},
//state[1]==state2
{{
{"checkVarEqual",{varParams := {"TCvar",{intVal := 3}}}},
{"LGenBase: Set variable",{varParams := {"TCvar",{intVal := 4}}}}
}, omit, omit}
}
}
}
}
}
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmSiblingFSM2 :=
{
name := "SiblingFSM2",
fsmParams := {
{stateList := {"idle","state1"}},
{varList :=
{
{
name := "TCvar",
initValue := {intVal := 0 },
scope := TC
}
}
}
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{
{"LGenBase: Set variable",{varParams := {"TCvar",{intVal := 1}}}},
{c_EPTF_LGenBase_stepName_dispatchReplyFromSibling,{
replyEvent := {"b1","input2","TCvar"}}
}
}, omit, "state1"},
//state[1]==state1
{{
{"checkVarEqual",{varParams := {"TCvar",{intVal := 2}}}},
{"LGenBase: Set variable",{varParams := {"TCvar",{intVal := 3}}}},
{c_EPTF_LGenBase_stepName_postReplyFromSibling,{
replyEvent := {"b1","input2","TCvar"}}
},
{"checkVarEqual",{varParams := {"TCvar",{intVal := 3}}}}
}, omit, omit}
}
}
}
}
}
f_LGenBase_Test_fsmVariables_init(3,"siblingDispatch1")
v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"checkVarEqual",refers( f_EPTF_LGenBase_checkIntVarEqual)})
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmSiblingFSM1);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmSiblingFSM2);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"DummyTcToLockFirstPlace",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"SiblingFSM2"}
}
}
},
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"SiblingFSM1","SiblingFSM2"}
}
}
}
},
{}
})
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false)
var EPTF_LGenBase_ReportedEventDescriptor vl_trigger := c_EPTF_LGenBase_emptyReportedEventDescriptor
vl_trigger.event.bIdx := c_EPTF_LGenBase_bIdx
vl_trigger.event.iIdx := c_EPTF_LGenBase_inputIdx_testMgmt_startTC
vl_trigger.event.target.eIdx := 1
vl_trigger.event.target.fsmCtxIdx := 1
f_EPTF_LGenBase_dispatchEvent(vl_trigger)
if(none == getverdict){
setverdict(fail,"The expected event handler has not been called.")
}
f_EPTF_Base_cleanup_CT()
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_replyEventOfFsm
//
//
// Purpose:
// Tests the correctness of the following test step functions : dispatchReplyEventOfFsmFromSibling, postReplyEventOfFsmFromSibling.
// Creates an fsm with an fsm variable and a traffic case scope variable and a second sibling fsm with a traffic case scope variable.
// Triggering manually the first fsm with startTC, we test dispatching and posting a replyEventofFsm event previously defined in the
// second fsm - replying to the previously dispatched and posted eventToSibling event - by checking variable values which are
// set if the teststep receives the appropriate event.
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The tc is passed if the variable contains the correct values.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_replyEventOfFsm()
runs on EPTF_LGenBase_VarAndStatTest_CT{
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmSiblingFSM1 :=
{
name := "SiblingFSM1",
fsmParams := {
{stateList := {"idle","state2"}},
{varList :=
{
{
name := "FSMvar",
initValue := {integerlistVal := {1,2,3,4} },
scope := FSM
},
{
name := "TCvar",
initValue := {intVal := 0 },
scope := TC
}
}
}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_dispatchEventToSibling,{
eventToSibling := {"SiblingFSM2","b1","input1","TCvar"}}
},
{"checkVarEqual",{varParams := {"TCvar",{intVal := 2}}}}
}, omit, "state2"},
//state[1]==state2
{omit, omit, omit}
}
},
{eventToListen := {"SiblingFSM2","g2",fsm},
cellRow := {
//state[0]==idle
{{
{"checkVarEqual",{varParams := {"TCvar",{intVal := 1}}}},
{"LGenBase: Set variable",{varParams := {"TCvar",{intVal := 2}}}},
{c_EPTF_LGenBase_stepName_postEventToSibling,{
eventToSibling := {"SiblingFSM2","b1","input1","TCvar"}}
}
,{"checkVarEqual",{varParams := {"TCvar",{intVal := 2}}}}
}, omit, "state2"},
//state[1]==state2
{{
// {"checkVarEqual",{varParams := {"TCvar",{intVal := 3}}}},
{"LGenBase: Set variable",{varParams := {"TCvar",{intVal := 4}}}}
}, omit, omit}
}
}
}
}
}
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmSiblingFSM2 :=
{
name := "SiblingFSM2",
fsmParams := {
{stateList := {"idle","state1"}},
{varList :=
{
{
name := "TCvar",
initValue := {intVal := 0 },
scope := TC
}
}
},
{declareEvents := {false, {"g2"}} }
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{
{"LGenBase: Set variable",{varParams := {"TCvar",{intVal := 1}}}},
{c_EPTF_LGenBase_stepName_dispatchReplyWithEventOfFsmFromSibling,{
eventOfFsm := {"g2","TCvar"}}
}
}, omit, "state1"},
//state[1]==state1
{{
{"checkVarEqual",{varParams := {"TCvar",{intVal := 2}}}},
{"LGenBase: Set variable",{varParams := {"TCvar",{intVal := 3}}}},
{c_EPTF_LGenBase_stepName_postReplyWithEventOfFsmFromSibling,{
eventOfFsm := {"g2","TCvar"}}
},
{"checkVarEqual",{varParams := {"TCvar",{intVal := 3}}}}
}, omit, omit}
}
}
}
}
}
f_LGenBase_Test_fsmVariables_init(3,"siblingDispatch1")
v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_LGenBase_behavior, {"checkVarEqual",refers( f_EPTF_LGenBase_checkIntVarEqual)})
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmSiblingFSM2);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmSiblingFSM1);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"DummyTcToLockFirstPlace",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"SiblingFSM2"}
}
}
},
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"SiblingFSM1","SiblingFSM2"}
}
}
}
},
{}
})
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false)
var EPTF_LGenBase_ReportedEventDescriptor vl_trigger := c_EPTF_LGenBase_emptyReportedEventDescriptor
vl_trigger.event.bIdx := c_EPTF_LGenBase_bIdx
vl_trigger.event.iIdx := c_EPTF_LGenBase_inputIdx_testMgmt_startTC
vl_trigger.event.target.eIdx := 1
vl_trigger.event.target.fsmCtxIdx := 1
f_EPTF_LGenBase_dispatchEvent(vl_trigger)
if(none == getverdict){
setverdict(fail,"The expected event handler has not been called.")
}
f_EPTF_Base_cleanup_CT()
}
//////////////////////////////////////////////////////////////////////////////////////////////////
//EPTF_LGenBase_ReplyEvent
//f_EPTF_LGenBase_fsmReplyEventFromStep
const integer c_LGenBase_Test_DispatchReplySourceEntity := 2
function f_LGenBase_Test_checkReplyArgs(in EPTF_LGenBase_TestStepArgs pl_ptr)
runs on EPTF_LGenBase_VarAndStatTest_CT{
var charstring vl_varName := f_EPTF_LGenBase_varNameOfFSMVar(pl_ptr.eIdx, pl_ptr.refContext.fCtxIdx, "FSMvar")
var integer vl_eIdx,
vl_fsmCtxIdx,
vl_behaviorIdx,
vl_inputIdx,
vl_varId
f_EPTF_LGenBase_fsmReplyEventFromStep(
pl_ptr,
vl_behaviorIdx,
vl_inputIdx,
vl_varId)
f_LGenBase_Test_checkEventArgs(vl_eIdx,
pl_ptr.reportedEvent.event.source.eIdx,
vl_fsmCtxIdx,
pl_ptr.reportedEvent.event.source.fsmCtxIdx,
vl_behaviorIdx,
vl_inputIdx,
vl_varId,
"b1",
"input2",
vl_varName)
}
function f_LGenBase_Test_checkReplyArgs2(in EPTF_LGenBase_TestStepArgs pl_ptr)
runs on EPTF_LGenBase_VarAndStatTest_CT{
var integer vl_eIdx,
vl_fsmCtxIdx,
vl_behaviorIdx,
vl_inputIdx,
vl_varId
f_EPTF_LGenBase_fsmReplyEventFromStep(
pl_ptr,
vl_behaviorIdx,
vl_inputIdx,
vl_varId)
f_LGenBase_Test_checkEventArgs(vl_eIdx,
pl_ptr.reportedEvent.event.source.eIdx,
vl_fsmCtxIdx,
pl_ptr.reportedEvent.event.source.fsmCtxIdx,
vl_behaviorIdx,
vl_inputIdx,
vl_varId,
"b1",
"input2",
"")
}
group siblingFSMNegativeTests{
const EPTF_LGenBase_ScenarioTypeDeclarator c_LGenBase_Test_siblingInvalidTestScenario := {
"SC1",
{
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"NegativeSiblingFSM1","NegativeSiblingFSM2"}
}
}
},
{"TC2",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"NegativeSiblingFSM2"}
}
}
}
},
{}
}
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmDummyFSM :=
{
name := "fsmDummyFSM",
fsmParams := {
{stateList := {"idle"}}
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{omit, omit, omit}
}
}
}
}
}
private function f_LGenBase_siblingInvalidSiblingParameters(
in charstring pl_errorMsg,
in EPTF_LGenBase_EventToSibling pl_eventToSibling
)
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_fsmVariables_init(3,"siblingInvalidSiblingName")
f_EPTF_Base_setExpectedErrorMsg(pl_errorMsg)
var EPTF_LGenBase_FsmTableDeclarator vl_fsm :=
{
name := "NegativeSiblingFSM1",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "bubuVar",
initValue := {floatVal := 23.0},
scope := TC
}
}
}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//The used step is irrelevant. We check the argument declaration
{{{c_EPTF_LGenBase_StepFunction_startEntity,{
eventToSibling := pl_eventToSibling}
}}, omit, omit}
}
}
}
}
}
var EPTF_LGenBase_FsmTableDeclarator vl_fsm2 := c_LGenBase_Test_fsmDummyFSM
vl_fsm2.name := "NegativeSiblingFSM2"
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(vl_fsm2)
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(vl_fsm)
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(c_LGenBase_Test_siblingInvalidTestScenario)
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false)
f_EPTF_Base_cleanup_CT()
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_siblingInvalidSiblingName
//
// Purpose:
// Negative test to ensure that LGenBase handles if the the following parameter of an eventToSibling test step
// argument type is incorrect: sibling name
//
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The tc is passed if the correct error message appears.
//
///////////////////////////////////////////////////////////
// Status: Ready, passed
testcase tc_LGenBase_Test_siblingInvalidSiblingName()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_siblingInvalidSiblingParameters(
"*There is no sibling FSM*UndeclaredFSM2*eg1.SC1.TC1*NegativeSiblingFSM1*",
{
"UndeclaredFSM2",
"b1",
"input2",
"bubuVar"
}
);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_siblingInvalidSiblingNameWithoutVarName
//
// Purpose:
// Negative test to ensure that LGenBase handles if the the following parameter of an eventToSibling test step
// argument type is incorrect: sibling name
// This testcase also tests if a VarNameArg parameter is not given.
//
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The tc is passed if the correct error message appears.
//
///////////////////////////////////////////////////////////
// Status: Ready, passed
testcase tc_LGenBase_Test_siblingInvalidSiblingNameWithoutVarName()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_siblingInvalidSiblingParameters(
"*There is no sibling FSM*UndeclaredFSM2*eg1.SC1.TC1*NegativeSiblingFSM1*",
{
"UndeclaredFSM2",
"b1",
"input2",
omit
}
);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_siblingInvalidSiblingBehaviorName
//
// Purpose:
// Negative test to ensure that LGenBase handles if the the following parameter of an eventToSibling test step
// argument type is incorrect: behavior name
//
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The tc is passed if the correct error message appears.
//
///////////////////////////////////////////////////////////
// Status: Ready, passed
testcase tc_LGenBase_Test_siblingInvalidSiblingBehaviorName()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_siblingInvalidSiblingParameters(
"*Invalid behavior name*b2*NegativeSiblingFSM1*",
{
"NegativeSiblingFSM2",
"b2",
"input2",
"bubuVar"
}
);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_siblingInvalidSiblingInputName
//
// Purpose:
// Negative test to ensure that LGenBase handles if the the following parameter of an eventToSibling test step
// argument type is incorrect: input name
//
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The tc is passed if the correct error message appears.
//
///////////////////////////////////////////////////////////
// Status: Ready, passed
testcase tc_LGenBase_Test_siblingInvalidSiblingInputName()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_siblingInvalidSiblingParameters(
"*Invalid input name*input8*NegativeSiblingFSM1*",
{
"NegativeSiblingFSM2",
"b1",
"input8",
"bubuVar"
}
);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_siblingInvalidSiblingBehaviorPlusInput
//
// Purpose:
// Negative test to ensure that LGenBase handles if the the following parameter of an eventToSibling test step
// argument type is incorrect: behavior name and input name (all two parameters exist, but the input is not
// in the given behavior)
//
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The tc is passed if the correct error message appears.
//
///////////////////////////////////////////////////////////
// Status: Ready, passed
testcase tc_LGenBase_Test_siblingInvalidSiblingBehaviorPlusInput()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_siblingInvalidSiblingParameters(
"*Invalid input name*input2*NegativeSiblingFSM1*"&c_EPTF_LGenBase_behavior&"*",
{
"NegativeSiblingFSM2",
c_EPTF_LGenBase_behavior,
"input2",
"bubuVar"
}
);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_siblingInvalidSiblingVariableName
//
// Purpose:
// Negative test to ensure that LGenBase handles if the the following parameter of an eventToSibling test step
// argument type is incorrect: variable name
//
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The tc is passed if the correct error message appears.
//
///////////////////////////////////////////////////////////
// Status: Ready, passed
testcase tc_LGenBase_Test_siblingInvalidSiblingVariableName()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_siblingInvalidSiblingParameters(
"*Invalid variable name*bubuVar2*NegativeSiblingFSM1*",
{
"NegativeSiblingFSM2",
"b1",
"input1",
"bubuVar2"
}
);
}
private function f_LGenBase_replyInvalidParameters(
in charstring pl_errorMsg,
in EPTF_LGenBase_ReplyEvent pl_replyEvent
)
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_fsmVariables_init(3,"siblingInvalidSiblingName")
f_EPTF_Base_setExpectedErrorMsg(pl_errorMsg)
var EPTF_LGenBase_FsmTableDeclarator vl_fsm :=
{
name := "NegativeSiblingFSM1",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "bubuVar",
initValue := {floatVal := 23.0},
scope := TC
}
}
}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//The used step is irrelevant. We check the argument declaration
{{{c_EPTF_LGenBase_StepFunction_startEntity,{
replyEvent := pl_replyEvent}
}}, omit, omit}
}
}
}
}
}
var EPTF_LGenBase_FsmTableDeclarator vl_fsm2 := c_LGenBase_Test_fsmDummyFSM
vl_fsm2.name := "NegativeSiblingFSM2"
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(vl_fsm2)
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(vl_fsm)
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(c_LGenBase_Test_siblingInvalidTestScenario)
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false)
f_EPTF_Base_cleanup_CT()
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_replyInvalidBehaviorName
//
// Purpose:
// Negative test to ensure that LGenBase handles if the the following parameter of an replyEvent test step
// argument type is incorrect: behavior name
//
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The tc is passed if the correct error message appears.
//
///////////////////////////////////////////////////////////
// Status: Ready, passed
testcase tc_LGenBase_Test_replyInvalidBehaviorName()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_replyInvalidParameters(
"*Invalid behavior name*b2*NegativeSiblingFSM1*",
{
"b2",
"input2",
"bubuVar"
}
);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_replyInvalidInputName
//
// Purpose:
// Negative test to ensure that LGenBase handles if the the following parameter of an replyEvent test step
// argument type is incorrect: input name
//
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The tc is passed if the correct error message appears.
//
///////////////////////////////////////////////////////////
// Status: Ready, passed
testcase tc_LGenBase_Test_replyInvalidInputName()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_replyInvalidParameters(
"*Invalid input name*input8*NegativeSiblingFSM1*",
{
"b1",
"input8",
"bubuVar"
}
);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_replyInvalidBehaviorPlusInput
//
// Purpose:
// Negative test to ensure that LGenBase handles if the the following parameter of an replyEvent test step
// argument type is incorrect: behavior name and input name (all two parameters exist, but the input is not
// in the given behavior)
//
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The tc is passed if the correct error message appears.
//
///////////////////////////////////////////////////////////
// Status: Ready, passed
testcase tc_LGenBase_Test_replyInvalidBehaviorPlusInput()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_replyInvalidParameters(
"*Invalid input name*input2*NegativeSiblingFSM1*"&c_EPTF_LGenBase_behavior&"*",
{
c_EPTF_LGenBase_behavior,
"input2",
"bubuVar"
}
);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_replyInvalidVariableName
//
// Purpose:
// Negative test to ensure that LGenBase handles if the the following parameter of an replyEvent test step
// argument type is incorrect: variable name
//
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The tc is passed if the correct error message appears.
//
///////////////////////////////////////////////////////////
// Status: Ready, passed
testcase tc_LGenBase_Test_replyInvalidVariableName()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_replyInvalidParameters(
"*Invalid variable name*bubuVar2*NegativeSiblingFSM1*",
{
"b1",
"input1",
"bubuVar2"
}
);
}
}
group pushPopReplyTestSteps{
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_pushPopReply_Dispatch
//
// Purpose:
// Tests the correctness of the following test step functions : pushEventToStack, popEventFromStack, dispatchReplyToTopEventInStack.
// There are two fsms. First sends an event to the second one. The second one pushes it into his stack, then pops and pushes again.
// After a timer timeouts, reply for the first fsm will be sent via dispatch.
//
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The tc is passed if everything is correct.
//
///////////////////////////////////////////////////////////
// Status: Ready, passed
testcase tc_LGenBase_Test_pushPopReply_Dispatch()
runs on EPTF_LGenBase_VarAndStatTest_CT{
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmPushPopReply1 :=
{
name := "PushPopReplyFSM1",
fsmParams := {
{stateList := {"idle"}},
{varList :={ }
}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_dispatchEventToSibling,{
eventToSibling := {"PushPopReplyFSM2","b1","input1",omit}}
}
}, omit, omit}
}
},
{eventToListen := {"b1","input2",fsm},
cellRow := {
//state[0]==idle
{{
{"PushPopReplyCheck",omit
}
}, omit, omit}
}
}
}
}
}
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmPushPopReply2 :=
{
name := "PushPopReplyFSM2",
fsmParams := {
{stateList := {"idle"}},
{timerList := {{"timer1", 0.2}}},
{varList :={ }
}
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_pushEventToStack, omit
},
{c_EPTF_LGenBase_stepName_popEventFromStack,omit
},
{c_EPTF_LGenBase_stepName_pushEventToStack,omit
},
{c_EPTF_LGenBase_stepName_timerStart,{timerName:= "timer1" }
}
}, omit, omit}
}
},
{eventToListen := {c_EPTF_LGenBase_specialBName_timerTimeout,"timer1",fsm},
cellRow := {
{
{
{c_EPTF_LGenBase_stepName_dispatchReplyToTopEventInStack,{
replyEvent := {"b1","input2",omit}}
}
},
omit, omit
}
}
}
}
}
}
f_LGenBase_Test_fsmVariables_init(3,"siblingDispatch1")
v_dummyInt := f_EPTF_LGenBase_declareFunction("PushPopReplyCheck", {testStepFunction:= refers(f_LGenBase_Test_PushPopCheck)})
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmPushPopReply1);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmPushPopReply2);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"DummyTcToLockFirstPlace",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"PushPopReplyFSM2"}
}
}
},
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"PushPopReplyFSM1","PushPopReplyFSM2"}
}
}
}
},
{}
})
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false)
var EPTF_LGenBase_ReportedEventDescriptor vl_trigger := c_EPTF_LGenBase_emptyReportedEventDescriptor
vl_trigger.event.bIdx := c_EPTF_LGenBase_bIdx
vl_trigger.event.iIdx := c_EPTF_LGenBase_inputIdx_testMgmt_startTC
vl_trigger.event.target.eIdx := 1
vl_trigger.event.target.fsmCtxIdx := 1
f_EPTF_LGenBase_dispatchEvent(vl_trigger)
timer T_1
timer T_2
T_1.start(0.0)
T_2.start( 4.0 )
alt{
[v_LGenBase_testFinished] T_1.timeout {
setverdict(pass)
}
[] T_2.timeout {
setverdict(fail,"The reply event does not arrived to the first fsm")
}
}
f_EPTF_Base_cleanup_CT()
}
function f_LGenBase_Test_pushPopReply_stackOrder(
in EPTF_LGenBase_FsmActionDeclaratorList pl_testSteps1,
in EPTF_LGenBase_FsmActionDeclaratorList pl_testSteps2,
in EPTF_LGenBase_FsmActionDeclaratorList pl_testSteps3)
runs on EPTF_LGenBase_VarAndStatTest_CT{
var EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmPushPopReply1 :=
{
name := "PushPopReplyFSM1",
fsmParams := {
{stateList := {"idle"}},
{varList :={ }
}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_dispatchEventToSibling,{
eventToSibling := {"PushPopReplyFSM3","b1","input1",omit}}
}
}, omit, omit}
}
},
{eventToListen := {"b1","input2",fsm},
cellRow := {
//state[0]==idle
{pl_testSteps1, omit, omit}
}
}
}
}
}
var EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmPushPopReply2 :=
{
name := "PushPopReplyFSM2",
fsmParams := {
{stateList := {"idle"}},
{varList :={ }
}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_dispatchEventToSibling,{
eventToSibling := {"PushPopReplyFSM3","b1","input2",omit}}
}
}, omit, omit}
}
},
{eventToListen := {"b1","input2",fsm},
cellRow := {
//state[0]==idle
{pl_testSteps2, omit, omit}
}
}
}
}
}
var EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmPushPopReply3 :=
{
name := "PushPopReplyFSM3",
fsmParams := {
{stateList := {"idle"}},
{timerList := {{"timer1", 0.2}}},
{varList :={ }
}
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_pushEventToStack, omit
}
}, omit, omit}
}
},
{eventToListen := {"b1","input2",fsm},
cellRow := {
//state[0]==idle
{pl_testSteps3, omit, omit}
}
},
{eventToListen := {c_EPTF_LGenBase_specialBName_timerTimeout,"timer1",fsm},
cellRow := {
{
{
{c_EPTF_LGenBase_stepName_dispatchReplyToTopEventInStack,{
replyEvent := {"b1","input2",omit}}
}
},
omit, omit
}
}
}
}
}
}
f_LGenBase_Test_fsmVariables_init(3,"siblingDispatch1")
v_dummyInt := f_EPTF_LGenBase_declareFunction("PushPopReplyCheck", {testStepFunction:= refers(f_LGenBase_Test_PushPopCheck)})
v_dummyInt := f_EPTF_LGenBase_declareFunction("PushPopReplyCheckFail", {testStepFunction:= refers(f_LGenBase_Test_PushPopCheckFail)})
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmPushPopReply1);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmPushPopReply2);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmPushPopReply3);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"PushPopReplyFSM1","PushPopReplyFSM2","PushPopReplyFSM3"}
}
}
}
},
{}
})
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false)
var EPTF_LGenBase_ReportedEventDescriptor vl_trigger := c_EPTF_LGenBase_emptyReportedEventDescriptor
vl_trigger.event.bIdx := c_EPTF_LGenBase_bIdx
vl_trigger.event.iIdx := c_EPTF_LGenBase_inputIdx_testMgmt_startTC
vl_trigger.event.target.eIdx := 1
vl_trigger.event.target.fsmCtxIdx := 0
f_EPTF_LGenBase_dispatchEvent(vl_trigger)
vl_trigger.event.target.fsmCtxIdx := 1
f_EPTF_LGenBase_dispatchEvent(vl_trigger)
timer T_1
timer T_2
T_1.start(0.0)
T_2.start( 4.0 )
alt{
[v_LGenBase_testFinished] T_1.timeout {
setverdict(pass) //it could be that it was already set to false in a step
}
[] T_2.timeout {
setverdict(fail,"The reply event does not arrived")
}
}
f_EPTF_Base_cleanup_CT()
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_pushPopReply_stackOrder
//
// Purpose:
// Tests the correctness of the following test step functions : pushEventToStack, popEventFromStack, dispatchReplyToTopEventInStack.
// There are three fsms. First fsm sends an event to the third one. The third one pushes it into his stack.
// After this, the second fsm sends an event to the third one, and the third one pushes it also into his stack.
// After a timer timeouts, the third fsm pops from his stack and replies. Everything works fine, if the first fsm gets the reply.
//
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The tc is passed if everything is correct.
//
///////////////////////////////////////////////////////////
// Status: Ready, passed
testcase tc_LGenBase_Test_pushPopReply_stackOrder()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_pushPopReply_stackOrder(
{{"PushPopReplyCheck",omit}},
{{"PushPopReplyCheckFail",omit}},
{
{c_EPTF_LGenBase_stepName_pushEventToStack, omit},
{c_EPTF_LGenBase_stepName_popEventFromStack,omit},
{c_EPTF_LGenBase_stepName_timerStart, {timerName:= "timer1"}}
});
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_pushPopReply_stackOrder2
//
// Purpose:
// Tests the correctness of the following test step functions : pushEventToStack, popEventFromStack, dispatchReplyToTopEventInStack.
// There are three fsms. First fsm sends an event to the third one. The third one pushes it into his stack.
// After this, the second fsm sends an event to the third one, and the third one pushes it also into his stack.
// After a timer timeouts, the third fsm replies. Everything works fine, if the second fsm gets the reply.
//
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The tc is passed if everything is correct.
//
///////////////////////////////////////////////////////////
// Status: Ready, passed
testcase tc_LGenBase_Test_pushPopReply_stackOrder2()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_pushPopReply_stackOrder(
{{"PushPopReplyCheckFail",omit}},
{{"PushPopReplyCheck",omit}},
{
{c_EPTF_LGenBase_stepName_pushEventToStack, omit},
{c_EPTF_LGenBase_stepName_timerStart, {timerName:= "timer1"}}
});
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_pushPopReply_morePopThanPush
//
// Purpose:
// Negative test - if fsm is not correct, calls more pop than push then an error message arrives.
//
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The tc is passed if the correct error message arrives.
//
///////////////////////////////////////////////////////////
// Status: Ready, passed
testcase tc_LGenBase_Test_pushPopReply_morePopThanPush()
runs on EPTF_LGenBase_VarAndStatTest_CT{
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmPushPopReply1 :=
{
name := "PushPopReplyFSM1",
fsmParams := {
{stateList := {"idle"}},
{varList :={ }
}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_dispatchEventToSibling,{
eventToSibling := {"PushPopReplyFSM2","b1","input1",omit}}
}
}, omit, omit}
}
}
}
}
}
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmPushPopReply2 :=
{
name := "PushPopReplyFSM2",
fsmParams := {
{stateList := {"idle"}},
{timerList := {{"timer1", 0.2}}},
{varList :={ }
}
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_pushEventToStack, omit
},
{c_EPTF_LGenBase_stepName_popEventFromStack,omit
},
{c_EPTF_LGenBase_stepName_popEventFromStack,omit
}
}, omit, omit}
}
}
}
}
}
f_LGenBase_Test_fsmVariables_init(3,"siblingDispatch1")
// " - - Pop event from stack step function has been called without previous Push event to stack step function (or less push than pop step exists or the order is wrong ) in the FSM "
f_EPTF_Base_setExpectedAssertMsg("*Pop event from stack*Push event to stack*in the FSM*")
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmPushPopReply1);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmPushPopReply2);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"DummyTcToLockFirstPlace",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"PushPopReplyFSM2"}
}
}
},
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"PushPopReplyFSM1","PushPopReplyFSM2"}
}
}
}
},
{}
})
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false)
var EPTF_LGenBase_ReportedEventDescriptor vl_trigger := c_EPTF_LGenBase_emptyReportedEventDescriptor
vl_trigger.event.bIdx := c_EPTF_LGenBase_bIdx
vl_trigger.event.iIdx := c_EPTF_LGenBase_inputIdx_testMgmt_startTC
vl_trigger.event.target.eIdx := 1
vl_trigger.event.target.fsmCtxIdx := 1
f_EPTF_LGenBase_dispatchEvent(vl_trigger)
f_EPTF_Base_cleanup_CT()
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_pushPopReply_moreReplyThanPush
//
// Purpose:
// Negative test - if fsm is not correct, calls more reply and pop than push then an error message arrives.
//
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The tc is passed if everything is correct.
//
///////////////////////////////////////////////////////////
// Status: Ready, passed
testcase tc_LGenBase_Test_pushPopReply_moreReplyThanPush()
runs on EPTF_LGenBase_VarAndStatTest_CT{
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmPushPopReply1 :=
{
name := "PushPopReplyFSM1",
fsmParams := {
{stateList := {"idle"}},
{varList :={ }
}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_dispatchEventToSibling,{
eventToSibling := {"PushPopReplyFSM2","b1","input1",omit}}
}
}, omit, omit}
}
}
}
}
}
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmPushPopReply2 :=
{
name := "PushPopReplyFSM2",
fsmParams := {
{stateList := {"idle"}},
{timerList := {{"timer1", 0.2}}},
{varList :={ }
}
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_pushEventToStack, omit
},
{c_EPTF_LGenBase_stepName_dispatchReplyToTopEventInStack,{
replyEvent := {"b1","input2",omit}}
},
{c_EPTF_LGenBase_stepName_popEventFromStack,omit
},
{c_EPTF_LGenBase_stepName_dispatchReplyToTopEventInStack,{
replyEvent := {"b1","input2",omit}}
},
{c_EPTF_LGenBase_stepName_popEventFromStack,omit
}
}, omit, omit}
}
}
}
}
}
f_LGenBase_Test_fsmVariables_init(3,"siblingDispatch1")
// " - - Dispatch Reply to Top event in stack step function has been called without previous Push event to stack step function (or less push than reply step exists or the order is wrong ) in the FSM "
f_EPTF_Base_setExpectedAssertMsg("*Dispatch Reply to Top event in stack*Push event to stack*in the FSM*")
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmPushPopReply1);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmPushPopReply2);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"DummyTcToLockFirstPlace",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"PushPopReplyFSM2"}
}
}
},
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"PushPopReplyFSM1","PushPopReplyFSM2"}
}
}
}
},
{}
})
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false)
var EPTF_LGenBase_ReportedEventDescriptor vl_trigger := c_EPTF_LGenBase_emptyReportedEventDescriptor
vl_trigger.event.bIdx := c_EPTF_LGenBase_bIdx
vl_trigger.event.iIdx := c_EPTF_LGenBase_inputIdx_testMgmt_startTC
vl_trigger.event.target.eIdx := 1
vl_trigger.event.target.fsmCtxIdx := 1
f_EPTF_LGenBase_dispatchEvent(vl_trigger)
f_EPTF_Base_cleanup_CT()
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_pushPopReply_Post
//
// Purpose:
// Tests the correctness of the following test step functions : pushEventToStack, popEventFromStack, postReplyToTopEventInStack.
// There are two fsms. First sends an event to the second one. The second one pushes it into his stack, then pops and pushes again.
// After a timer timeouts, reply for the first fsm will be sent.
//
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The tc is passed if everything is correct.
//
///////////////////////////////////////////////////////////
// Status: Ready, passed
testcase tc_LGenBase_Test_pushPopReply_Post()
runs on EPTF_LGenBase_VarAndStatTest_CT{
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmPushPopReply1 :=
{
name := "PushPopReplyFSM1",
fsmParams := {
{stateList := {"idle"}},
{varList :={ }
}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_dispatchEventToSibling,{
eventToSibling := {"PushPopReplyFSM2","b1","input1",omit}}
}
}, omit, omit}
}
},
{eventToListen := {"b1","input2",fsm},
cellRow := {
//state[0]==idle
{{
{"PushPopReplyCheck",omit
}
}, omit, omit}
}
}
}
}
}
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmPushPopReply2 :=
{
name := "PushPopReplyFSM2",
fsmParams := {
{stateList := {"idle"}},
{timerList := {{"timer1", 0.2}}},
{varList :={ }
}
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_pushEventToStack, omit
},
{c_EPTF_LGenBase_stepName_timerStart,{timerName:= "timer1" }
}
}, omit, omit}
}
},
{eventToListen := {c_EPTF_LGenBase_specialBName_timerTimeout,"timer1",fsm},
cellRow := {
{{
{c_EPTF_LGenBase_stepName_postReplyToTopEventInStack,{
replyEvent := {"b1","input2",omit}}
}
}, omit, omit}
}
}
}
}
}
f_LGenBase_Test_fsmVariables_init(3,"siblingDispatch1")
v_dummyInt := f_EPTF_LGenBase_declareFunction("PushPopReplyCheck", {testStepFunction:= refers(f_LGenBase_Test_PushPopCheck)})
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmPushPopReply1);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmPushPopReply2);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"DummyTcToLockFirstPlace",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"PushPopReplyFSM2"}
}
}
},
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"PushPopReplyFSM1","PushPopReplyFSM2"}
}
}
}
},
{}
})
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false)
var EPTF_LGenBase_ReportedEventDescriptor vl_trigger := c_EPTF_LGenBase_emptyReportedEventDescriptor
vl_trigger.event.bIdx := c_EPTF_LGenBase_bIdx
vl_trigger.event.iIdx := c_EPTF_LGenBase_inputIdx_testMgmt_startTC
vl_trigger.event.target.eIdx := 1
vl_trigger.event.target.fsmCtxIdx := 1
f_EPTF_LGenBase_dispatchEvent(vl_trigger)
timer T_1
timer T_2
T_1.start(0.0)
T_2.start( 4.0 )
alt{
[v_LGenBase_testFinished] T_1.timeout {
setverdict(pass)
}
[] T_2.timeout {
setverdict(fail,"The reply event does not arrived to the first fsm")
}
}
f_EPTF_Base_cleanup_CT()
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_pushPostReply_morePostReplyThanPush
//
// Purpose:
// Negative test - if fsm is not correct, calls more post reply than push then an error message arrives.
//
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The tc is passed if everything is correct.
//
///////////////////////////////////////////////////////////
// Status: Ready, passed
testcase tc_LGenBase_Test_pushPostReply_morePostReplyThanPush()
runs on EPTF_LGenBase_VarAndStatTest_CT{
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmPushPopReply1 :=
{
name := "PushPopReplyFSM1",
fsmParams := {
{stateList := {"idle"}},
{varList :={ }
}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_dispatchEventToSibling,{
eventToSibling := {"PushPopReplyFSM2","b1","input1",omit}}
}
}, omit, omit}
}
},
{eventToListen := {"b1","input2",fsm},
cellRow := {
//state[0]==idle
{{
{"PushPopReplyCheck",omit
}
}, omit, omit}
}
}
}
}
}
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmPushPopReply2 :=
{
name := "PushPopReplyFSM2",
fsmParams := {
{stateList := {"idle"}},
{timerList := {{"timer1", 0.2}}},
{varList :={ }
}
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_timerStart,{timerName:= "timer1" }
}
}, omit, omit}
}
},
{eventToListen := {c_EPTF_LGenBase_specialBName_timerTimeout,"timer1",fsm},
cellRow := {
{{
{c_EPTF_LGenBase_stepName_postReplyToTopEventInStack,{
replyEvent := {"b1","input2",omit}}
}
}, omit, omit}
}
}
}
}
}
f_LGenBase_Test_fsmVariables_init(3,"siblingDispatch1")
// " - - Post Reply to Top event in stack step function has been called without previous Push event to stack step function (or less push than reply step exists or the order is wrong ) in the FSM "
f_EPTF_Base_setExpectedAssertMsg("*Post Reply to Top event in stack*Push event to stack*in the FSM*")
v_dummyInt := f_EPTF_LGenBase_declareFunction("PushPopReplyCheck", {testStepFunction:= refers(f_LGenBase_Test_PushPopCheck)})
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmPushPopReply1);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmPushPopReply2);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"DummyTcToLockFirstPlace",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"PushPopReplyFSM2"}
}
}
},
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"PushPopReplyFSM1","PushPopReplyFSM2"}
}
}
}
},
{}
})
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false)
var EPTF_LGenBase_ReportedEventDescriptor vl_trigger := c_EPTF_LGenBase_emptyReportedEventDescriptor
vl_trigger.event.bIdx := c_EPTF_LGenBase_bIdx
vl_trigger.event.iIdx := c_EPTF_LGenBase_inputIdx_testMgmt_startTC
vl_trigger.event.target.eIdx := 1
vl_trigger.event.target.fsmCtxIdx := 1
f_EPTF_LGenBase_dispatchEvent(vl_trigger)
timer T_1
timer T_2
T_1.start(0.0)
T_2.start( 4.0 )
alt{
[v_LGenBase_testFinished] T_1.timeout {
setverdict(pass)
}
[] T_2.timeout {
setverdict(fail,"The reply event does not arrived to the first fsm")
}
}
f_EPTF_Base_cleanup_CT()
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_pushPopReply_Reply2Both
//
// Purpose:
// Tests the correctness of the following test step functions : pushEventToStack, popEventFromStack, dispatchReplyToTopEventInStack.
// There are three fsms. First fsm sends an event to the third one. The third one pushes it into his stack.
// After this, the second fsm sends an event to the third one, and the third one pushes it also into his stack.
// After a timer timeouts, the third fsm replies two times (a pop between the two replies is required in order to
// answer to separate fsms). Everything works fine, if both fsm gets the reply.
//
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The tc is passed if everything is correct.
//
///////////////////////////////////////////////////////////
// Status: Ready, passed
testcase tc_LGenBase_Test_pushPopReply_Reply2Both()
runs on EPTF_LGenBase_VarAndStatTest_CT{
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmPushPopReply1 :=
{
name := "PushPopReplyFSM1",
fsmParams := {
{stateList := {"idle"}},
{varList :={ }
}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_dispatchEventToSibling,{
eventToSibling := {"PushPopReplyFSM3","b1","input1",omit}}
}
}, omit, omit}
}
},
{eventToListen := {"b1","input2",fsm},
cellRow := {
//state[0]==idle
{{
{"PushPopReplyCheckBoth",omit
}
}, omit, omit}
}
}
}
}
}
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmPushPopReply2 :=
{
name := "PushPopReplyFSM2",
fsmParams := {
{stateList := {"idle"}},
{varList :={ }
}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_dispatchEventToSibling,{
eventToSibling := {"PushPopReplyFSM3","b1","input2",omit}}
}
}, omit, omit}
}
},
{eventToListen := {"b1","input2",fsm},
cellRow := {
//state[0]==idle
{{
{"PushPopReplyCheckBoth",omit
}
}, omit, omit}
}
}
}
}
}
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmPushPopReply3 :=
{
name := "PushPopReplyFSM3",
fsmParams := {
{stateList := {"idle"}},
{timerList := {{"timer1", 0.2}}},
{varList :={ }
}
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_pushEventToStack, omit
}
}, omit, omit}
}
},
{eventToListen := {"b1","input2",fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_pushEventToStack, omit
},
{c_EPTF_LGenBase_stepName_timerStart,{timerName:= "timer1" }
}
}, omit, omit}
}
},
{eventToListen := {c_EPTF_LGenBase_specialBName_timerTimeout,"timer1",fsm},
cellRow := {
{{
{c_EPTF_LGenBase_stepName_dispatchReplyToTopEventInStack,{
replyEvent := {"b1","input2",omit}}
},
{c_EPTF_LGenBase_stepName_popEventFromStack,omit
},
{c_EPTF_LGenBase_stepName_dispatchReplyToTopEventInStack,{
replyEvent := {"b1","input2",omit}}
}
}, omit, omit}
}
}
}
}
}
f_LGenBase_Test_fsmVariables_init(3,"siblingDispatch1")
v_dummyInt := f_EPTF_LGenBase_declareFunction("PushPopReplyCheckBoth", {testStepFunction:= refers(f_LGenBase_Test_PushPopCheckBoth)})
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmPushPopReply1);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmPushPopReply2);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmPushPopReply3);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"PushPopReplyFSM1","PushPopReplyFSM2","PushPopReplyFSM3"}
}
}
}
},
{}
})
v_dummyInt := 0;
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false)
var EPTF_LGenBase_ReportedEventDescriptor vl_trigger := c_EPTF_LGenBase_emptyReportedEventDescriptor
vl_trigger.event.bIdx := c_EPTF_LGenBase_bIdx
vl_trigger.event.iIdx := c_EPTF_LGenBase_inputIdx_testMgmt_startTC
vl_trigger.event.target.eIdx := 1
vl_trigger.event.target.fsmCtxIdx := 0
f_EPTF_LGenBase_dispatchEvent(vl_trigger)
vl_trigger.event.target.fsmCtxIdx := 1
f_EPTF_LGenBase_dispatchEvent(vl_trigger)
timer T_1
timer T_2
T_1.start(0.0)
T_2.start( 4.0 )
alt{
[v_LGenBase_testFinished] T_1.timeout {
setverdict(pass)
}
[] T_2.timeout {
setverdict(fail,"The reply event does not arrived")
}
}
f_EPTF_Base_cleanup_CT()
}
function f_LGenBase_Test_PushPopCheck(in EPTF_LGenBase_TestStepArgs pl_ptr)
runs on EPTF_LGenBase_VarAndStatTest_CT
{
v_LGenBase_testFinished := true;
}
function f_LGenBase_Test_PushPopCheckFail(in EPTF_LGenBase_TestStepArgs pl_ptr)
runs on EPTF_LGenBase_VarAndStatTest_CT
{
v_LGenBase_testFinished := true;
setverdict(fail,"Wrong FSM has received the reply event. Push-Pop mechanism fails");
}
function f_LGenBase_Test_PushPopCheckBoth(in EPTF_LGenBase_TestStepArgs pl_ptr)
runs on EPTF_LGenBase_VarAndStatTest_CT
{
v_dummyInt := v_dummyInt + 1;
if ( v_dummyInt == 2){
v_LGenBase_testFinished := true;
}
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_pushPopReply_Reply2Times
//
// Purpose:
// Tests the correctness of the following test step functions : pushEventToStack, popEventFromStack, dispatchReplyToTopEventInStack.
// There are three fsms. First fsm sends an event to the third one. The third one pushes it into his stack.
// After this, the second fsm sends an event to the third one, and the third one pushes it also into his stack.
// After a timer timeouts, the third fsm replies two times (without a pop between the two replies in order to
// answer to the fsm twice).
//
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The tc is passed if everything is correct.
//
///////////////////////////////////////////////////////////
// Status: Ready, passed
testcase tc_LGenBase_Test_pushPopReply_Reply2Times()
runs on EPTF_LGenBase_VarAndStatTest_CT{
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmPushPopReply1 :=
{
name := "PushPopReplyFSM1",
fsmParams := {
{stateList := {"idle"}},
{varList :={ }
}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_dispatchEventToSibling,{
eventToSibling := {"PushPopReplyFSM3","b1","input1",omit}}
}
}, omit, omit}
}
}/*,
{eventToListen := {"b1","input2",fsm},
cellRow := {
//state[0]==idle
{{
{"PushPopReplyCheckBoth",omit
}
}, omit, omit}
}
}*/
}
}
}
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmPushPopReply2 :=
{
name := "PushPopReplyFSM2",
fsmParams := {
{stateList := {"idle"}},
{varList :={ }
}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_dispatchEventToSibling,{
eventToSibling := {"PushPopReplyFSM3","b1","input2",omit}}
}
}, omit, omit}
}
},
{eventToListen := {"b1","input2",fsm},
cellRow := {
//state[0]==idle
{{
{"PushPopReplyCheckBoth",omit
}
}, omit, omit}
}
}
}
}
}
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmPushPopReply3 :=
{
name := "PushPopReplyFSM3",
fsmParams := {
{stateList := {"idle"}},
{timerList := {{"timer1", 0.2}}},
{varList :={ }
}
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_pushEventToStack, omit
}
}, omit, omit}
}
},
{eventToListen := {"b1","input2",fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_pushEventToStack, omit
},
{c_EPTF_LGenBase_stepName_timerStart,{timerName:= "timer1" }
}
}, omit, omit}
}
},
{eventToListen := {c_EPTF_LGenBase_specialBName_timerTimeout,"timer1",fsm},
cellRow := {
{{
{c_EPTF_LGenBase_stepName_dispatchReplyToTopEventInStack,{
replyEvent := {"b1","input2",omit}}
},
{c_EPTF_LGenBase_stepName_dispatchReplyToTopEventInStack,{
replyEvent := {"b1","input2",omit}}
}
}, omit, omit}
}
}
}
}
}
f_LGenBase_Test_fsmVariables_init(3,"siblingDispatch1")
v_dummyInt := f_EPTF_LGenBase_declareFunction("PushPopReplyCheckBoth", {testStepFunction:= refers(f_LGenBase_Test_PushPopCheckBoth)})
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmPushPopReply1);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmPushPopReply2);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmPushPopReply3);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"PushPopReplyFSM1","PushPopReplyFSM2","PushPopReplyFSM3"}
}
}
}
},
{}
})
v_dummyInt := 0;
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false)
var EPTF_LGenBase_ReportedEventDescriptor vl_trigger := c_EPTF_LGenBase_emptyReportedEventDescriptor
vl_trigger.event.bIdx := c_EPTF_LGenBase_bIdx
vl_trigger.event.iIdx := c_EPTF_LGenBase_inputIdx_testMgmt_startTC
vl_trigger.event.target.eIdx := 1
vl_trigger.event.target.fsmCtxIdx := 0
f_EPTF_LGenBase_dispatchEvent(vl_trigger)
vl_trigger.event.target.fsmCtxIdx := 1
f_EPTF_LGenBase_dispatchEvent(vl_trigger)
timer T_1
timer T_2
T_1.start(0.0)
T_2.start( 4.0 )
alt{
[v_LGenBase_testFinished] T_1.timeout {
setverdict(pass)
}
[] T_2.timeout {
setverdict(fail,"The reply event does not arrived")
}
}
f_EPTF_Base_cleanup_CT()
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_pushPopReplyOwnEventDispatch
//
// Purpose:
// Tests the correctness of the following test step functions : dispatchReplyOwnEventToTopEventInStack.
// There are three fsms. First fsm sends an event to the third one. The third one pushes it into his stack.
// After this, the second fsm sends an event to the third one, and the third one pushes it also into his stack.
// After a timer timeouts, the third fsm replies with own events via method dispatch two times(a pop between the two
// replies is required in order to answer to separate fsms). Everything works fine, if both fsm gets the reply.
//
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The tc is passed if everything is correct.
//
///////////////////////////////////////////////////////////
// Status: Ready, passed
testcase tc_LGenBase_Test_pushPopReplyOwnEventDispatch()
runs on EPTF_LGenBase_VarAndStatTest_CT{
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmPushPopReply1 :=
{
name := "PushPopReplyFSM1",
fsmParams := {
{stateList := {"idle"}},
{varList :={ }
}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_dispatchEventToSibling,{
eventToSibling := {"PushPopReplyFSM3","b1","input1",omit}}
}
}, omit, omit}
}
},
{eventToListen := {"PushPopReplyFSM3","g1",fsm},
cellRow := {
//state[0]==idle
{{
{"PushPopReplyCheckBoth",omit
}
}, omit, omit}
}
}
}
}
}
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmPushPopReply2 :=
{
name := "PushPopReplyFSM2",
fsmParams := {
{stateList := {"idle"}},
{varList :={ }
}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_dispatchEventToSibling,{
eventToSibling := {"PushPopReplyFSM3","b1","input2",omit}}
}
}, omit, omit}
}
},
{eventToListen := {"PushPopReplyFSM3","g2",fsm},
cellRow := {
//state[0]==idle
{{
{"PushPopReplyCheckBoth",omit
}
}, omit, omit}
}
}
}
}
}
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmPushPopReply3 :=
{
name := "PushPopReplyFSM3",
fsmParams := {
{stateList := {"idle"}},
{timerList := {{"timer1", 0.2}}},
{varList :={ }},
{declareEvents := {false, {"g1","g2"}} }
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_pushEventToStack, omit
}
}, omit, omit}
}
},
{eventToListen := {"b1","input2",fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_pushEventToStack, omit
},
{c_EPTF_LGenBase_stepName_timerStart,{timerName:= "timer1" }
}
}, omit, omit}
}
},
{eventToListen := {c_EPTF_LGenBase_specialBName_timerTimeout,"timer1",fsm},
cellRow := {
{{
{c_EPTF_LGenBase_stepName_dispatchReplyOwnEventToTopEventInStack,{
eventOfFsm := {"g2",omit}}
},
{c_EPTF_LGenBase_stepName_popEventFromStack,omit
},
{c_EPTF_LGenBase_stepName_dispatchReplyOwnEventToTopEventInStack,{
eventOfFsm := {"g1",omit}}
}
}, omit, omit}
}
}
}
}
}
f_LGenBase_Test_fsmVariables_init(3,"siblingDispatch1")
v_dummyInt := f_EPTF_LGenBase_declareFunction("PushPopReplyCheckBoth", {testStepFunction:= refers(f_LGenBase_Test_PushPopCheckBoth)})
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmPushPopReply3);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmPushPopReply1);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmPushPopReply2);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"PushPopReplyFSM1","PushPopReplyFSM2","PushPopReplyFSM3"}
}
}
}
},
{}
})
v_dummyInt := 0;
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false)
var EPTF_LGenBase_ReportedEventDescriptor vl_trigger := c_EPTF_LGenBase_emptyReportedEventDescriptor
vl_trigger.event.bIdx := c_EPTF_LGenBase_bIdx
vl_trigger.event.iIdx := c_EPTF_LGenBase_inputIdx_testMgmt_startTC
vl_trigger.event.target.eIdx := 1
vl_trigger.event.target.fsmCtxIdx := 0
f_EPTF_LGenBase_dispatchEvent(vl_trigger)
vl_trigger.event.target.fsmCtxIdx := 1
f_EPTF_LGenBase_dispatchEvent(vl_trigger)
timer T_1
timer T_2
T_1.start(0.0)
T_2.start( 4.0 )
alt{
[v_LGenBase_testFinished] T_1.timeout {
setverdict(pass)
}
[] T_2.timeout {
setverdict(fail,"The reply event does not arrived")
}
}
f_EPTF_Base_cleanup_CT()
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_pushPopReply_moreOwnEventDispatch
//
// Purpose:
// Tests the correctness of the following test step functions : dispatchReplyOwnEventToTopEventInStack.
// There are three fsms. First fsm sends an event to the third one. The third one pushes it into his stack.
// After this, the second fsm sends an event to the third one, and the third one pushes it also into his stack.
// After a timer timeouts, the third fsm replies with own events via method dispatch two times(a pop between the two
// replies is required in order to answer to separate fsms). Everything works fine, if both fsm gets the reply.
// The third dispatch make a negative test for it.
//
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The tc is passed if everything is correct.
//
///////////////////////////////////////////////////////////
// Status: Ready, passed
testcase tc_LGenBase_Test_pushPopReply_moreOwnEventDispatch()
runs on EPTF_LGenBase_VarAndStatTest_CT{
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmPushPopReply1 :=
{
name := "PushPopReplyFSM1",
fsmParams := {
{stateList := {"idle"}},
{varList :={ }
}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_dispatchEventToSibling,{
eventToSibling := {"PushPopReplyFSM3","b1","input1",omit}}
}
}, omit, omit}
}
},
{eventToListen := {"PushPopReplyFSM3","g1",fsm},
cellRow := {
//state[0]==idle
{{
{"PushPopReplyCheckBoth",omit
}
}, omit, omit}
}
}
}
}
}
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmPushPopReply2 :=
{
name := "PushPopReplyFSM2",
fsmParams := {
{stateList := {"idle"}},
{varList :={ }
}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_dispatchEventToSibling,{
eventToSibling := {"PushPopReplyFSM3","b1","input2",omit}}
}
}, omit, omit}
}
},
{eventToListen := {"PushPopReplyFSM3","g2",fsm},
cellRow := {
//state[0]==idle
{{
{"PushPopReplyCheckBoth",omit
}
}, omit, omit}
}
}
}
}
}
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmPushPopReply3 :=
{
name := "PushPopReplyFSM3",
fsmParams := {
{stateList := {"idle"}},
{timerList := {{"timer1", 0.2}}},
{varList :={ }},
{declareEvents := {false, {"g1","g2"}} }
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_pushEventToStack, omit
}
}, omit, omit}
}
},
{eventToListen := {"b1","input2",fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_pushEventToStack, omit
},
{c_EPTF_LGenBase_stepName_timerStart,{timerName:= "timer1" }
}
}, omit, omit}
}
},
{eventToListen := {c_EPTF_LGenBase_specialBName_timerTimeout,"timer1",fsm},
cellRow := {
{{
{c_EPTF_LGenBase_stepName_dispatchReplyOwnEventToTopEventInStack,{
eventOfFsm := {"g2",omit}}
},
{c_EPTF_LGenBase_stepName_popEventFromStack,omit
},
{c_EPTF_LGenBase_stepName_dispatchReplyOwnEventToTopEventInStack,{
eventOfFsm := {"g1",omit}}
},
{c_EPTF_LGenBase_stepName_popEventFromStack,omit
},
{c_EPTF_LGenBase_stepName_dispatchReplyOwnEventToTopEventInStack,{
eventOfFsm := {"g1",omit}}
}
}, omit, omit}
}
}
}
}
}
f_LGenBase_Test_fsmVariables_init(3,"siblingDispatch1")
// " - - Dispatch Reply to Own To Top event in stack step function has been called without previous Push event to stack step function (or less push than pop step exists or the order is wrong ) in the FSM "
f_EPTF_Base_setExpectedAssertMsg("*Dispatch Reply to Own To Top event in stack*Push event to stack*in the FSM*")
v_dummyInt := f_EPTF_LGenBase_declareFunction("PushPopReplyCheckBoth", {testStepFunction:= refers(f_LGenBase_Test_PushPopCheckBoth)})
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmPushPopReply3);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmPushPopReply1);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmPushPopReply2);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"PushPopReplyFSM1","PushPopReplyFSM2","PushPopReplyFSM3"}
}
}
}
},
{}
})
v_dummyInt := 0;
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false)
var EPTF_LGenBase_ReportedEventDescriptor vl_trigger := c_EPTF_LGenBase_emptyReportedEventDescriptor
vl_trigger.event.bIdx := c_EPTF_LGenBase_bIdx
vl_trigger.event.iIdx := c_EPTF_LGenBase_inputIdx_testMgmt_startTC
vl_trigger.event.target.eIdx := 1
vl_trigger.event.target.fsmCtxIdx := 0
f_EPTF_LGenBase_dispatchEvent(vl_trigger)
vl_trigger.event.target.fsmCtxIdx := 1
f_EPTF_LGenBase_dispatchEvent(vl_trigger)
timer T_1
timer T_2
T_1.start(0.0)
T_2.start( 4.0 )
alt{
[v_LGenBase_testFinished] T_1.timeout {
setverdict(pass)
}
[] T_2.timeout {
setverdict(fail,"The reply event does not arrived")
}
}
f_EPTF_Base_cleanup_CT()
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_pushPopReplyOwnEventPost
//
// Purpose:
// Tests the correctness of the following test step functions : postReplyOwnEventToTopEventInStack.
// There are three fsms. First fsm sends an event to the third one. The third one pushes it into his stack.
// After this, the second fsm sends an event to the third one, and the third one pushes it also into his stack.
// After a timer timeouts, the third fsm replies with own events with method post two times (a pop between the
// two replies is required in order to answer to separate fsms). Everything works fine, if both fsm gets the reply.
//
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The tc is passed if everything is correct.
//
///////////////////////////////////////////////////////////
// Status: Ready, passed
testcase tc_LGenBase_Test_pushPopReplyOwnEventPost()
runs on EPTF_LGenBase_VarAndStatTest_CT{
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmPushPopReply1 :=
{
name := "PushPopReplyFSM1",
fsmParams := {
{stateList := {"idle"}},
{varList :={ }
}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_dispatchEventToSibling,{
eventToSibling := {"PushPopReplyFSM3","b1","input1",omit}}
}
}, omit, omit}
}
},
{eventToListen := {"PushPopReplyFSM3","g1",fsm},
cellRow := {
//state[0]==idle
{{
{"PushPopReplyCheckBoth",omit
}
}, omit, omit}
}
}
}
}
}
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmPushPopReply2 :=
{
name := "PushPopReplyFSM2",
fsmParams := {
{stateList := {"idle"}},
{varList :={ }
}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_dispatchEventToSibling,{
eventToSibling := {"PushPopReplyFSM3","b1","input2",omit}}
}
}, omit, omit}
}
},
{eventToListen := {"PushPopReplyFSM3","g2",fsm},
cellRow := {
//state[0]==idle
{{
{"PushPopReplyCheckBoth",omit
}
}, omit, omit}
}
}
}
}
}
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmPushPopReply3 :=
{
name := "PushPopReplyFSM3",
fsmParams := {
{stateList := {"idle"}},
{timerList := {{"timer1", 0.2}}},
{varList :={ }},
{declareEvents := {false, {"g1","g2"}} }
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_pushEventToStack, omit
}
}, omit, omit}
}
},
{eventToListen := {"b1","input2",fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_pushEventToStack, omit
},
{c_EPTF_LGenBase_stepName_timerStart,{timerName:= "timer1" }
}
}, omit, omit}
}
},
{eventToListen := {c_EPTF_LGenBase_specialBName_timerTimeout,"timer1",fsm},
cellRow := {
{{
{c_EPTF_LGenBase_stepName_postReplyOwnEventToTopEventInStack,{
eventOfFsm := {"g2",omit}}
},
{c_EPTF_LGenBase_stepName_popEventFromStack,omit
},
{c_EPTF_LGenBase_stepName_postReplyOwnEventToTopEventInStack,{
eventOfFsm := {"g1",omit}}
}
}, omit, omit}
}
}
}
}
}
f_LGenBase_Test_fsmVariables_init(3,"siblingDispatch1")
v_dummyInt := f_EPTF_LGenBase_declareFunction("PushPopReplyCheckBoth", {testStepFunction:= refers(f_LGenBase_Test_PushPopCheckBoth)})
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmPushPopReply3);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmPushPopReply1);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmPushPopReply2);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"PushPopReplyFSM1","PushPopReplyFSM2","PushPopReplyFSM3"}
}
}
}
},
{}
})
v_dummyInt := 0;
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false)
var EPTF_LGenBase_ReportedEventDescriptor vl_trigger := c_EPTF_LGenBase_emptyReportedEventDescriptor
vl_trigger.event.bIdx := c_EPTF_LGenBase_bIdx
vl_trigger.event.iIdx := c_EPTF_LGenBase_inputIdx_testMgmt_startTC
vl_trigger.event.target.eIdx := 1
vl_trigger.event.target.fsmCtxIdx := 0
f_EPTF_LGenBase_dispatchEvent(vl_trigger)
vl_trigger.event.target.fsmCtxIdx := 1
f_EPTF_LGenBase_dispatchEvent(vl_trigger)
timer T_1
timer T_2
T_1.start(0.0)
T_2.start( 4.0 )
alt{
[v_LGenBase_testFinished] T_1.timeout {
setverdict(pass)
}
[] T_2.timeout {
setverdict(fail,"The reply event does not arrived")
}
}
f_EPTF_Base_cleanup_CT()
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_pushPopReply_moreOwnEventPost
//
// Purpose:
// Tests the correctness of the following test step functions : postReplyOwnEventToTopEventInStack.
// There are three fsms. First fsm sends an event to the third one. The third one pushes it into his stack.
// After this, the second fsm sends an event to the third one, and the third one pushes it also into his stack.
// After a timer timeouts, the third fsm replies with own events with method post two times (a pop between the
// two replies is required in order to answer to separate fsms). Everything works fine, if both fsm gets the reply.
// The third dispatch make a negative test for it.
//
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The tc is passed if everything is correct.
//
///////////////////////////////////////////////////////////
// Status: Ready, passed
testcase tc_LGenBase_Test_pushPopReply_moreOwnEventPost()
runs on EPTF_LGenBase_VarAndStatTest_CT{
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmPushPopReply1 :=
{
name := "PushPopReplyFSM1",
fsmParams := {
{stateList := {"idle"}},
{varList :={ }
}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_dispatchEventToSibling,{
eventToSibling := {"PushPopReplyFSM3","b1","input1",omit}}
}
}, omit, omit}
}
},
{eventToListen := {"PushPopReplyFSM3","g1",fsm},
cellRow := {
//state[0]==idle
{{
{"PushPopReplyCheckBoth",omit
}
}, omit, omit}
}
}
}
}
}
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmPushPopReply2 :=
{
name := "PushPopReplyFSM2",
fsmParams := {
{stateList := {"idle"}},
{varList :={ }
}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_dispatchEventToSibling,{
eventToSibling := {"PushPopReplyFSM3","b1","input2",omit}}
}
}, omit, omit}
}
},
{eventToListen := {"PushPopReplyFSM3","g2",fsm},
cellRow := {
//state[0]==idle
{{
{"PushPopReplyCheckBoth",omit
}
}, omit, omit}
}
}
}
}
}
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmPushPopReply3 :=
{
name := "PushPopReplyFSM3",
fsmParams := {
{stateList := {"idle"}},
{timerList := {{"timer1", 0.2}}},
{varList :={ }},
{declareEvents := {false, {"g1","g2"}} }
},
table := {
classicTable := {
{eventToListen := {"b1","input1",fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_pushEventToStack, omit
}
}, omit, omit}
}
},
{eventToListen := {"b1","input2",fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_pushEventToStack, omit
},
{c_EPTF_LGenBase_stepName_timerStart,{timerName:= "timer1" }
}
}, omit, omit}
}
},
{eventToListen := {c_EPTF_LGenBase_specialBName_timerTimeout,"timer1",fsm},
cellRow := {
{{
{c_EPTF_LGenBase_stepName_postReplyOwnEventToTopEventInStack,{
eventOfFsm := {"g2",omit}}
},
{c_EPTF_LGenBase_stepName_popEventFromStack,omit
},
{c_EPTF_LGenBase_stepName_postReplyOwnEventToTopEventInStack,{
eventOfFsm := {"g1",omit}}
},
{c_EPTF_LGenBase_stepName_popEventFromStack,omit
},
{c_EPTF_LGenBase_stepName_postReplyOwnEventToTopEventInStack,{
eventOfFsm := {"g1",omit}}
}
}, omit, omit}
}
}
}
}
}
f_LGenBase_Test_fsmVariables_init(3,"siblingDispatch1")
// " - - Post Reply to Own To Top event in stack step function has been called without previous Push event to stack step function (or less push than reply step exists or the order is wrong ) in the FSM "
f_EPTF_Base_setExpectedAssertMsg("*Post Reply to Own To Top event in stack*Push event to stack*in the FSM*")
v_dummyInt := f_EPTF_LGenBase_declareFunction("PushPopReplyCheckBoth", {testStepFunction:= refers(f_LGenBase_Test_PushPopCheckBoth)})
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmPushPopReply3);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmPushPopReply1);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmPushPopReply2);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"PushPopReplyFSM1","PushPopReplyFSM2","PushPopReplyFSM3"}
}
}
}
},
{}
})
v_dummyInt := 0;
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false)
var EPTF_LGenBase_ReportedEventDescriptor vl_trigger := c_EPTF_LGenBase_emptyReportedEventDescriptor
vl_trigger.event.bIdx := c_EPTF_LGenBase_bIdx
vl_trigger.event.iIdx := c_EPTF_LGenBase_inputIdx_testMgmt_startTC
vl_trigger.event.target.eIdx := 1
vl_trigger.event.target.fsmCtxIdx := 0
f_EPTF_LGenBase_dispatchEvent(vl_trigger)
vl_trigger.event.target.fsmCtxIdx := 1
f_EPTF_LGenBase_dispatchEvent(vl_trigger)
timer T_1
timer T_2
T_1.start(0.0)
T_2.start( 4.0 )
alt{
[v_LGenBase_testFinished] T_1.timeout {
setverdict(pass)
}
[] T_2.timeout {
setverdict(fail,"The reply event does not arrived")
}
}
f_EPTF_Base_cleanup_CT()
}
}
group eventToTCTests {
private function f_LGenBase_invalidEventToTC(
in charstring pl_errorMsg,
in EPTF_LGenBase_EventToTC pl_eventToTC
)
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_Test_fsmVariables_init(3,"invalidEventToTC")
f_EPTF_Base_setExpectedErrorMsg(pl_errorMsg)
var EPTF_LGenBase_FsmTableDeclarator vl_fsm :=
{
name := "NegativeSiblingFSM1",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "bubuVar",
initValue := {floatVal := 23.0},
scope := TC
}
}
}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//The used step is irrelevant. We check the argument declaration
{{{c_EPTF_LGenBase_StepFunction_startEntity,{
eventToTC := pl_eventToTC}
}}, omit, omit}
}
}
}
}
}
var EPTF_LGenBase_FsmTableDeclarator vl_fsm2 := c_LGenBase_Test_fsmDummyFSM
vl_fsm2.name := "NegativeSiblingFSM2"
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(vl_fsm2)
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(vl_fsm)
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(c_LGenBase_Test_siblingInvalidTestScenario)
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false)
f_EPTF_Base_cleanup_CT()
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_invalidEventToTC_tcName
//
// Purpose:
// Negative test to ensure that LGenBase logs an error if the following field
// of EventToTC test step argument is incorrect: tcName
//
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The tc is passed if the correct error message appears.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_invalidEventToTC_tcName()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_invalidEventToTC(
"*There is no traffic case*UndeclaredTC*SC1*NegativeSiblingFSM1*",
{
"UndeclaredTC",
"b1",
"input2",
"bubuVar"
}
);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_invalidEventToTC_behaviorName
//
// Purpose:
// Negative test to ensure that LGenBase logs an error if the following field
// of EventToTC test step argument is incorrect: behaviorName
//
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The tc is passed if the correct error message appears.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_invalidEventToTC_behaviorName()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_invalidEventToTC(
"*Invalid behavior name*UndeclaredBehavior*NegativeSiblingFSM1*",
{
"TC2",
"UndeclaredBehavior",
"input2",
"bubuVar"
}
);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_invalidEventToTC_inputName
//
// Purpose:
// Negative test to ensure that LGenBase logs an error if the following field
// of EventToTC test step argument is incorrect: inputName
//
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The tc is passed if the correct error message appears.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_invalidEventToTC_inputName()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_invalidEventToTC(
"*Invalid input name*UndeclaredInput*NegativeSiblingFSM1*",
{
"TC2",
"b1",
"UndeclaredInput",
"bubuVar"
}
);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_invalidEventToTC_argVarName
//
// Purpose:
// Negative test to ensure that LGenBase logs an error if the following field
// of EventToTC test step argument is incorrect: argVarName
//
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The tc is passed if the correct error message appears.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_invalidEventToTC_argVarName()
runs on EPTF_LGenBase_VarAndStatTest_CT{
f_LGenBase_invalidEventToTC(
"*Invalid variable name*UndeclaredArgVar*NegativeSiblingFSM1*",
{
"TC2",
"b1",
"input2",
"UndeclaredArgVar"
}
);
}
// positive test
type component EPTF_LGenBase_EventToTC_CT extends EPTF_LGenBase_CT {
var boolean v_handleEventToTCCalled := false;
var integer v_dummyInt := -1;
}
function f_EPTF_LGenBase_handleEventToTC(in EPTF_LGenBase_TestStepArgs pl_ptr)
runs on EPTF_LGenBase_EventToTC_CT {
//action(%definitionId&"(", pl_ptr, ")");
v_handleEventToTCCalled := true;
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_eventToTC
//
// Purpose:
// Test the dispatching of an EventToTC from the FSM of one TC to another FSM of another TC
//
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The tc is passed if the handler of eventToTC is called.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_eventToTC() runs on EPTF_LGenBase_EventToTC_CT
{
const charstring c_LGenBaseTest_testBehavior := "testBehavior";
const charstring c_LGenBaseTest_eType := "entityType";
const charstring c_LGenBaseTest_eGrpName := "entityGroup";
const charstring c_LGenBaseTest_inputName_myEventToTC := "testEventToTC";
const charstring c_LGenBaseTest_stepName_handleEventToTC := "handleEventToTC";
const EPTF_LGenBase_ScenarioTypeDeclarator c_LGenBaseTest_eventToTCTestScenario := {
"SC1",
{
{"TC1",{
{target := {cpsToReach := 1.0}},
{enableEntitiesAtStart := true},
{enabledAtStart := true},
{fsmList :=
{"eventToTCFSM1"}
}
}
},
{"TC2",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"eventToTCFSM2"}
}
}
}
},
{}
}
f_EPTF_LGenBase_init("mtc");
var integer vl_myBehaviorIdx := f_EPTF_LGenBase_declareBehaviorType(
c_LGenBaseTest_testBehavior,
-1, null, null, null, null);
v_dummyInt := f_EPTF_LGenBase_declareEntityType(c_LGenBaseTest_eType, {c_LGenBaseTest_testBehavior});
v_dummyInt := f_EPTF_LGenBase_createEntityGroup({c_LGenBaseTest_eGrpName, c_LGenBaseTest_eType, 1})
v_dummyInt := f_EPTF_LGenBase_declareFsmEvent(c_LGenBaseTest_testBehavior, c_LGenBaseTest_inputName_myEventToTC);
v_dummyInt := f_EPTF_LGenBase_declareStep(c_LGenBaseTest_testBehavior,{c_LGenBaseTest_stepName_handleEventToTC, refers( f_EPTF_LGenBase_handleEventToTC )})
var EPTF_LGenBase_FsmTableDeclarator vl_fsm1 :=
{
name := "eventToTCFSM1",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "bubuVar",
initValue := {floatVal := 23.0},
scope := TC
}
}
}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
{
{
{
c_EPTF_LGenBase_stepName_dispatchEventToTC, {
eventToTC := {
tcName := "TC2",
behaviorName := c_LGenBaseTest_testBehavior,
inputName := c_LGenBaseTest_inputName_myEventToTC,
argVarName := "bubuVar"
}
}
}
}, omit, omit
}
}
}
}
}
}
var EPTF_LGenBase_FsmTableDeclarator vl_fsm2 :=
{
name := "eventToTCFSM2",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "bubuVar",
initValue := {floatVal := 25.0},
scope := TC
}
}
}
},
table := {
classicTable := {
{eventToListen := {c_LGenBaseTest_testBehavior,c_LGenBaseTest_inputName_myEventToTC,fsm},
cellRow := {
{{{c_LGenBaseTest_stepName_handleEventToTC, omit}}, omit, omit}
}
}
}
}
}
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(vl_fsm1);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(vl_fsm2);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(c_LGenBaseTest_eventToTCTestScenario);
f_EPTF_LGenBase_createScenario2EntityGroup({c_LGenBaseTest_eGrpName,"SC1"},true);
timer T_wait := 2.0;
T_wait.start;
T_wait.timeout;
if(v_handleEventToTCCalled) {
setverdict(pass);
} else {
setverdict(fail);
}
f_EPTF_Base_cleanup_CT();
}
} // group eventToTCTests
group EventFromSibling {
type record EPTF_LGenBaseTest_EventFromSibling_Event {
integer bIdx,
integer iIdx
}
type record EPTF_LGenBaseTest_EventFromSibling_Fsm {
integer eIdx,
integer fsmCtxIdx
}
type component EPTF_LGenBase_EventFromSibling_CT extends EPTF_LGenBase_VarAndStatTest_CT
{
var EPTF_LGenBaseTest_EventFromSibling_Event v_event := {-1, -1};
var EPTF_LGenBaseTest_EventFromSibling_Fsm v_source := {-1, -1};
var EPTF_LGenBaseTest_EventFromSibling_Fsm v_target := {-1, -1};
var EPTF_LGenBaseTest_EventFromSibling_Fsm v_listener := {-1, -1};
var integer v_test_step := 1;
}
const charstring c_LGenBase_Test_eventDispatchStepName := "eventDispatchStep";
function f_LGenBase_Test_eventDispatchStep(in EPTF_LGenBase_TestStepArgs pl_ptr)
runs on EPTF_LGenBase_EventFromSibling_CT
{
var EPTF_LGenBase_ReportedEventDescriptor vl_event := {
event := {
bIdx := v_event.bIdx,
iIdx := v_event.iIdx,
target := {// optional,
eIdx := v_target.eIdx,
fsmCtxIdx := v_target.fsmCtxIdx //optional
},
source := {// optional,
eIdx := -1,
fsmCtxIdx := omit//optional
}
},
reportedArgs := {} // integerlist
}
f_EPTF_LGenBase_dispatchEventFromStep(vl_event, pl_ptr);
}
function f_LGenBase_Test_eventFromSiblingInit(
in EPTF_LGenBase_ReportableEventType pl_scope)
runs on EPTF_LGenBase_EventFromSibling_CT
{
f_LGenBase_Test_fsmVariables_init(3,"eventFromSibling");
v_dummyInt := f_EPTF_LGenBase_declareBehaviorType("SiblingFSM1", -1, null, null, null);
v_dummyInt := f_EPTF_LGenBase_declareBehaviorType("SiblingFSM2", -1, null, null, null);
v_dummyInt := f_EPTF_LGenBase_declareBehaviorType("SiblingFSM3", -1, null, null, null);
v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("SiblingFSM1", "input1");
v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("SiblingFSM2", "input1");
v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("SiblingFSM3", "input1");
f_EPTF_LGenBase_declareStep("b1", {c_LGenBase_Test_eventDispatchStepName, refers(f_LGenBase_Test_eventDispatchStep)});
const EPTF_LGenBase_FsmTableDeclarator c_dummyFsm :=
{
name := "dummyFsm",
fsmParams := {
{stateList := {"idle"}}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{omit, omit, omit}
}
}
}
}
}
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_dummyFsm);
var integer vl_varValue := 0;
f_LGenBase_Test_declareDispatchFSM("SiblingFSM1");
f_LGenBase_Test_declareDispatchFSM("SiblingFSM3");
f_LGenBase_Test_declareListenerFSM("SiblingFSM2", "SiblingFSM1", "input1", pl_scope, vl_varValue);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"DummyTcToLockFirstPlace",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"dummyFsm","SiblingFSM2","SiblingFSM1"}
}
}
},
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"SiblingFSM1","SiblingFSM2","SiblingFSM3"}
}
}
}
},
{}
});
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false);
}
function f_LGenBase_Test_declareDispatchFSM(
in charstring pl_name)
runs on EPTF_LGenBase_EventFromSibling_CT
{
var EPTF_LGenBase_FsmTableDeclarator vl_fsm :=
{
name := pl_name,
fsmParams := {
{stateList := {"idle"}}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{{
{c_LGenBase_Test_eventDispatchStepName, {stepContextArgs:={}}
}
}, omit, omit}
}
}
}
}
}
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(vl_fsm);
}
function f_LGenBase_Test_declareListenerFSM(
in charstring pl_name,
in charstring pl_bName,
in charstring pl_iName,
in EPTF_LGenBase_ReportableEventType pl_scope,
in integer pl_eventFromSiblingInitValue)
runs on EPTF_LGenBase_EventFromSibling_CT
{
var EPTF_LGenBase_FsmTableDeclarator vl_fsm :=
{
name := pl_name,
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "FSMvar",
initValue := {intVal := pl_eventFromSiblingInitValue },
scope := FSM
}
}
}
},
table := {
extendedTable := {
{
events2Listen := {siblingEvents := { singleEventFromSibling := {pl_bName,pl_iName,pl_scope}}},
cellRow := { statedCellRow := {
{
inState := {state := "idle"},
cell :=
{{{c_EPTF_LGenBase_stepName_fsmVarInc,{varParams := {"FSMvar",{intVal := 1}}}}}, omit, omit}
}
}
}
}
}
}
}
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(vl_fsm);
}
function f_LGenBase_Test_triggerStartTcForSourceFsm()
runs on EPTF_LGenBase_EventFromSibling_CT
{
var EPTF_LGenBase_ReportedEventDescriptor vl_trigger := c_EPTF_LGenBase_emptyReportedEventDescriptor;
vl_trigger.event.bIdx := c_EPTF_LGenBase_bIdx;
vl_trigger.event.iIdx := c_EPTF_LGenBase_inputIdx_testMgmt_startTC;
vl_trigger.event.target.eIdx := v_source.eIdx;//pl_entityIdx;
vl_trigger.event.target.fsmCtxIdx := v_source.fsmCtxIdx;//f_EPTF_LGenBase_fsmCtxIdxOfSibling(pl_tcIdx, pl_entityIdx, pl_siblingFsmIdx);
f_EPTF_LGenBase_dispatchEvent(vl_trigger);
}
function f_LGenBase_Test_eventFromSibling_check(
in integer pl_expectedVarChange)
runs on EPTF_LGenBase_EventFromSibling_CT
{
var charstring vl_varName := f_EPTF_LGenBase_varNameOfFSMVar(v_listener.eIdx, v_listener.fsmCtxIdx, "FSMvar");
var integer vl_varId := f_EPTF_Var_getId(vl_varName);
if (vl_varId==-1) {
setverdict(fail,"The FSM Var not found.");
f_EPTF_Base_stopAll(none);
}
var integer vl_varValue := f_EPTF_Var_getIntValue(vl_varId);
f_LGenBase_Test_triggerStartTcForSourceFsm();//pl_tcIdx, pl_entityIdx, pl_siblingFsmIdx);
var integer vl_expectedVarValue := vl_varValue + pl_expectedVarChange;
vl_varValue := f_EPTF_Var_getIntValue(vl_varId);
if(vl_varValue != vl_expectedVarValue){
setverdict(fail,"Step#"&int2str(v_test_step)&". The sibling event was not handled correctly. Incorrect var value: ",vl_varValue," instead of ",vl_expectedVarValue);
// f_EPTF_Base_stopAll(none);
}
}
/*
Entity0 Entity1 Entity2
+------+ +------+ +------+
|+----+| |+----+| |+----+|
||FSM1|| ||FSM1|| ||FSM1||
|+----+| |+----+| |+----+|
|+----+| |+----+| |+----+|
||FSM2|| ||FSM2|| ||FSM2||
|+----+| |+----+| |+----+|
|+----+| |+----+| |+----+|
||FSM3|| ||FSM3|| ||FSM3||
|+----+| |+----+| |+----+|
+------+ +------+ +------+
step 1-4: sender is FSM1, FSM2 listens for event from FSM1
1: to FSM2 of Entity1
2: to FSM3 of Entity1
3: to FSM2 of Entity0
4: to FSM1 of Entity0
In case of 4, also check if FSM2 of Entity0 catches the event
Step 5: sender is another FSM (FSM3 in this case) - dont catch the event
*/
function f_LGenBase_Test_eventFromSibling_test(
in EPTF_LGenBase_ReportableEventType pl_scope,
in integer pl_change_toTargetFsm,
in integer pl_change_toOtherFsm,
in integer pl_change_toOtherEntity)
runs on EPTF_LGenBase_EventFromSibling_CT
{
f_LGenBase_Test_eventFromSiblingInit(pl_scope);
var integer vl_tcIdx := f_EPTF_LGenBase_trafficCaseId("eg1","SC1","TC1");
// FSM2 listens for event from FSM1 ("SiblingFSM1", "input1") with scope pl_scope
v_test_step := 1;
v_event.bIdx := f_EPTF_LGenBase_behaviorTypeNameIndex("SiblingFSM1");
v_event.iIdx := f_EPTF_LGenBase_inputNameIndex("SiblingFSM1", "input1");
v_source.eIdx := 1;
v_source.fsmCtxIdx := f_EPTF_LGenBase_fsmCtxIdxOfSibling(1, vl_tcIdx, 0); // TC1, entity1, SiblingFSM1
v_listener.eIdx := 1;
v_listener.fsmCtxIdx := f_EPTF_LGenBase_fsmCtxIdxOfSibling(1, vl_tcIdx, 1); // TC1, entity1, SiblingFSM2
// step 1 - FSM1 -> FSM2
v_target.eIdx := 1;
v_target.fsmCtxIdx := f_EPTF_LGenBase_fsmCtxIdxOfSibling(1, vl_tcIdx, 1); // TC1, entity1, SiblingFSM2
f_LGenBase_Test_eventFromSibling_check(pl_change_toTargetFsm);
// step 2 - FSM1 -> FSM3
v_test_step := v_test_step + 1;
v_target.eIdx := 1;
v_target.fsmCtxIdx := f_EPTF_LGenBase_fsmCtxIdxOfSibling(1, vl_tcIdx, 2); // TC1, entity1, SiblingFSM3
f_LGenBase_Test_eventFromSibling_check(pl_change_toOtherFsm);
// step 3 - FSM1 -> FSM1 of another entity
v_test_step := v_test_step + 1;
v_target.eIdx := 0;
v_target.fsmCtxIdx := f_EPTF_LGenBase_fsmCtxIdxOfSibling(0, vl_tcIdx, 0); // TC1, entity0, SiblingFSM1
f_LGenBase_Test_eventFromSibling_check(pl_change_toOtherEntity);
// step 4 - FSM1 -> FSM2 of another entity
// FSMvar of entity0, SiblingFSM2:
var charstring vl_varName := f_EPTF_LGenBase_varNameOfFSMVar(0, f_EPTF_LGenBase_fsmCtxIdxOfSibling(0, vl_tcIdx, 1), "FSMvar");
var integer vl_varId := f_EPTF_Var_getId(vl_varName);
if (vl_varId==-1) {
setverdict(fail,"The FSM Var not found.");
f_EPTF_Base_stopAll(none);
}
var integer vl_varValue := f_EPTF_Var_getIntValue(vl_varId);
v_test_step := v_test_step + 1;
v_target.eIdx := 0;
v_target.fsmCtxIdx := f_EPTF_LGenBase_fsmCtxIdxOfSibling(0, vl_tcIdx, 1); // TC1, entity0, SiblingFSM2
f_LGenBase_Test_eventFromSibling_check(pl_change_toOtherEntity);
if(f_EPTF_Var_getIntValue(vl_varId) != vl_varValue) { // var changed for SiblingFSM2 of the other entity -> fail
setverdict(fail,"Step#"&int2str(v_test_step)&". The FSM of another entity handled the eventFromSibling");
// f_EPTF_Base_stopAll(none);
}
// step 5 - FSM3 -> FSM2
v_test_step := v_test_step + 1;
v_source.eIdx := 1;
v_source.fsmCtxIdx := f_EPTF_LGenBase_fsmCtxIdxOfSibling(1, vl_tcIdx, 2); // TC1, entity1, SiblingFSM3
v_target.eIdx := 1;
v_target.fsmCtxIdx := f_EPTF_LGenBase_fsmCtxIdxOfSibling(1, vl_tcIdx, 1); // TC1, entity0, SiblingFSM2
f_LGenBase_Test_eventFromSibling_check(0); // this should never increase the variable
setverdict(pass);
f_EPTF_Base_stopAll(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_eventFromSibling_fsmListener
//
// Purpose:
// Test the listening to event from sibling FSM, with fsm scope.
// Only events coming from the sibling FSM that we listen to should be catched,
// and only if the target is the current FSM.
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_eventFromSibling_fsmListener()
runs on EPTF_LGenBase_EventFromSibling_CT
{
f_LGenBase_Test_eventFromSibling_test(fsm, 1, 0, 0);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_eventFromSibling_entityListener
//
// Purpose:
// Test the listening to event from sibling FSM, with entity scope.
// Only events coming from the sibling FSM that we listen to should be catched,
// if the target is any sibling FSM in the current entity.
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_eventFromSibling_entityListener()
runs on EPTF_LGenBase_EventFromSibling_CT
{
f_LGenBase_Test_eventFromSibling_test(entity, 1, 1, 0);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_eventFromSibling_generalListener
//
// Purpose:
// Test the listening to event from sibling FSM, with general scope.
// Only events coming from the sibling FSM that we listen to should be catched,
// but regardless of the target entity/FSM.
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_eventFromSibling_generalListener()
runs on EPTF_LGenBase_EventFromSibling_CT
{
f_LGenBase_Test_eventFromSibling_test(general, 1, 1, 1);
}
function f_LGenBase_Test_eventFromSibling_invalidEvent(
in charstring pl_errMsg,
in charstring pl_bName,
in charstring pl_iName)
runs on EPTF_LGenBase_EventFromSibling_CT
{
f_LGenBase_Test_eventFromSiblingInit(fsm);
f_EPTF_Base_setExpectedErrorMsg(pl_errMsg);
f_LGenBase_Test_declareListenerFSM("TestFSM", pl_bName, pl_iName, fsm, 0);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC2",
{
{"TC2",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"SiblingFSM1","TestFSM"}
}
}
}
},
{}
});
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC2"},false);
f_EPTF_Base_cleanup_CT();
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_eventFromSibling_invalidBehavior
//
// Purpose:
// This is a negative test case.
// Declares two sibling FSMs, one of them listening to an eventFromSibling with invalid behavior name.
// A proper error message should appear.
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_eventFromSibling_invalidBehavior()
runs on EPTF_LGenBase_EventFromSibling_CT
{
f_LGenBase_Test_eventFromSibling_invalidEvent("*TestFSM*eg1.SC2.TC2*UndefinedBName*", "UndefinedBName", "input1");
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_eventFromSibling_invalidInput
//
// Purpose:
// This is a negative test case.
// Declares two sibling FSMs, one of them listening to an eventFromSibling with invalid input name.
// A proper error message should appear.
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_eventFromSibling_invalidInput()
runs on EPTF_LGenBase_EventFromSibling_CT
{
f_LGenBase_Test_eventFromSibling_invalidEvent("*SiblingFSM1.UndefinedIName*not valid*TestFSM*", "SiblingFSM1", "UndefinedIName");
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_eventFromSibling_singleEvent
//
// Purpose:
// EventType to listen : singleEventFromSibling
// Three FSMs are declared in the test, the SiblingFSM2 listens to the events sent from SiblingFSM3 with input1,input2,input3.
// Both SiblingFSM1 and SiblingFSM3 dispatch events from input1 to input4. The test verifies if events arrive to SiblingFSM2
// only from SiblingFSM3, and only from input1 to input3, the input4 is not.
//
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The tc is passed if events only from SiblingFSM3 arrive to SiblingFSM2,
// and only from input1 to input3, the input4 is not.
//
///////////////////////////////////////////////////////////
// Status: Ready, passed
testcase tc_LGenBase_Test_eventFromSibling_singleEvent()
runs on EPTF_LGenBase_VarAndStatTest_CT{
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_dispatchingFsm :=
{
name := "dispatchingFsm",
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_dispatchEventToSibling,{
eventToSibling := {"SiblingFSM2","dispatchingFsm","input1",omit}}
}
}, omit, omit}
}
}
}
}
}
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_dummyFsm :=
{
name := "dummyFsm",
fsmParams := {
{stateList := {"idle"}}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{omit, omit, omit}
}
}
}
}
}
const integer c_eventFromSiblingInitValue := 0
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_listenerFsm :=
{
name := "listenerFsm",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "TCvar",
initValue := {intVal := c_eventFromSiblingInitValue },
scope := TC
}
}
}
},
table := {
extendedTable := {
{
events2Listen := {siblingEvents := { singleEventFromSibling := {"SiblingFSM3","input1",fsm}}},
cellRow := { statedCellRow := {
{
inState := {state := "idle"},
cell :=
{{{c_EPTF_LGenBase_stepName_fsmVarInc,{varParams := {"TCvar",{intVal := 1}}}}}, omit, omit}
}
}
}
}
}
}
}
f_LGenBase_Test_fsmVariables_init(3,"eventFromSibling")
v_dummyInt := f_EPTF_LGenBase_declareBehaviorType("dispatchingFsm", -1, null, null, null)
v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("dispatchingFsm", "input1")
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_dummyFsm);
var EPTF_LGenBase_FsmTableDeclarator vl_falseTable := c_LGenBase_Test_dummyFsm
vl_falseTable.name := "SiblingFSM3"
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(vl_falseTable);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_dispatchingFsm);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_listenerFsm);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"DummyTcToLockFirstPlace",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"dummyFsm",/*"listenerFsm",*/"SiblingFSM3"}
}
}
},
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"dispatchingFsm"}
},
{siblingFsmList :=
{{"SiblingFSM2","listenerFsm"},{"SiblingFSM3","dispatchingFsm"}}
}
}
}
},
{}
})
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false)
var EPTF_LGenBase_ReportedEventDescriptor vl_trigger := c_EPTF_LGenBase_emptyReportedEventDescriptor
vl_trigger.event.bIdx := c_EPTF_LGenBase_bIdx
vl_trigger.event.iIdx := c_EPTF_LGenBase_inputIdx_testMgmt_startTC
vl_trigger.event.target.eIdx := 1
vl_trigger.event.target.fsmCtxIdx := f_EPTF_LGenBase_fsmCtxIdxOfSibling(1, 1, 2)
f_EPTF_LGenBase_dispatchEvent(vl_trigger)
var charstring vl_varName := f_EPTF_LGenBase_varNameOfTCVar(1, "TCvar")
var integer vl_varId := f_EPTF_Var_getId(vl_varName);
if (vl_varId==-1) {
setverdict(fail,"The TC Var not found.");
f_EPTF_Base_stopAll(none);
}
var integer vl_varValue := f_EPTF_Var_getIntValue(vl_varId);
if(vl_varValue != c_eventFromSiblingInitValue+1){
setverdict(fail,"Step#1. The sibling event was not handled correctly. Incorrect var value: ",vl_varValue," instead of ",c_eventFromSiblingInitValue+1);
f_EPTF_Base_stopAll(none);
}
var integer vl_fsm2 := f_EPTF_LGenBase_fsmCtxIdxOfSibling(1, 1, 0)
if(vl_fsm2 ==vl_trigger.event.target.fsmCtxIdx){
setverdict(fail,"Invalid FSM ctx idx")
f_EPTF_Base_stopAll(none);
}
vl_trigger.event.target.fsmCtxIdx := vl_fsm2
f_EPTF_LGenBase_dispatchEvent(vl_trigger);
vl_varValue := f_EPTF_Var_getIntValue(vl_varId);
if(vl_varValue != c_eventFromSiblingInitValue+1){
setverdict(fail,"Step#2. The sibling event was not handled correctly. Incorrect var value: ",vl_varValue," instead of ",c_eventFromSiblingInitValue+1);
f_EPTF_Base_stopAll(none);
}
setverdict(pass);
f_EPTF_Base_cleanup_CT();
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_eventFromSibling_eventList
//
// Purpose:
// EventType to listen : eventListFromSibling
// Three FSMs are declared in the test, the SiblingFSM2 listens to the events sent from SiblingFSM3 with input1,input2,input3.
// Both SiblingFSM1 and SiblingFSM3 dispatch events from input1 to input4. The test verifies if events only from SiblingFSM3
// arrive to SiblingFSM2, and only from input1 to input3, the input4 is not.
//
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The tc is passed if events only from SiblingFSM3 arrive to SiblingFSM2,
// and only from input1 to input3, the input4 is not.
//
///////////////////////////////////////////////////////////
// Status: Ready, passed
testcase tc_LGenBase_Test_eventFromSibling_eventList()
runs on EPTF_LGenBase_VarAndStatTest_CT{
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmSiblingFSM1 :=
{
name := "SiblingFSM1",
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_dispatchEventToSibling,{
eventToSibling := {"SiblingFSM2","SiblingFSM3","input1",omit}}
},
{c_EPTF_LGenBase_stepName_dispatchEventToSibling,{
eventToSibling := {"SiblingFSM2","SiblingFSM3","input2",omit}}
},
{c_EPTF_LGenBase_stepName_dispatchEventToSibling,{
eventToSibling := {"SiblingFSM2","SiblingFSM3","input3",omit}}
},
{c_EPTF_LGenBase_stepName_dispatchEventToSibling,{
eventToSibling := {"SiblingFSM2","SiblingFSM3","input4",omit}}
}
}, omit, omit}
}
}
}
}
}
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_dummyFsm :=
{
name := "dummyFsm",
fsmParams := {
{stateList := {"idle"}}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{omit, omit, omit}
}
}
}
}
}
var EPTF_LGenBase_FsmTableDeclarator vl_LGenBase_Test_fsmSiblingFSM3 := c_LGenBase_Test_fsmSiblingFSM1;
vl_LGenBase_Test_fsmSiblingFSM3.name := "SiblingFSM3";
const integer c_eventFromSiblingInitValue := 0
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmSiblingFSM2 :=
{
name := "SiblingFSM2",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "TCvar",
initValue := {intVal := c_eventFromSiblingInitValue },
scope := TC
}
}
}
},
table := {
extendedTable := {
{
events2Listen := {siblingEvents := { eventListFromSibling := {"SiblingFSM3",{"input1", "input2", "input3"},fsm}}},
cellRow := { statedCellRow := {
{
inState := {state := "idle"},
cell :=
//{{{c_EPTF_LGenBase_stepName_fsmVarInc,{varParams := {"TCvar",{intVal := 1}}}}}, omit, omit}
{{{"CheckInputGoodness", omit },
{c_EPTF_LGenBase_stepName_fsmVarInc,{varParams := {"TCvar",{intVal := 1}}}}
}, omit, omit}
}
}
}
}
}
}
}
v_EventReceived := {0,0,0,0};
f_LGenBase_Test_fsmVariables_init(3,"eventFromSibling")
v_dummyInt := f_EPTF_LGenBase_declareFunction("CheckInputGoodness", {testStepFunction:= refers(f_LGenBase_Test_CheckInputGoodness)})
v_dummyInt := f_EPTF_LGenBase_declareBehaviorType("SiblingFSM1", -1, null, null, null)
v_dummyInt := f_EPTF_LGenBase_declareBehaviorType("SiblingFSM2", -1, null, null, null)
v_dummyInt := f_EPTF_LGenBase_declareBehaviorType("SiblingFSM3", -1, null, null, null)
v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("SiblingFSM3", "input1")
v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("SiblingFSM3", "input2")
v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("SiblingFSM3", "input3")
v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("SiblingFSM3", "input4")
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_dummyFsm);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmSiblingFSM1);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmSiblingFSM2);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(vl_LGenBase_Test_fsmSiblingFSM3);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"DummyTcToLockFirstPlace",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"dummyFsm","SiblingFSM2","SiblingFSM3"}
}
}
},
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"SiblingFSM1","SiblingFSM2","SiblingFSM3"}
}
}
}
},
{}
})
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false)
var EPTF_LGenBase_ReportedEventDescriptor vl_trigger := c_EPTF_LGenBase_emptyReportedEventDescriptor
vl_trigger.event.bIdx := c_EPTF_LGenBase_bIdx
vl_trigger.event.iIdx := c_EPTF_LGenBase_inputIdx_testMgmt_startTC
vl_trigger.event.target.eIdx := 1
vl_trigger.event.target.fsmCtxIdx := f_EPTF_LGenBase_fsmCtxIdxOfSibling(1, 1, 2)
f_EPTF_LGenBase_dispatchEvent(vl_trigger)
var charstring vl_varName := f_EPTF_LGenBase_varNameOfTCVar(1, "TCvar")
var integer vl_varId := f_EPTF_Var_getId(vl_varName);
if (vl_varId==-1) {
setverdict(fail,"The TC Var not found.");
f_EPTF_Base_stopAll(none);
}
var integer vl_varValue := f_EPTF_Var_getIntValue(vl_varId);
for(var integer vl_i := 0; vl_i < sizeof(v_EventReceived) - 1; vl_i := vl_i + 1){
if(v_EventReceived[vl_i] != 1){ setverdict(fail, "Wrong number of messages has arrived.") }
}
if(v_EventReceived[sizeof(v_EventReceived) - 1] != 0){ setverdict(fail, "Wrong message has arrived (no listener on input4 was initialised). ") }
if(vl_varValue != c_eventFromSiblingInitValue+3){
setverdict(fail,"Step#1. The sibling event was not handled correctly. Incorrect var value: ",vl_varValue," instead of ",c_eventFromSiblingInitValue+3);
f_EPTF_Base_stopAll(none);
}
var integer vl_fsm2 := f_EPTF_LGenBase_fsmCtxIdxOfSibling(1, 1, 0)
if(vl_fsm2 ==vl_trigger.event.target.fsmCtxIdx){
setverdict(fail,"Invalid FSM ctx idx")
f_EPTF_Base_stopAll(none);
}
vl_trigger.event.target.fsmCtxIdx := vl_fsm2
f_EPTF_LGenBase_dispatchEvent(vl_trigger);
vl_varValue := f_EPTF_Var_getIntValue(vl_varId);
if(vl_varValue != c_eventFromSiblingInitValue+3){
setverdict(fail,"Step#2. The sibling event was not handled correctly. Incorrect var value: ",vl_varValue," instead of ",c_eventFromSiblingInitValue+3);
f_EPTF_Base_stopAll(none);
}
setverdict(pass);
f_EPTF_Base_cleanup_CT();
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_eventFromSibling_eventRange
//
// Purpose:
// EventType to listen : eventRangeFromSibling
// Three FSMs are declared in the test, the SiblingFSM2 listens to the events sent from SiblingFSM3 with input1..input3 (input2 is within the range, too).
// Both SiblingFSM1 and SiblingFSM3 dispatches events from input1 to input4. The test verifies if events only from SiblingFSM3
// arrive to SiblingFSM2, and only from input1 to input3, the input4 is not.
//
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The tc is passed if events only from SiblingFSM3 arrive to SiblingFSM2,
// and only from input1 to input3, the input4 is not.
//
///////////////////////////////////////////////////////////
// Status: Ready, passed
testcase tc_LGenBase_Test_eventFromSibling_eventRange()
runs on EPTF_LGenBase_VarAndStatTest_CT{
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmSiblingFSM1 :=
{
name := "SiblingFSM1",
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_dispatchEventToSibling,{
eventToSibling := {"SiblingFSM2","SiblingFSM3","input1",omit}}
},
{c_EPTF_LGenBase_stepName_dispatchEventToSibling,{
eventToSibling := {"SiblingFSM2","SiblingFSM3","input2",omit}}
},
{c_EPTF_LGenBase_stepName_dispatchEventToSibling,{
eventToSibling := {"SiblingFSM2","SiblingFSM3","input3",omit}}
},
{c_EPTF_LGenBase_stepName_dispatchEventToSibling,{
eventToSibling := {"SiblingFSM2","SiblingFSM3","input4",omit}}
}
}, omit, omit}
}
}
}
}
}
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_dummyFsm :=
{
name := "dummyFsm",
fsmParams := {
{stateList := {"idle"}}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{omit, omit, omit}
}
}
}
}
}
var EPTF_LGenBase_FsmTableDeclarator vl_LGenBase_Test_fsmSiblingFSM3 := c_LGenBase_Test_fsmSiblingFSM1;
vl_LGenBase_Test_fsmSiblingFSM3.name := "SiblingFSM3";
const integer c_eventFromSiblingInitValue := 0
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmSiblingFSM2 :=
{
name := "SiblingFSM2",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "TCvar",
initValue := {intVal := c_eventFromSiblingInitValue },
scope := TC
}
}
}
},
table := {
extendedTable := {
{
events2Listen := {siblingEvents := { eventRangeFromSibling := {"SiblingFSM3","input1", "input3",fsm}}},
cellRow := { statedCellRow := {
{
inState := {state := "idle"},
cell :=
//{{{c_EPTF_LGenBase_stepName_fsmVarInc,{varParams := {"TCvar",{intVal := 1}}}}}, omit, omit}
{{{"CheckInputGoodness", omit },
{c_EPTF_LGenBase_stepName_fsmVarInc,{varParams := {"TCvar",{intVal := 1}}}}
}, omit, omit}
}
}
}
}
}
}
}
v_EventReceived := {0,0,0,0};
f_LGenBase_Test_fsmVariables_init(3,"eventFromSibling")
v_dummyInt := f_EPTF_LGenBase_declareFunction("CheckInputGoodness", {testStepFunction:= refers(f_LGenBase_Test_CheckInputGoodness)})
v_dummyInt := f_EPTF_LGenBase_declareBehaviorType("SiblingFSM1", -1, null, null, null)
v_dummyInt := f_EPTF_LGenBase_declareBehaviorType("SiblingFSM2", -1, null, null, null)
v_dummyInt := f_EPTF_LGenBase_declareBehaviorType("SiblingFSM3", -1, null, null, null)
v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("SiblingFSM3", "input1")
v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("SiblingFSM3", "input2")
v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("SiblingFSM3", "input3")
v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("SiblingFSM3", "input4")
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_dummyFsm);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmSiblingFSM1);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmSiblingFSM2);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(vl_LGenBase_Test_fsmSiblingFSM3);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"DummyTcToLockFirstPlace",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"dummyFsm","SiblingFSM2","SiblingFSM3"}
}
}
},
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"SiblingFSM1","SiblingFSM2","SiblingFSM3"}
}
}
}
},
{}
})
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false)
var EPTF_LGenBase_ReportedEventDescriptor vl_trigger := c_EPTF_LGenBase_emptyReportedEventDescriptor
vl_trigger.event.bIdx := c_EPTF_LGenBase_bIdx
vl_trigger.event.iIdx := c_EPTF_LGenBase_inputIdx_testMgmt_startTC
vl_trigger.event.target.eIdx := 1
vl_trigger.event.target.fsmCtxIdx := f_EPTF_LGenBase_fsmCtxIdxOfSibling(1, 1, 2)
f_EPTF_LGenBase_dispatchEvent(vl_trigger)
var charstring vl_varName := f_EPTF_LGenBase_varNameOfTCVar(1, "TCvar")
var integer vl_varId := f_EPTF_Var_getId(vl_varName);
if (vl_varId==-1) {
setverdict(fail,"The TC Var not found.");
f_EPTF_Base_stopAll(none);
}
var integer vl_varValue := f_EPTF_Var_getIntValue(vl_varId);
for(var integer vl_i := 0; vl_i < sizeof(v_EventReceived) - 1; vl_i := vl_i + 1){
if(v_EventReceived[vl_i] != 1){ setverdict(fail, "Wrong number of messages has arrived.") }
}
if(v_EventReceived[sizeof(v_EventReceived) - 1] != 0){ setverdict(fail, "Wrong message has arrived (no listener on input4 was initialised). ") }
if(vl_varValue != c_eventFromSiblingInitValue+3){
setverdict(fail,"Step#1. The sibling event was not handled correctly. Incorrect var value: ",vl_varValue," instead of ",c_eventFromSiblingInitValue+3);
f_EPTF_Base_stopAll(none);
}
var integer vl_fsm2 := f_EPTF_LGenBase_fsmCtxIdxOfSibling(1, 1, 0)
if(vl_fsm2 ==vl_trigger.event.target.fsmCtxIdx){
setverdict(fail,"Invalid FSM ctx idx")
f_EPTF_Base_stopAll(none);
}
vl_trigger.event.target.fsmCtxIdx := vl_fsm2
f_EPTF_LGenBase_dispatchEvent(vl_trigger);
vl_varValue := f_EPTF_Var_getIntValue(vl_varId);
if(vl_varValue != c_eventFromSiblingInitValue+3){
setverdict(fail,"Step#2. The sibling event was not handled correctly. Incorrect var value: ",vl_varValue," instead of ",c_eventFromSiblingInitValue+3);
f_EPTF_Base_stopAll(none);
}
setverdict(pass);
f_EPTF_Base_cleanup_CT();
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_declareEvent
//
// Purpose:
// Tests whether the default and the common event declaration works (declareEvents in the fsmParams).
//
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The test case is passed if the correct behavior and the correct behavior-input pairs
// are defined after the fsm has been declared
//
///////////////////////////////////////////////////////////
// Status: Ready, passed
testcase tc_LGenBase_Test_declareEvent()
runs on EPTF_LGenBase_VarAndStatTest_CT{
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmSiblingFSM1 :=
{
name := "SiblingFSM1",
fsmParams := {
{stateList := {"idle"}},
{declareEvents := {true, {"g1","g2","g3"}} }
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{omit, omit, omit}
}
}
}
}
}
f_EPTF_LGenBase_init("eventFromSibling");
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmSiblingFSM1);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"SiblingFSM1"}
}
}
}
},
{}
})
if (f_EPTF_LGenBase_inputNameIndex("SiblingFSM1", "g1")==-1) {
setverdict(fail,"The behavior-input g1 not found, eventList in the declaretEvents does not work.");
}
if (f_EPTF_LGenBase_inputNameIndex("SiblingFSM1", "g2")==-1) {
setverdict(fail,"The behavior-input g2 not found, eventList in the declaretEvents does not work.");
}
if (f_EPTF_LGenBase_inputNameIndex("SiblingFSM1", "g3")==-1) {
setverdict(fail,"The behavior-input g3 not found, eventList in the declaretEvents does not work.");
}
if (f_EPTF_LGenBase_inputNameIndex("SiblingFSM1", c_EPTF_LGenBase_FSMEventFinishedSuccess)==-1) {
setverdict(fail,"The behavior-input c_EPTF_LGenBase_FSMEventFinishedSuccess not found, useDefaultEvents does not work.");
}
if (f_EPTF_LGenBase_inputNameIndex("SiblingFSM1", c_EPTF_LGenBase_FSMEventFinishedFail)==-1) {
setverdict(fail,"The behavior-input c_EPTF_LGenBase_FSMEventFinishedFail not found, useDefaultEvents does not work.");
}
if (f_EPTF_LGenBase_inputNameIndex("SiblingFSM1", c_EPTF_LGenBase_FSMEventFinishedError)==-1) {
setverdict(fail,"The behavior-input c_EPTF_LGenBase_FSMEventFinishedFail not found, useDefaultEvents does not work.");
}
if (f_EPTF_LGenBase_inputNameIndex("SiblingFSM1", c_EPTF_LGenBase_FSMEventFinishedTimeout)==-1) {
setverdict(fail,"The behavior-input c_EPTF_LGenBase_FSMEventFinishedTimeout not found, useDefaultEvents does not work.");
}
setverdict(pass);
f_EPTF_Base_cleanup_CT();
}
function f_LGenBase_Test_CheckInputGoodness(in EPTF_LGenBase_TestStepArgs pl_ptr)
runs on EPTF_LGenBase_VarAndStatTest_CT
{
if ( f_EPTF_LGenBase_getFsmNameByCtxIdx(pl_ptr.reportedEvent.event.source.eIdx, pl_ptr.reportedEvent.event.source.fsmCtxIdx) != "SiblingFSM3"){
setverdict(fail,"Wrong receive, an event has been received from a wrong fsm : " & f_EPTF_LGenBase_getFsmNameByCtxIdx(pl_ptr.reportedEvent.event.source.eIdx, pl_ptr.reportedEvent.event.source.fsmCtxIdx));
f_EPTF_Base_stopAll(none);
}
for(var integer vl_i := 0; vl_i < pl_ptr.reportedEvent.event.iIdx; vl_i := vl_i + 1){
if (v_EventReceived[vl_i] != 1){
setverdict(fail,"Wrong receive order, the input" & int2str(vl_i) & " has been received before the input" & int2str(pl_ptr.reportedEvent.event.iIdx) & " received");
f_EPTF_Base_stopAll(none);
}
}
if (v_EventReceived[pl_ptr.reportedEvent.event.iIdx] != 0){
setverdict(fail,"Wrong receive, the input" & int2str(pl_ptr.reportedEvent.event.iIdx) & " has been received more than one time");
f_EPTF_Base_stopAll(none);
}
for(var integer vl_i := sizeof(v_EventReceived)-1; vl_i > pl_ptr.reportedEvent.event.iIdx - 1 ; vl_i := vl_i - 1){
if (v_EventReceived[vl_i] != 0){
setverdict(fail,"Wrong receive order, the input" & int2str(vl_i) & " has been received before the input" & int2str(pl_ptr.reportedEvent.event.iIdx) & " received");
f_EPTF_Base_stopAll(none);
}
}
v_EventReceived[pl_ptr.reportedEvent.event.iIdx] := v_EventReceived[pl_ptr.reportedEvent.event.iIdx] + 1;
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_eventOfFsmToSibling_Dispatch
//
// Purpose:
// It tests whether the eventOfFsmToSibling step works : default and the common event declared with declareEvents
// in the fsmParams can be dispatched.
//
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The test case is passed if the event arrives.
//
///////////////////////////////////////////////////////////
// Status: Ready, passed
testcase tc_LGenBase_Test_eventOfFsmToSibling_Dispatch()
runs on EPTF_LGenBase_VarAndStatTest_CT{
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmSiblingFSM1 :=
{
name := "SiblingFSM1",
fsmParams := {
{stateList := {"idle"}},
{declareEvents := {true, {"g1","g2","g3"}} }
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_dispatchEventOfFsmToSibling,{
eventOfFsmToSibling := {"SiblingFSM2","g1",omit}}
}
}, omit, omit}
}
}
}
}
}
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_dummyFsm :=
{
name := "dummyFsm",
fsmParams := {
{stateList := {"idle"}}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{omit, omit, omit}
}
}
}
}
}
var EPTF_LGenBase_FsmTableDeclarator vl_LGenBase_Test_fsmSiblingFSM3 := c_LGenBase_Test_fsmSiblingFSM1;
vl_LGenBase_Test_fsmSiblingFSM3.name := "SiblingFSM3";
const integer c_eventFromSiblingInitValue := 0
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmSiblingFSM2 :=
{
name := "SiblingFSM2",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "TCvar",
initValue := {intVal := c_eventFromSiblingInitValue },
scope := TC
}
}
}
},
table := {
extendedTable := {
{
events2Listen := {siblingEvents := { singleEventFromSibling := {"SiblingFSM3","g1",fsm}}},
cellRow := { statedCellRow := {
{
inState := {state := "idle"},
cell :=
{{{c_EPTF_LGenBase_stepName_fsmVarInc,{varParams := {"TCvar",{intVal := 1}}}}}, omit, omit}
}
}
}
}
}
}
}
f_LGenBase_Test_fsmVariables_init(3,"eventFromSibling")
v_dummyInt := f_EPTF_LGenBase_declareBehaviorType("SiblingFSM2", -1, null, null, null)
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_dummyFsm);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmSiblingFSM1);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(vl_LGenBase_Test_fsmSiblingFSM3);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmSiblingFSM2);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"DummyTcToLockFirstPlace",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"dummyFsm","SiblingFSM2","SiblingFSM3"}
}
}
},
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"SiblingFSM1","SiblingFSM2","SiblingFSM3"}
}
}
}
},
{}
})
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false)
var EPTF_LGenBase_ReportedEventDescriptor vl_trigger := c_EPTF_LGenBase_emptyReportedEventDescriptor
vl_trigger.event.bIdx := c_EPTF_LGenBase_bIdx
vl_trigger.event.iIdx := c_EPTF_LGenBase_inputIdx_testMgmt_startTC
vl_trigger.event.target.eIdx := 1
vl_trigger.event.target.fsmCtxIdx := f_EPTF_LGenBase_fsmCtxIdxOfSibling(1, 1, 2)
f_EPTF_LGenBase_dispatchEvent(vl_trigger)
var charstring vl_varName := f_EPTF_LGenBase_varNameOfTCVar(1, "TCvar")
var integer vl_varId := f_EPTF_Var_getId(vl_varName);
if (vl_varId==-1) {
setverdict(fail,"The TC Var not found.");
f_EPTF_Base_stopAll(none);
}
var integer vl_varValue := f_EPTF_Var_getIntValue(vl_varId);
if(vl_varValue != c_eventFromSiblingInitValue+1){
setverdict(fail,"Step#1. The sibling event was not handled correctly. Incorrect var value: ",vl_varValue," instead of ",c_eventFromSiblingInitValue+1);
f_EPTF_Base_stopAll(none);
}
var integer vl_fsm2 := f_EPTF_LGenBase_fsmCtxIdxOfSibling(1, 1, 0)
if(vl_fsm2 ==vl_trigger.event.target.fsmCtxIdx){
setverdict(fail,"Invalid FSM ctx idx")
f_EPTF_Base_stopAll(none);
}
vl_trigger.event.target.fsmCtxIdx := vl_fsm2
f_EPTF_LGenBase_dispatchEvent(vl_trigger);
vl_varValue := f_EPTF_Var_getIntValue(vl_varId);
if(vl_varValue != c_eventFromSiblingInitValue+1){
setverdict(fail,"Step#2. The sibling event was not handled correctly. Incorrect var value: ",vl_varValue," instead of ",c_eventFromSiblingInitValue+1);
f_EPTF_Base_stopAll(none);
}
setverdict(pass);
f_EPTF_Base_cleanup_CT();
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_eventOfFsmToSibling_Post
//
// Purpose:
// It tests whether the eventOfFsmToSibling works : default and the common event declared with declareEvents
// in the fsmParams can be posted.
//
// Requirement:
// -
//
// Action:
// -
//
// Expected Result: The test case is passed if the event arrives.
//
///////////////////////////////////////////////////////////
// Status: Ready, passed
testcase tc_LGenBase_Test_eventOfFsmToSibling_Post()
runs on EPTF_LGenBase_VarAndStatTest_CT{
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmSiblingFSM1 :=
{
name := "SiblingFSM1",
fsmParams := {
{stateList := {"idle"}},
{declareEvents := {true, {"g1","g2","g3"}} }
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_postEventOfFsmToSibling,{
eventOfFsmToSibling := {"SiblingFSM2","g1",omit}}
}
}, omit, omit}
}
}
}
}
}
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_dummyFsm :=
{
name := "dummyFsm",
fsmParams := {
{stateList := {"idle"}}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{omit, omit, omit}
}
}
}
}
}
var EPTF_LGenBase_FsmTableDeclarator vl_LGenBase_Test_fsmSiblingFSM3 := c_LGenBase_Test_fsmSiblingFSM1;
vl_LGenBase_Test_fsmSiblingFSM3.name := "SiblingFSM3";
const integer c_eventFromSiblingInitValue := 0
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsmSiblingFSM2 :=
{
name := "SiblingFSM2",
fsmParams := {
{stateList := {"idle"}},
{varList :=
{
{
name := "TCvar",
initValue := {intVal := c_eventFromSiblingInitValue },
scope := TC
}
}
}
},
table := {
extendedTable := {
{
events2Listen := {siblingEvents := { singleEventFromSibling := {"SiblingFSM3","g1",fsm}}},
cellRow := { statedCellRow := {
{
inState := {state := "idle"},
cell :=
{{{c_EPTF_LGenBase_stepName_fsmVarInc,{varParams := {"TCvar",{intVal := 1}}}}}, omit, omit}
}
}
}
}
}
}
}
f_LGenBase_Test_fsmVariables_init(3,"eventFromSibling")
v_dummyInt := f_EPTF_LGenBase_declareBehaviorType("SiblingFSM2", -1, null, null, null)
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_dummyFsm);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmSiblingFSM1);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(vl_LGenBase_Test_fsmSiblingFSM3);
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_fsmSiblingFSM2);
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"DummyTcToLockFirstPlace",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"dummyFsm","SiblingFSM2","SiblingFSM3"}
}
}
},
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"SiblingFSM1","SiblingFSM2","SiblingFSM3"}
}
}
}
},
{}
})
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false)
var EPTF_LGenBase_ReportedEventDescriptor vl_trigger := c_EPTF_LGenBase_emptyReportedEventDescriptor
vl_trigger.event.bIdx := c_EPTF_LGenBase_bIdx
vl_trigger.event.iIdx := c_EPTF_LGenBase_inputIdx_testMgmt_startTC
vl_trigger.event.target.eIdx := 1
vl_trigger.event.target.fsmCtxIdx := f_EPTF_LGenBase_fsmCtxIdxOfSibling(1, 1, 2)
f_EPTF_LGenBase_dispatchEvent(vl_trigger)
// let altsteps to work:
timer t_wait := 0.1;
t_wait.start; t_wait.timeout;
var charstring vl_varName := f_EPTF_LGenBase_varNameOfTCVar(1, "TCvar")
var integer vl_varId := f_EPTF_Var_getId(vl_varName);
if (vl_varId==-1) {
setverdict(fail,"The TC Var not found.");
f_EPTF_Base_stopAll(none);
}
var integer vl_varValue := f_EPTF_Var_getIntValue(vl_varId);
if(vl_varValue != c_eventFromSiblingInitValue+1){
setverdict(fail,"Step#1. The sibling event was not handled correctly. Incorrect var value: ",vl_varValue," instead of ",c_eventFromSiblingInitValue+1);
f_EPTF_Base_stopAll(none);
}
var integer vl_fsm2 := f_EPTF_LGenBase_fsmCtxIdxOfSibling(1, 1, 0)
if(vl_fsm2 ==vl_trigger.event.target.fsmCtxIdx){
setverdict(fail,"Invalid FSM ctx idx")
f_EPTF_Base_stopAll(none);
}
vl_trigger.event.target.fsmCtxIdx := vl_fsm2
f_EPTF_LGenBase_dispatchEvent(vl_trigger);
vl_varValue := f_EPTF_Var_getIntValue(vl_varId);
if(vl_varValue != c_eventFromSiblingInitValue+1){
setverdict(fail,"Step#2. The sibling event was not handled correctly. Incorrect var value: ",vl_varValue," instead of ",c_eventFromSiblingInitValue+1);
f_EPTF_Base_stopAll(none);
}
setverdict(pass);
f_EPTF_Base_cleanup_CT();
}
} // group EventFromSibling
//HM78569
group HM78569{
testcase tc_LGenBase_Test_entityEvent2FSMListener()
runs on EPTF_LGenBase_Test_CT{
f_EPTF_LGenBase_init("entityEvent2FSMListener");
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_fsm :=
{
name := "Fsm",
fsmParams := {
{stateList := {"idle"}}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{omit, omit, omit}
}
}
}
}
}
f_EPTF_Base_cleanup_CT();
}
}
group HM85762{
testcase tc_LGenBase_Test_deactivateDeactivated() runs on EPTF_LGenBase_VarAndStatTest_CT
{
const EPTF_LGenBase_FsmTableDeclarator c_dummyTable:={
name := "dummyTable",
fsmParams := {
{stateList := {"idle"}}
},
table := {
classicTable := {
}
}
}
//f_EPTF_LGenBase_init("deactivateDeactivated", 3)
f_LGenBase_Test_fsmVariables_init(4,"deactivateDeactivated");
var integer vl_fTableIdx := f_EPTF_LGenBase_declareFSMTable(c_dummyTable);
var integer vl_fsmCtxIdx := f_EPTF_LGenBase_activateFsm(2, vl_fTableIdx, c_EPTF_LGenBase_idleStateIndex, -1);
f_EPTF_LGenBase_deactivateFsm(2, vl_fsmCtxIdx);
f_EPTF_Base_cleanup_CT();
setverdict(pass);
}
}
group HN14235{
//Tests the case when anf FSM timer had been started, but
//the cleanup had been started before its timeout
type component LGenBase_Test_timerAfterStop_CT extends EPTF_LGenBase_VarAndStatTest_CT{
var integer v_timerAfterStop_fTableIdx := -1;
}
function f_LGenBase_Test_timerAfterStop_init(
in integer pl_eOffset,
in integer pl_eTest)
runs on LGenBase_Test_timerAfterStop_CT{
f_LGenBase_Test_fsmVariables_init();
const EPTF_LGenBase_FsmTableDeclarator c_timerTable:={
name := "timerTable",
fsmParams := {
{stateList := {"idle"}},
{timerList := {{"t1",1.0}}}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_timerStart, {timerName := "t1"}},
{c_EPTF_LGenBase_stepName_log, omit}
}, omit, omit}
}
},
{eventToListen := {c_EPTF_LGenBase_specialBName_timerTimeout,"t1",fsm},
cellRow := {
//state[0]==idle
{{
{c_EPTF_LGenBase_stepName_log, omit}
}, omit, omit}
}
}
}
}
}
v_timerAfterStop_fTableIdx := f_EPTF_LGenBase_declareFSMTable(c_timerTable);
}
testcase tc_LGenBase_Test_timerAfterStop()
runs on LGenBase_Test_timerAfterStop_CT{
f_LGenBase_Test_timerAfterStop_init(0,1)
var integer vl_fsmCtxIdx := f_EPTF_LGenBase_activateFsm(
pl_eIdx := 1,
pl_tIdx := v_timerAfterStop_fTableIdx,
pl_sIdx := c_EPTF_LGenBase_idleStateIndex);
var EPTF_LGenBase_ReportedEventDescriptor vl_trigger := c_EPTF_LGenBase_emptyReportedEventDescriptor
vl_trigger.event.bIdx := c_EPTF_LGenBase_bIdx
vl_trigger.event.iIdx := c_EPTF_LGenBase_inputIdx_testMgmt_startTC
vl_trigger.event.target.eIdx := 1
vl_trigger.event.target.fsmCtxIdx := vl_fsmCtxIdx
f_EPTF_LGenBase_dispatchEvent(vl_trigger)
f_EPTF_Base_cleanup_CT();
timer t1;
t1.start( 0.2 );
t1.timeout;
setverdict(pass)
}
function f_LGenBase_Test_timerAfterStop_delay()
runs on LGenBase_Test_timerAfterStop_CT{
timer t_wait
t_wait.start( 0.3 )
t_wait.timeout
}
function f_LGenBase_Test_timerAfterStop_tcBehavior()
runs on LGenBase_Test_timerAfterStop_CT{
f_LGenBase_Test_timerAfterStop_init(0,1)
//f_EPTF_Base_registerCleanup(refers( f_LGenBase_Test_timerAfterStop_delay ))
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"TC1",{
{target := {cpsToReach := 0.0}},
{fsmList :=
{"timerTable"}
}
}
}
},
{}
})
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"}, false)
var integer vl_fsmCtxIdx := f_EPTF_LGenBase_getFSMCtxIdx(1, 0);
var EPTF_LGenBase_ReportedEventDescriptor vl_trigger := c_EPTF_LGenBase_emptyReportedEventDescriptor
vl_trigger.event.bIdx := c_EPTF_LGenBase_bIdx
vl_trigger.event.iIdx := c_EPTF_LGenBase_inputIdx_testMgmt_startTC
vl_trigger.event.target.eIdx := 1
vl_trigger.event.target.fsmCtxIdx := vl_fsmCtxIdx
f_EPTF_LGenBase_dispatchEvent(vl_trigger)
f_EPTF_Base_stop(pass)
timer t1;
t1.start( 1.0 );
t1.timeout;
}
testcase tc_LGenBase_Test_timerAfterStop_Tc()
runs on LGenBase_Test_timerAfterStop_CT{
var LGenBase_Test_timerAfterStop_CT vl_ptc := LGenBase_Test_timerAfterStop_CT.create;
vl_ptc.start( f_LGenBase_Test_timerAfterStop_tcBehavior() );
timer t1;
t1.start( 1.0 );
t1.timeout;
setverdict(pass)
}
}
function f_LGenBase_Test_verdictStep(in EPTF_LGenBase_FsmActionDeclaratorList pl_actions)
runs on EPTF_LGenBase_VarAndStatTest_CT{
var EPTF_LGenBase_FsmTableDeclarator vl_verdictTable:={
name := "verdictTable",
fsmParams := {
{stateList := {"idle"}}
},
table := {
classicTable := {
{eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{ pl_actions, omit, omit}
}
}
}
}
}
f_LGenBase_Test_fsmVariables_init();
var integer vl_t := f_EPTF_LGenBase_declareFSMTable(vl_verdictTable)
var integer vl_f := f_EPTF_LGenBase_activateFsm(1, vl_t, c_EPTF_LGenBase_idleStateIndex)
var EPTF_LGenBase_ReportedEventDescriptor vl_trigger := c_EPTF_LGenBase_emptyReportedEventDescriptor
vl_trigger.event.bIdx := c_EPTF_LGenBase_bIdx
vl_trigger.event.iIdx := c_EPTF_LGenBase_inputIdx_testMgmt_startTC
vl_trigger.event.target.eIdx := 1
vl_trigger.event.target.fsmCtxIdx := vl_f
f_EPTF_LGenBase_dispatchEvent(vl_trigger)
if(pass != getverdict){
setverdict(fail,"Verdict has not been set.")
}
f_EPTF_Base_cleanup_CT()
}
testcase tc_LGenBase_Test_verdictStep()
runs on EPTF_LGenBase_VarAndStatTest_CT{
var EPTF_LGenBase_FsmActionDeclaratorList vl_actions := {{
c_EPTF_LGenBase_stepName_setVerdict, {verdict := {verdict := pass, reason := %definitionId}}
}}
f_LGenBase_Test_verdictStep(vl_actions)
}
testcase tc_LGenBase_Test_verdictStepOmit()
runs on EPTF_LGenBase_VarAndStatTest_CT{
var EPTF_LGenBase_FsmActionDeclaratorList vl_actions := {{
c_EPTF_LGenBase_stepName_setVerdict, {verdict := {verdict := pass, reason := omit}}
}}
f_LGenBase_Test_verdictStep(vl_actions)
}
///////////////////////////////////////////////////////////
// Group: fsmHookpoint
//
// Purpose:
// The following tests test the behavior of FSM hookpoint,
// generally the function <f_EPTF_LGenBase_insertFsmSteps>
//
///////////////////////////////////////////////////////////
group fsmHookpoint{
const charstring c_SIP_Behavior := "c_SIP_Behavior";
const charstring c_IMS_SIP_stepName_SIPinit := "c_IMS_SIP_stepName_SIPinit";
const charstring c_SIP_stepFunction_cleanUp := "c_SIP_stepFunction_cleanUp";
const charstring c_IMS_SIP_stepName_createREGISTER := "c_IMS_SIP_stepName_createREGISTER";
const charstring c_IMS_SIP_Register_stepName_updateRpsTotal := "c_IMS_SIP_Register_stepName_updateRpsTotal"
const charstring c_SIP_myBName := "c_SIP_myBName"
const charstring c_IMS_SIP_eventName_config := "c_IMS_SIP_eventName_config"
const charstring c_IMS_SIP_eventName_cleanUp := "c_IMS_SIP_eventName_cleanUp"
const charstring c_IMS_SIP_eventName_register := "c_IMS_SIP_eventName_register"
const charstring c_IMS_SIP_Register_stepName_incStat_nofTotal := "c_IMS_SIP_Register_stepName_incStat_nofTotal"
const charstring c_IMS_SIP_stepName_SIPcleanUp := "c_IMS_SIP_stepName_SIPcleanUp"
const charstring c_IMS_SIP_stepName_report := "c_IMS_SIP_stepName_report"
const integer c_IMS_SIP_eventIdx_registered := 1;
const charstring c_SIP_eventName_3xxto6xx := "c_SIP_eventName_3xxto6xx"
const charstring c_SIP_eventName_UACTransactionTimeout := "c_SIP_eventName_UACTransactionTimeout";
const charstring c_IMS_SIP_eventName_abortRegister := "c_IMS_SIP_eventName_abortRegister";
const integer c_IMS_SIP_eventIdx_registrationFailed := 2;
const EPTF_LGenBase_FsmActionListInsertDeclaratorList c_actions2MergeIn := {
{
"200",
{ {c_EPTF_LGenBase_stepName_cancelAllTimers, omit},
{c_EPTF_LGenBase_stepName_trafficSuccess, omit}}
},
{
"200",
{{c_EPTF_LGenBase_stepName_trafficTimeout, {timerName := "t1"}}}
},
{
"abort",
{{c_EPTF_LGenBase_stepName_setVerdict, {verdict := {verdict := pass, reason := omit}}}}
}
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_FSMMergeExtended
//
// Purpose:
// Tests whether the <f_EPTF_LGenBase_insertFsmSteps> function
// inserts the required steps into the FSM before the appropriate
// hookpoints, and before all occurances of the hookpoint.
//
// Action:
// - There is an FSM having table with extendedTable type.
// - There are three hookpoints. Two of them have the same name: "200",
// one of them has the name "abort".
// - The hookpoints are in different positions:
// first place, between other steps, last place.
// - There is a list of steplists to be inserted. It contains elements for
// all hookpoints. (The behavior when there is no appropriate hookpoint
// in the FSM tested in other test cases.)
// - There are two steplists for the hookpoint "200", and one for
// the hookpoint "abort".
//
// Expected Result:
// The steps assigned to the hookpoint "200" must be inserted before the
// hookpoint "200" in order of their occurance in the list.
// The step assigned to hookpoint "abort" must be inserted before
// the hookpoint.
// The hookpoints must remain in the FSM.
// The behavior is checked by a comparision of the expected
// and received FSM tables.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_FSMMergeExtended()
runs on EPTF_LGenBase_CT{
const EPTF_LGenBase_FsmTableDeclarator c_fsmMerged := {
name := "c_IMS_SIP_SigFSM_Register",
fsmParams :={
{stateList := {"config", "idle", "initiated"}}
},
table := {
extendedTable := {
{
events2Listen := { events := {{ singleEvent := {c_SIP_Behavior, c_IMS_SIP_eventName_config, fsm}}}},
cellRow :={ statedCellRow := {{
inState := { state := "config"},
cell :={
{{c_IMS_SIP_stepName_SIPinit,omit}},
omit, "idle"
}
}
}
}
},
{
events2Listen := { events := {{ singleEvent := {c_SIP_Behavior, c_IMS_SIP_eventName_cleanUp, fsm}}}},
cellRow :={ statedCellRow := {{
inState := { state := "idle"},
cell :={
{{c_SIP_stepFunction_cleanUp,omit}},
omit, "config"
}
}
}
}
},
{
events2Listen := { events := {{ singleEvent := {c_SIP_Behavior, c_IMS_SIP_eventName_register, fsm}}}},
cellRow :={ statedCellRow := {{
inState := { state := "idle"},
cell :={
{
{c_IMS_SIP_stepName_createREGISTER, {stepContextArgs := {-1, 1}}},
{c_IMS_SIP_Register_stepName_updateRpsTotal, omit}
},
omit, "initiated"
}
}
}
}
},
{
events2Listen := { events := {{ singleEvent := {c_SIP_myBName, "200", fsm}}}},
cellRow :={ classicCellRow := {
{omit,omit,omit},
{omit,omit,omit},
{
{
{c_IMS_SIP_Register_stepName_incStat_nofTotal, omit},
{c_IMS_SIP_stepName_SIPcleanUp, omit},
//Mergerd steps "200"
{c_EPTF_LGenBase_stepName_cancelAllTimers, omit},
{c_EPTF_LGenBase_stepName_trafficSuccess, omit},
{c_EPTF_LGenBase_stepName_trafficTimeout, {timerName := "t1"}},
{c_EPTF_LGenBase_stepName_hookpoint, {charstringValue := "200"}},
{c_IMS_SIP_stepName_report, {stepContextArgs := {c_IMS_SIP_eventIdx_registered}}}
},
omit, "idle"
}
}
}
},
{
events2Listen := { events := {{ singleEvent := {c_SIP_myBName, c_SIP_eventName_3xxto6xx, fsm}}}},
cellRow :={ statedCellRow := {{
inState := { state := "initiated"},
cell :={
{
{c_IMS_SIP_stepName_SIPcleanUp, omit},
{c_IMS_SIP_stepName_report, {stepContextArgs := {c_IMS_SIP_eventIdx_registrationFailed}}},
//Mergerd steps "200"
{c_EPTF_LGenBase_stepName_cancelAllTimers, omit},
{c_EPTF_LGenBase_stepName_trafficSuccess, omit},
{c_EPTF_LGenBase_stepName_trafficTimeout, {timerName := "t1"}},
{c_EPTF_LGenBase_stepName_hookpoint, {charstringValue := "200"}}
},
omit, "idle"
}
}
}
}
},
{
events2Listen := { events := {{ singleEvent := {c_SIP_myBName, c_SIP_eventName_UACTransactionTimeout, fsm}}}},
cellRow :={ statedCellRow := {{
inState := { state := "initiated"},
cell :={
{
{c_IMS_SIP_stepName_report, {stepContextArgs := {c_IMS_SIP_eventIdx_registrationFailed}}},
{c_IMS_SIP_stepName_SIPcleanUp, omit}
}, omit, "idle"
}
}
}
}
},
{
events2Listen := { events := {{ singleEvent := {c_SIP_Behavior, c_IMS_SIP_eventName_abortRegister, fsm}}}},
cellRow :={ statedCellRow := {{
inState := { anyUndefinedState :={} },
cell :={
{
//Mergerd steps "abort"
{c_EPTF_LGenBase_stepName_setVerdict, {verdict := {verdict := pass, reason := omit}}},
{c_EPTF_LGenBase_stepName_hookpoint, {charstringValue := "abort"}},
{c_IMS_SIP_stepName_SIPcleanUp, omit}
},
omit, "idle"
}
}
}
}
}
}
}
}
var EPTF_LGenBase_FsmTableDeclarator vl_fsm2BeMerged := {
name := "c_IMS_SIP_SigFSM_Register",
fsmParams :={
{stateList := {"config", "idle", "initiated"}}
},
table := {
extendedTable := {
{
events2Listen := { events := {{ singleEvent := {c_SIP_Behavior, c_IMS_SIP_eventName_config, fsm}}}},
cellRow :={ statedCellRow := {{
inState := { state := "config"},
cell :={
{{c_IMS_SIP_stepName_SIPinit,omit}},
omit, "idle"
}
}
}
}
},
{
events2Listen := { events := {{ singleEvent := {c_SIP_Behavior, c_IMS_SIP_eventName_cleanUp, fsm}}}},
cellRow :={ statedCellRow := {{
inState := { state := "idle"},
cell :={
{{c_SIP_stepFunction_cleanUp,omit}},
omit, "config"
}
}
}
}
},
{
events2Listen := { events := {{ singleEvent := {c_SIP_Behavior, c_IMS_SIP_eventName_register, fsm}}}},
cellRow :={ statedCellRow := {{
inState := { state := "idle"},
cell :={
{
{c_IMS_SIP_stepName_createREGISTER, {stepContextArgs := {-1, 1}}},
{c_IMS_SIP_Register_stepName_updateRpsTotal, omit}
},
omit, "initiated"
}
}
}
}
},
{
events2Listen := { events := {{ singleEvent := {c_SIP_myBName, "200", fsm}}}},
cellRow :={ classicCellRow := {
{omit,omit,omit},
{omit,omit,omit},
{
{
{c_IMS_SIP_Register_stepName_incStat_nofTotal, omit},
{c_IMS_SIP_stepName_SIPcleanUp, omit},
//Mergerd steps "200"
{c_EPTF_LGenBase_stepName_hookpoint, {charstringValue := "200"}},
{c_IMS_SIP_stepName_report, {stepContextArgs := {c_IMS_SIP_eventIdx_registered}}}
},
omit, "idle"
}
}
}
},
{
events2Listen := { events := {{ singleEvent := {c_SIP_myBName, c_SIP_eventName_3xxto6xx, fsm}}}},
cellRow :={ statedCellRow := {{
inState := { state := "initiated"},
cell :={
{
{c_IMS_SIP_stepName_SIPcleanUp, omit},
{c_IMS_SIP_stepName_report, {stepContextArgs := {c_IMS_SIP_eventIdx_registrationFailed}}},
//Mergerd steps "200"
{c_EPTF_LGenBase_stepName_hookpoint, {charstringValue := "200"}}
},
omit, "idle"
}
}
}
}
},
{
events2Listen := { events := {{ singleEvent := {c_SIP_myBName, c_SIP_eventName_UACTransactionTimeout, fsm}}}},
cellRow :={ statedCellRow := {{
inState := { state := "initiated"},
cell :={
{
{c_IMS_SIP_stepName_report, {stepContextArgs := {c_IMS_SIP_eventIdx_registrationFailed}}},
{c_IMS_SIP_stepName_SIPcleanUp, omit}
}, omit, "idle"
}
}
}
}
},
{
events2Listen := { events := {{ singleEvent := {c_SIP_Behavior, c_IMS_SIP_eventName_abortRegister, fsm}}}},
cellRow :={ statedCellRow := {{
inState := { anyUndefinedState :={} },
cell :={
{
//Mergerd steps "abort"
{c_EPTF_LGenBase_stepName_hookpoint, {charstringValue := "abort"}},
{c_IMS_SIP_stepName_SIPcleanUp, omit}
},
omit, "idle"
}
}
}
}
}
}
}
}
for ( var integer vl_i := 0; vl_i < sizeof(c_actions2MergeIn) ; vl_i := vl_i+1 ){
f_EPTF_LGenBase_insertFsmSteps(vl_fsm2BeMerged, c_actions2MergeIn[vl_i].name, c_actions2MergeIn[vl_i].actions);
}
if ( match(c_fsmMerged,vl_fsm2BeMerged) ){
setverdict(pass)
}
else{
setverdict(fail,%definitionId,"The merged FSM doesn't match with the expected: "
,log2str(match(c_fsmMerged,vl_fsm2BeMerged)))
}
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_FSMMergeClassic
//
// Purpose:
// Tests the same as <tc_LGenBase_Test_FSMMergeExtended>
// with a table having classicTable type.
//
// Action:
// See at <tc_LGenBase_Test_FSMMergeExtended>
//
// Expected Result:
// See at <tc_LGenBase_Test_FSMMergeExtended>
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_FSMMergeClassic()
runs on EPTF_LGenBase_CT{
const EPTF_LGenBase_FsmTableDeclarator c_fsmMerged := {
name := "c_IMS_SIP_SigFSM_Register",
fsmParams :={
{stateList := {"config", "idle", "initiated"}}
},
table := {
classicTable := {
{
eventToListen := {c_SIP_Behavior, c_IMS_SIP_eventName_config, fsm},
cellRow :={
{
{{c_IMS_SIP_stepName_SIPinit,omit}},
omit, "idle"
},
{omit,omit,omit},
{omit,omit,omit}
}
},
{
eventToListen := { c_SIP_Behavior, c_IMS_SIP_eventName_cleanUp, fsm},
cellRow :={
{omit,omit,omit},
{
{{c_SIP_stepFunction_cleanUp,omit}},
omit, "config"
},
{omit,omit,omit}
}
},
{
eventToListen := {c_SIP_Behavior, c_IMS_SIP_eventName_register, fsm},
cellRow :={
{omit,omit,omit},
{
{
{c_IMS_SIP_stepName_createREGISTER, {stepContextArgs := {-1, 1}}},
{c_IMS_SIP_Register_stepName_updateRpsTotal, omit}
},
omit, "initiated"
},
{omit,omit,omit}
}
},
{
eventToListen := {c_SIP_myBName, "200", fsm},
cellRow :={
{omit,omit,omit},
{omit,omit,omit},
{
{
{c_IMS_SIP_Register_stepName_incStat_nofTotal, omit},
{c_IMS_SIP_stepName_SIPcleanUp, omit},
//Mergerd steps "200"
{c_EPTF_LGenBase_stepName_cancelAllTimers, omit},
{c_EPTF_LGenBase_stepName_trafficSuccess, omit},
{c_EPTF_LGenBase_stepName_trafficTimeout, {timerName := "t1"}},
{c_EPTF_LGenBase_stepName_hookpoint, {charstringValue := "200"}},
{c_IMS_SIP_stepName_report, {stepContextArgs := {c_IMS_SIP_eventIdx_registered}}}
},
omit, "idle"
}
}
},
{
eventToListen := {c_SIP_myBName, c_SIP_eventName_3xxto6xx, fsm},
cellRow :={
{omit,omit,omit},
{omit,omit,omit},
{
{
{c_IMS_SIP_stepName_SIPcleanUp, omit},
{c_IMS_SIP_stepName_report, {stepContextArgs := {c_IMS_SIP_eventIdx_registrationFailed}}},
//Mergerd steps "200"
{c_EPTF_LGenBase_stepName_cancelAllTimers, omit},
{c_EPTF_LGenBase_stepName_trafficSuccess, omit},
{c_EPTF_LGenBase_stepName_trafficTimeout, {timerName := "t1"}},
{c_EPTF_LGenBase_stepName_hookpoint, {charstringValue := "200"}}
},
omit, "idle"
}
}
},
{
eventToListen := {c_SIP_myBName, c_SIP_eventName_UACTransactionTimeout, fsm},
cellRow :={
{omit,omit,omit},
{omit,omit,omit},
{
{
{c_IMS_SIP_stepName_report, {stepContextArgs := {c_IMS_SIP_eventIdx_registrationFailed}}},
{c_IMS_SIP_stepName_SIPcleanUp, omit}
}, omit, "idle"
}
}
},
{
eventToListen := {c_SIP_Behavior, c_IMS_SIP_eventName_abortRegister, fsm},
cellRow :={
{
{
//Mergerd steps "abort"
{c_EPTF_LGenBase_stepName_setVerdict, {verdict := {verdict := pass, reason := omit}}},
{c_EPTF_LGenBase_stepName_hookpoint, {charstringValue := "abort"}},
{c_IMS_SIP_stepName_SIPcleanUp, omit}
},
omit, "idle"
},
{
{
//Mergerd steps "abort"
{c_EPTF_LGenBase_stepName_setVerdict, {verdict := {verdict := pass, reason := omit}}},
{c_EPTF_LGenBase_stepName_hookpoint, {charstringValue := "abort"}},
{c_IMS_SIP_stepName_SIPcleanUp, omit}
},
omit, "idle"
},
{
{
//Mergerd steps "abort"
{c_EPTF_LGenBase_stepName_setVerdict, {verdict := {verdict := pass, reason := omit}}},
{c_EPTF_LGenBase_stepName_hookpoint, {charstringValue := "abort"}},
{c_IMS_SIP_stepName_SIPcleanUp, omit}
},
omit, "idle"
}
}
}
}
}
}
var EPTF_LGenBase_FsmTableDeclarator vl_fsm2BeMerged := {
name := "c_IMS_SIP_SigFSM_Register",
fsmParams :={
{stateList := {"config", "idle", "initiated"}}
},
table := {
classicTable := {
{
eventToListen := {c_SIP_Behavior, c_IMS_SIP_eventName_config, fsm},
cellRow :={
{
{{c_IMS_SIP_stepName_SIPinit,omit}},
omit, "idle"
},
{omit,omit,omit},
{omit,omit,omit}
}
},
{
eventToListen := { c_SIP_Behavior, c_IMS_SIP_eventName_cleanUp, fsm},
cellRow :={
{omit,omit,omit},
{
{{c_SIP_stepFunction_cleanUp,omit}},
omit, "config"
},
{omit,omit,omit}
}
},
{
eventToListen := {c_SIP_Behavior, c_IMS_SIP_eventName_register, fsm},
cellRow :={
{omit,omit,omit},
{
{
{c_IMS_SIP_stepName_createREGISTER, {stepContextArgs := {-1, 1}}},
{c_IMS_SIP_Register_stepName_updateRpsTotal, omit}
},
omit, "initiated"
},
{omit,omit,omit}
}
},
{
eventToListen := {c_SIP_myBName, "200", fsm},
cellRow :={
{omit,omit,omit},
{omit,omit,omit},
{
{
{c_IMS_SIP_Register_stepName_incStat_nofTotal, omit},
{c_IMS_SIP_stepName_SIPcleanUp, omit},
//Mergerd steps "200"
{c_EPTF_LGenBase_stepName_hookpoint, {charstringValue := "200"}},
{c_IMS_SIP_stepName_report, {stepContextArgs := {c_IMS_SIP_eventIdx_registered}}}
},
omit, "idle"
}
}
},
{
eventToListen := {c_SIP_myBName, c_SIP_eventName_3xxto6xx, fsm},
cellRow :={
{omit,omit,omit},
{omit,omit,omit},
{
{
{c_IMS_SIP_stepName_SIPcleanUp, omit},
{c_IMS_SIP_stepName_report, {stepContextArgs := {c_IMS_SIP_eventIdx_registrationFailed}}},
//Mergerd steps "200"
{c_EPTF_LGenBase_stepName_hookpoint, {charstringValue := "200"}}
},
omit, "idle"
}
}
},
{
eventToListen := {c_SIP_myBName, c_SIP_eventName_UACTransactionTimeout, fsm},
cellRow :={
{omit,omit,omit},
{omit,omit,omit},
{
{
{c_IMS_SIP_stepName_report, {stepContextArgs := {c_IMS_SIP_eventIdx_registrationFailed}}},
{c_IMS_SIP_stepName_SIPcleanUp, omit}
}, omit, "idle"
}
}
},
{
eventToListen := {c_SIP_Behavior, c_IMS_SIP_eventName_abortRegister, fsm},
cellRow :={
{
{
//Mergerd steps "abort"
{c_EPTF_LGenBase_stepName_hookpoint, {charstringValue := "abort"}},
{c_IMS_SIP_stepName_SIPcleanUp, omit}
},
omit, "idle"
},
{
{
//Mergerd steps "abort"
{c_EPTF_LGenBase_stepName_hookpoint, {charstringValue := "abort"}},
{c_IMS_SIP_stepName_SIPcleanUp, omit}
},
omit, "idle"
},
{
{
//Mergerd steps "abort"
{c_EPTF_LGenBase_stepName_hookpoint, {charstringValue := "abort"}},
{c_IMS_SIP_stepName_SIPcleanUp, omit}
},
omit, "idle"
}
}
}
}
}
}
for ( var integer vl_i := 0; vl_i < sizeof(c_actions2MergeIn) ; vl_i := vl_i+1 ){
f_EPTF_LGenBase_insertFsmSteps(vl_fsm2BeMerged, c_actions2MergeIn[vl_i].name, c_actions2MergeIn[vl_i].actions);
}
if ( match(c_fsmMerged,vl_fsm2BeMerged) ){
setverdict(pass)
}
else{
setverdict(fail,%definitionId,"The merged FSM doesn't match with the expected: "
,log2str(match(c_fsmMerged,vl_fsm2BeMerged)))
}
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_FSMMergeNoHookpoint
//
// Purpose:
// Tests the <f_EPTF_LGenBase_insertFsmSteps> function
// when there are no hookpoints in the FSM declaration.
//
// Action:
// There are no hookpoints in the FSM. The function
// <f_EPTF_LGenBase_insertFsmSteps> must leave the FSM as it is.
//
// Expected Result:
// The FSM must remain as it is.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_FSMMergeNoHookpoint()
runs on EPTF_LGenBase_CT{
var EPTF_LGenBase_FsmTableDeclarator vl_fsm2BeMerged := {
name := "c_IMS_SIP_SigFSM_Register",
fsmParams :={
{stateList := {"config", "idle", "initiated"}}
},
table := {
extendedTable := {
{
events2Listen := { events := {{ singleEvent := {c_SIP_Behavior, c_IMS_SIP_eventName_config, fsm}}}},
cellRow :={ statedCellRow := {{
inState := { state := "config"},
cell :={
{{c_IMS_SIP_stepName_SIPinit,omit}},
omit, "idle"
}
}
}
}
}
}
}
}
f_EPTF_LGenBase_insertFsmSteps(vl_fsm2BeMerged, "NoHookpoint", c_actions2MergeIn[0].actions)
if ( match(vl_fsm2BeMerged,vl_fsm2BeMerged) ){
setverdict(pass)
}
else{
setverdict(fail,%definitionId,"The merged FSM doesn't match with the expected: "
,log2str(match(vl_fsm2BeMerged,vl_fsm2BeMerged)))
}
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_FSMMergeNoMatchingHookpoint
//
// Purpose:
// Tests the <f_EPTF_LGenBase_insertFsmSteps> function
// when there are no hookpoints in the FSM declaration.
//
// Action:
// There are no hookpoints in the FSM with the name described in
// the function <f_EPTF_LGenBase_insertFsmSteps>. It must
// leave the FSM as it is.
//
// Expected Result:
// The FSM must remain as it is.
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_FSMMergeNoMatchingHookpoint()
runs on EPTF_LGenBase_CT{
var EPTF_LGenBase_FsmTableDeclarator vl_fsm2BeMerged := {
name := "c_IMS_SIP_SigFSM_Register",
fsmParams :={
{stateList := {"config", "idle", "initiated"}}
},
table := {
extendedTable := {
{
events2Listen := { events := {{ singleEvent := {c_SIP_Behavior, c_IMS_SIP_eventName_config, fsm}}}},
cellRow :={ statedCellRow := {{
inState := { state := "config"},
cell :={{
{c_EPTF_LGenBase_stepName_hookpoint, {charstringValue := "abort"}},
{c_IMS_SIP_stepName_SIPinit,omit}
},
omit, "idle"
}
}
}
}
}
}
}
}
f_EPTF_LGenBase_insertFsmSteps(vl_fsm2BeMerged, "NoMatchingHookpoint", c_actions2MergeIn[0].actions)
if ( match(vl_fsm2BeMerged,vl_fsm2BeMerged) ){
setverdict(pass)
}
else{
setverdict(fail,%definitionId,"The merged FSM doesn't match with the expected: "
,log2str(match(vl_fsm2BeMerged,vl_fsm2BeMerged)))
}
}
}//group
///////////////////////////////////////////////////////////
// Group: enableEntity
//
// Purpose:
// The following tests test the enabling/disabling of the
// entities in a traffic case.
// The cases to be tested:
// - Enable an entity while it's free, the TC is not running
// - Enable an entity while it's disabled, the TC is not running
// - Disable an entity while it's free, the TC is not running
// - Disable an entity while it's disabled, the TC is not running
// - Enable an entity while it's disabled, the TC is running
// - Enable an entity while it's free, the TC is running
// - Enable an entity while it's running
// - Disable an entity while it's free, the TC is running
// - Disable an entity while it's disabled, the TC is running
// - Disable an entity while it's running
//
///////////////////////////////////////////////////////////
group enableEntity{
const charstring c_LGenBase_Test_Enable_bName := "b1";
const charstring c_LGenBase_Test_Enable_iNameSignal := "Signal";
const charstring c_LGenBase_Test_Enable_NextStateClacFnName := "NextStateClacFn";
const integer c_LGenBase_Test_Enable_DefEGrpSize := 5;
const integer c_LGenBase_Test_Enable_DefEIdx := 4;
const integer c_LGenBase_Test_Enable_DefEAbsIdx := c_LGenBase_Test_Enable_DefNumEntities+c_LGenBase_Test_Enable_DefEIdx;
const integer c_LGenBase_Test_Enable_DefNumEntities := 3;
const charstring c_LGenBase_Test_Enable_setCalledStep := "setCalledStep";
const charstring c_LGenBase_Test_Enable_setCalledInRunningStateStep := "setCalledInRunningStateStep";
type component LGenBase_Test_Enable_CT extends EPTF_LGenBase_Test_CT{
var integer v_LGenBase_Test_Enable_eIdx2Check := -1;
var integer v_LGenBase_Test_Enable_bIdx := -1;
var integer v_LGenBase_Test_Enable_iIdxSignal := -1;
var boolean v_LGenBase_Test_Enable_called := false;
var boolean v_LGenBase_Test_Enable_calledInRunningState := false;
var boolean v_LGenBase_Test_Enable_reportSuccess := false;
var boolean v_LGenBase_Test_Enable_reportFinishAll := true;
var integer v_LGenBase_Test_Enable_tcIdxOfTc1 := -1;
var integer v_LGenBase_Test_Enable_fsmIdxOfTc1 := -1;
var integer v_LGenBase_Test_Enable_varIdStarts := -1;
var integer v_LGenBase_Test_Enable_varIdNotFinished := -1;
}
function f_LGenBase_Test_Enable_setCalledStep(in EPTF_LGenBase_TestStepArgs pl_ptr)
runs on LGenBase_Test_Enable_CT{
if(pl_ptr.eIdx == v_LGenBase_Test_Enable_eIdx2Check){
v_LGenBase_Test_Enable_called := true;
}
if(pl_ptr.eIdx != v_LGenBase_Test_Enable_eIdx2Check or
v_LGenBase_Test_Enable_reportFinishAll){
if(v_LGenBase_Test_Enable_reportSuccess){
f_EPTF_LGenBase_step_trafficSuccess(pl_ptr);
}else{
f_EPTF_LGenBase_step_trafficFailed(pl_ptr);
}
}
}
///////////////////////////////////////////////////////////
// function: f_LGenBase_Test_Enable_setCalledInRunningStateStep
//
// Purpose:
// Sets the component variable, and reports finish.
// After reporting the finish the entity will be put back to
// idle state, and becomes available from running for traffic management
///////////////////////////////////////////////////////////
function f_LGenBase_Test_Enable_setCalledInRunningStateStep(in EPTF_LGenBase_TestStepArgs pl_ptr)
runs on LGenBase_Test_Enable_CT{
v_LGenBase_Test_Enable_calledInRunningState := true;
f_EPTF_LGenBase_step_trafficFailed(pl_ptr);
}
function f_LGenBase_Test_Enable_nextStateCalcFn(
in integer eIdx,
in integer fIdx,
in EPTF_IntegerList contextArgs,
in EPTF_LGenBase_FsmTableCellReference pl_cell,
in EPTF_IntegerList pl_stepArgs)
runs on LGenBase_Test_Enable_CT
return integer{
if(eIdx == v_LGenBase_Test_Enable_eIdx2Check){
return 1;
}else{
return 0;
}
}
const EPTF_LGenBase_FsmTableDeclarator c_LGenBase_Test_Enable_FSM := {
name := "c_LGenBase_Test_Enable_FSM",
fsmParams :={
{stateList := {"idle", "running"}}
},
table := {
extendedTable := {
{
events2Listen := { events := {{ singleEvent := {
c_EPTF_LGenBase_behavior,
c_EPTF_LGenBase_inputName_testMgmt_startTC,
fsm}}}},
cellRow :={ statedCellRow := {{
inState := { anyUndefinedState := {} },
cell :={
{{c_LGenBase_Test_Enable_setCalledStep,omit}},
{c_LGenBase_Test_Enable_NextStateClacFnName, omit}, omit
}
}
}
}
},
{
events2Listen := { events := {{ singleEvent := {
c_LGenBase_Test_Enable_bName,
c_LGenBase_Test_Enable_iNameSignal,
fsm}}}},
cellRow :={ statedCellRow := {{
inState := { state := "running" },
cell :={
{{c_LGenBase_Test_Enable_setCalledInRunningStateStep,omit}},
omit, "idle"
}
}
}
}
}
}
}
}
///////////////////////////////////////////////////////////
// Testcase: f_LGenBase_Test_initEnableTests
//
// Purpose:
// Initializes the test.
// Creates the FSM, the entity group, scenario
// Stores the used component variables, such as variable IDs
// Sets the listener to the test finished event
//
// Parameters:
// - pl_selectionType - entity selection type in the TC
// - pl_enableEntities - sets the original enable/disable state
// of the entities
///////////////////////////////////////////////////////////
function f_LGenBase_Test_initEnableTests(
in charstring pl_selfName,
in EPTF_LGenBase_EntitySelectionType pl_selectionType,
in boolean pl_enableEntities,
in integer pl_numEntities := c_LGenBase_Test_Enable_DefNumEntities,
in integer pl_eGrpSize := c_LGenBase_Test_Enable_DefEGrpSize)
runs on LGenBase_Test_Enable_CT{
f_EPTF_LGenBase_init(pl_selfName, pl_numEntities);
v_LGenBase_Test_Enable_reportFinishAll := true;
v_dummyInt := f_EPTF_LGenBase_declareFunction(c_LGenBase_Test_Enable_NextStateClacFnName, {nextStateCalcFunction := refers(f_LGenBase_Test_Enable_nextStateCalcFn)})
v_LGenBase_Test_Enable_bIdx := f_EPTF_LGenBase_declareBehaviorType("b1", -1, null, null, null, null);
v_LGenBase_Test_Enable_iIdxSignal := f_EPTF_LGenBase_declareFsmEvent("b1", c_LGenBase_Test_Enable_iNameSignal);
v_dummyInt := f_EPTF_LGenBase_declareEntityType("et1", {"b1"});
v_dummyInt := f_EPTF_LGenBase_declareStep("b1", {
c_LGenBase_Test_Enable_setCalledStep,
refers( f_LGenBase_Test_Enable_setCalledStep )
});
v_dummyInt := f_EPTF_LGenBase_declareStep("b1", {
c_LGenBase_Test_Enable_setCalledInRunningStateStep,
refers( f_LGenBase_Test_Enable_setCalledInRunningStateStep )
});
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(c_LGenBase_Test_Enable_FSM);
v_dummyInt := f_EPTF_LGenBase_createEntityGroup({"eg1","et1",pl_eGrpSize})
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"TC0",{
{target := {cpsToReach := 0.0}},
{fsmList := {"c_LGenBase_Test_Enable_FSM"}}
}
},
{"TC1",{
{target := {cpsToReach := 100.0}},
{fsmList := {"c_LGenBase_Test_Enable_FSM"}},
{entitySelection := pl_selectionType},
{enableEntitiesAtStart := pl_enableEntities},
{entityFinishConditions := {{nrOfSuccesses :=1}}},
{trafficStartFinish := {{availableEntitiesFinished := {{{testFinished := {}}}}}}}
}
}
},
{}
}
)
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"}, false);
v_LGenBase_Test_Enable_tcIdxOfTc1 :=
f_EPTF_LGenBase_trafficCaseId("eg1", "SC1", "TC1");
v_LGenBase_Test_Enable_fsmIdxOfTc1 :=
f_EPTF_LGenBase_getFSMCtxIdx(c_LGenBase_Test_Enable_DefEAbsIdx, v_LGenBase_Test_Enable_tcIdxOfTc1);
var charstring vl_varNameStarts :=
f_EPTF_LGenBaseStats_getNamePrefix("eg1", "SC1", "TC1")&c_EPTF_LGenBaseStats_nameOfTcNrOfStarts;
var charstring vl_varNameNotFinished :=
f_EPTF_LGenBaseStats_getNamePrefix("eg1", "SC1", "TC1")&c_EPTF_LGenBaseStats_nameOfTcNrOfNotFinishedEntities;
v_LGenBase_Test_Enable_varIdStarts := f_EPTF_Var_getId(vl_varNameStarts);
v_LGenBase_Test_Enable_varIdNotFinished := f_EPTF_Var_getId(vl_varNameNotFinished);
if(0 > v_LGenBase_Test_Enable_varIdStarts){
setverdict(inconc,"Variable ID of starts == -1");
f_EPTF_Base_stopAll();
}
if(0 > v_LGenBase_Test_Enable_varIdNotFinished){
setverdict(inconc,"Variable ID of not finished == -1")
f_EPTF_Base_stopAll();
}
v_dummyInt := f_EPTF_LGenBase_addGeneralEventListener(
c_EPTF_LGenBase_bIdx,
c_EPTF_LGenBase_inputIdx_testMgmt_testFinished,
refers(f_EPTF_LGenBase_Test_testFinishedListener), {})
}
type enumerated LGenBase_Test_Enable_enableAction
{
enable,
disable
};
///////////////////////////////////////////////////////////
// function: f_LGenBase_Test_checkEnableTestsResults
//
// Purpose:
// Executes the test.
// Enables/disables the specified entity
// Starts the scenario
// Checks the execution numbers
///////////////////////////////////////////////////////////
function f_LGenBase_Test_checkEnableTestsResults(
in integer pl_expectedStarts,
in integer pl_expectedNotFinished,
in LGenBase_Test_Enable_enableAction pl_enable)
runs on LGenBase_Test_Enable_CT{
if(tsp_EPTF_LGenBaseTestDebug){
log("--------"&%definitionId&" Expected not finished: ",pl_expectedNotFinished)
}
if(enable == pl_enable and not v_LGenBase_Test_Enable_called){
setverdict(fail, "The entity has not been called.")
}
if(disable == pl_enable and v_LGenBase_Test_Enable_called){
setverdict(fail, "The entity has been called.")
}
var integer vl_starts := f_EPTF_Var_getIntValue(v_LGenBase_Test_Enable_varIdStarts);
if(-1 <pl_expectedStarts and pl_expectedStarts != vl_starts){
setverdict(fail, "The # of started entities (",vl_starts,
") does not equal to the requested ",c_LGenBase_Test_Enable_DefEGrpSize);
}
vl_starts := f_EPTF_Var_getIntValue(v_LGenBase_Test_Enable_varIdNotFinished);
if(pl_expectedNotFinished != vl_starts){
setverdict(fail, vl_starts," entities has not been finished. Expected: ",pl_expectedNotFinished);
}
setverdict(pass);
f_EPTF_Base_cleanup_CT();
}
///////////////////////////////////////////////////////////
// function: f_LGenBase_Test_runEnableTestsSimple
//
// Purpose:
// Executes the test where the TC is not running when
// the entity is enabled/disabled.
// Enables/disables the specified entity
// Starts the scenario
// Checks the execution numbers
///////////////////////////////////////////////////////////
function f_LGenBase_Test_runEnableTestsSimple(
in integer pl_expectedStarts,
in integer pl_expectedNotFinished,
in LGenBase_Test_Enable_enableAction pl_enable)
runs on LGenBase_Test_Enable_CT{
if(enable == pl_enable){
f_EPTF_LGenBase_enableEntityInTrafficCase(
v_LGenBase_Test_Enable_tcIdxOfTc1,
c_LGenBase_Test_Enable_DefEIdx);
}else{
f_EPTF_LGenBase_disableEntityInTrafficCase(
v_LGenBase_Test_Enable_tcIdxOfTc1,
c_LGenBase_Test_Enable_DefEIdx);
}
v_LGenBase_Test_Enable_reportSuccess := true;
v_LGenBase_Test_Enable_eIdx2Check := c_LGenBase_Test_Enable_DefEAbsIdx;
f_EPTF_LGenBase_startTrafficCase("eg1", "SC1", "TC1");
f_EPTF_LGenBase_wait4TestFinished();
f_LGenBase_Test_checkEnableTestsResults(pl_expectedStarts, pl_expectedNotFinished, pl_enable);
}
///////////////////////////////////////////////////////////
// function: f_LGenBase_Test_runEnableTestsRunning
//
// Purpose:
// Executes the test where the TC is running, but
// the entity is not, when the entity is enabled/disabled.
// Starts the scenario
// Enables/disables the specified entity
// Sets the flag to report finish for all entities
// Sets the idx of the specified entity
// Checks the execution numbers
///////////////////////////////////////////////////////////
function f_LGenBase_Test_runEnableTestsRunning(
in integer pl_expectedNotFinished,
in LGenBase_Test_Enable_enableAction pl_enable,
in boolean pl_putE2BusyState := false)
runs on LGenBase_Test_Enable_CT{
if(enable == pl_enable or pl_putE2BusyState){
f_EPTF_LGenBase_enableEntityInTrafficCase(
v_LGenBase_Test_Enable_tcIdxOfTc1,
c_LGenBase_Test_Enable_DefEIdx);
}else{
f_EPTF_LGenBase_disableEntityInTrafficCase(
v_LGenBase_Test_Enable_tcIdxOfTc1,
c_LGenBase_Test_Enable_DefEIdx);
}
v_LGenBase_Test_Enable_reportSuccess := false;
if(pl_putE2BusyState){
v_LGenBase_Test_Enable_eIdx2Check := c_LGenBase_Test_Enable_DefEAbsIdx;
v_LGenBase_Test_Enable_reportFinishAll := false;
}else{
v_LGenBase_Test_Enable_eIdx2Check := -1;
}
f_EPTF_LGenBase_startTrafficCase("eg1", "SC1", "TC1");
if(not f_EPTF_SchedulerComp_scheduleAction(
T_EPTF_componentClock.read + 0.7,
refers(f_LGenBase_Test_runEnableDisableEntity),
{enum2int(pl_enable)},
v_dummyInt)) {
f_EPTF_Base_stopAll(inconc);
}
if(tsp_EPTF_LGenBaseTestDebug){
log("--------"&%definitionId&" Action scheduled.\n Expected not finished: ",pl_expectedNotFinished)
}
f_EPTF_LGenBase_wait4TestFinished();
if(pl_putE2BusyState and not v_LGenBase_Test_Enable_calledInRunningState){
setverdict(inconc,"The entity did not get the message in running state.")
}
f_LGenBase_Test_checkEnableTestsResults(-1, pl_expectedNotFinished, pl_enable);
}
function f_LGenBase_Test_runEnableDisableEntity(
in EPTF_ScheduledAction pl_action,
in integer pl_eventIndex)
runs on LGenBase_Test_Enable_CT
return boolean{
if(tsp_EPTF_LGenBaseTestDebug){
log("--------"&%definitionId&" Action called. Enable: ",pl_action.actionId[0]==0);
}
if(pl_action.actionId[0]==1){
f_EPTF_LGenBase_disableEntityInTrafficCase(v_LGenBase_Test_Enable_tcIdxOfTc1, c_LGenBase_Test_Enable_DefEIdx);
}else{
f_EPTF_LGenBase_enableEntityInTrafficCase(v_LGenBase_Test_Enable_tcIdxOfTc1, c_LGenBase_Test_Enable_DefEIdx);
}
v_LGenBase_Test_Enable_reportSuccess := true;
v_LGenBase_Test_Enable_reportFinishAll := true;
v_LGenBase_Test_Enable_eIdx2Check := c_LGenBase_Test_Enable_DefEAbsIdx;
v_LGenBase_Test_Enable_called := false;
var EPTF_LGenBase_ReportedEventDescriptor vl_event := c_EPTF_LGenBase_emptyReportedEventDescriptor;
vl_event.event.bIdx := v_LGenBase_Test_Enable_bIdx;
vl_event.event.iIdx := v_LGenBase_Test_Enable_iIdxSignal;
vl_event.event.target.eIdx := c_LGenBase_Test_Enable_DefEAbsIdx;
vl_event.event.target.fsmCtxIdx := v_LGenBase_Test_Enable_fsmIdxOfTc1;
f_EPTF_LGenBase_dispatchEvent(vl_event)
return true;
}
///////////////////////////////////////////////////////////
// Enabling while not running
//
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_enableEnabledFreeNotRunningTCCont
//
// Purpose:
// Tests test the enabling of the
// entity in a traffic case while it's free, the TC is not running
//
// Action:
// Create a TC where the entities are enabled
// entitySelection == round_robin
// Enable entity
// Start the TC
//
// Expected Result:
// The entity must be started.
// The test must be finished.
// All the entities must be started -> c_LGenBase_Test_Enable_DefEGrpSize
// All the entities must be finished -> not finished 0
// The enabled entity must be called
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_enableEnabledFreeNotRunningTCCont()
runs on LGenBase_Test_Enable_CT{
f_LGenBase_Test_initEnableTests(
%definitionId,
round_robin,
true);
f_LGenBase_Test_runEnableTestsSimple(
pl_expectedStarts := c_LGenBase_Test_Enable_DefEGrpSize,
pl_expectedNotFinished := 0,
pl_enable := enable);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_enableEnabledFreeNotRunningTCRandom
//
// Purpose:
// Tests the same as <tc_LGenBase_Test_enableEnabledFreeNotRunningTCCont>
// but with random entity selection.
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_enableEnabledFreeNotRunningTCRandom()
runs on LGenBase_Test_Enable_CT{
f_LGenBase_Test_initEnableTests(
%definitionId,
random,
true);
f_LGenBase_Test_runEnableTestsSimple(
pl_expectedStarts := c_LGenBase_Test_Enable_DefEGrpSize,
pl_expectedNotFinished := 0,
pl_enable := enable);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_enableDisabledFreeNotRunningTCCont
//
// Purpose:
// Tests test the enabling of the
// entity in a traffic case while it's free, the TC is not running
// The entities are disabled by default
//
// Action:
// Create a TC where the entities are disabled
// Enable entities
// Start the TC
//
// Expected Result:
// Only the enabled entity can be started -> 1
// The enabled entity must be called
// Only the enabled entity can be finished ->
// not finished == c_LGenBase_Test_Enable_DefEGrpSize-1
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_enableDisabledFreeNotRunningTCCont()
runs on LGenBase_Test_Enable_CT{
f_LGenBase_Test_initEnableTests(
%definitionId,
round_robin,
false);
f_LGenBase_Test_runEnableTestsSimple(
pl_expectedStarts := 1,
pl_expectedNotFinished := c_LGenBase_Test_Enable_DefEGrpSize-1,
pl_enable := enable);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_enableDisabledFreeNotRunningTCRandom
//
// Purpose:
// Tests the same as <tc_LGenBase_Test_enableDisabledFreeNotRunningTCCont>
// with random entity selection
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_enableDisabledFreeNotRunningTCRandom()
runs on LGenBase_Test_Enable_CT{
f_LGenBase_Test_initEnableTests(
%definitionId,
round_robin,
false);
f_LGenBase_Test_runEnableTestsSimple(
pl_expectedStarts := 1,
pl_expectedNotFinished := c_LGenBase_Test_Enable_DefEGrpSize-1,
pl_enable := enable);
}
/////////////////////////////////////////////////////////////
// Disable
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_disableEnabledFreeNotRunningTCCont
//
// Purpose:
// Tests test the disabling of the
// entity in a traffic case while it's free, the TC is not running
//
// Action:
// Create a TC where the entities are enabled
// entitySelection == round_robin
// Enable entity
// Start the TC
//
// Expected Result:
// The entity must not be started.
// The test must be finished.
// All the entities must be started, except the disabled ->
// started == c_LGenBase_Test_Enable_DefEGrpSize -1
// All the entities must be finished, except the disabled ->
// not finished == 1
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_disableEnabledFreeNotRunningTCCont()
runs on LGenBase_Test_Enable_CT{
f_LGenBase_Test_initEnableTests(
%definitionId,
round_robin,
true);
f_LGenBase_Test_runEnableTestsSimple(
pl_expectedStarts := c_LGenBase_Test_Enable_DefEGrpSize-1,
pl_expectedNotFinished := 1,
pl_enable := disable);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_disableEnabledFreeNotRunningTCRandom
//
// Purpose:
// Tests the same as <tc_LGenBase_Test_disableEnabledFreeNotRunningTCCont>
// but with random entity selection.
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_disableEnabledFreeNotRunningTCRandom()
runs on LGenBase_Test_Enable_CT{
f_LGenBase_Test_initEnableTests(
%definitionId,
random,
true);
f_LGenBase_Test_runEnableTestsSimple(
pl_expectedStarts := c_LGenBase_Test_Enable_DefEGrpSize-1,
pl_expectedNotFinished := 1,
pl_enable := disable);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_disableDisabledFreeNotRunningTCCont
//
// Purpose:
// Tests test the disabling of the
// entity in a traffic case while it's free, the TC is not running
// The entities are disabled by default
//
// Action:
// Create a TC where the entities are disabled
// Enable entities
// Enable the first entity to start the TC
// Start the TC
//
// Expected Result:
// The entity must not be started.
// Only the enabled entity can be started ->
// started == 1
// Only the enabled entity can be finished ->
// not finished == c_LGenBase_Test_Enable_DefEGrpSize-1
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_disableDisabledFreeNotRunningTCCont()
runs on LGenBase_Test_Enable_CT{
f_LGenBase_Test_initEnableTests(
%definitionId,
round_robin,
false);
f_EPTF_LGenBase_enableEntityInTrafficCase(
v_LGenBase_Test_Enable_tcIdxOfTc1,
0);
f_LGenBase_Test_runEnableTestsSimple(
pl_expectedStarts := 1,
pl_expectedNotFinished := c_LGenBase_Test_Enable_DefEGrpSize-1,
pl_enable := disable);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_disableDisabledFreeNotRunningTCRandom
//
// Purpose:
// Tests the same as <tc_LGenBase_Test_disableDisabledFreeNotRunningTCCont>
// with random entity selection
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_disableDisabledFreeNotRunningTCRandom()
runs on LGenBase_Test_Enable_CT{
f_LGenBase_Test_initEnableTests(
%definitionId,
round_robin,
false);
f_EPTF_LGenBase_enableEntityInTrafficCase(
v_LGenBase_Test_Enable_tcIdxOfTc1,
0);
f_LGenBase_Test_runEnableTestsSimple(
pl_expectedStarts := 1,
pl_expectedNotFinished := c_LGenBase_Test_Enable_DefEGrpSize-1,
pl_enable := disable);
}
///////////////////////////////////////////////////////////
// Enabling while running
//
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_enableEnabledFreeRunningTCCont
//
// Purpose:
// Tests test the enabling of the
// entity in a traffic case while it's free, the TC is not running
//
// Action:
// Create a TC where the entities are enabled
// entitySelection == round_robin
// Start the TC
// Enable entity
//
// Expected Result:
// The entity must be started.
// The test must be finished.
// All the entities must be started -> c_LGenBase_Test_Enable_DefEGrpSize
// All the entities must be finished -> not finished 0
// The enabled entity must be called
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_enableEnabledFreeRunningTCCont()
runs on LGenBase_Test_Enable_CT{
f_LGenBase_Test_initEnableTests(
%definitionId,
round_robin,
true);
f_LGenBase_Test_runEnableTestsRunning(
pl_expectedNotFinished := 0,
pl_enable := enable);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_enableEnabledFreeRunningTCRandom
//
// Purpose:
// Tests the same as <tc_LGenBase_Test_enableEnabledFreeRunningTCCont>
// but with random entity selection.
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_enableEnabledFreeRunningTCRandom()
runs on LGenBase_Test_Enable_CT{
f_LGenBase_Test_initEnableTests(
%definitionId,
random,
true);
f_LGenBase_Test_runEnableTestsRunning(
pl_expectedNotFinished := 0,
pl_enable := enable);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_enableDisabledFreeRunningTCCont
//
// Purpose:
// Tests test the enabling of the
// entity in a traffic case while it's free, the TC is not running
// The entities are disabled by default
//
// Action:
// Create a TC where the entities are disabled
// Enable entities
// Start the TC
//
// Expected Result:
// The enabled entity must be called
// All entities must be finished ->
// not finished == c_LGenBase_Test_Enable_DefEGrpSize
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_enableDisabledFreeRunningTCCont()
runs on LGenBase_Test_Enable_CT{
f_LGenBase_Test_initEnableTests(
%definitionId,
round_robin,
false);
for ( var integer vl_i := 0; vl_i < c_LGenBase_Test_Enable_DefEGrpSize ; vl_i := vl_i+1 ){
if(vl_i != c_LGenBase_Test_Enable_DefEIdx){
f_EPTF_LGenBase_enableEntityInTrafficCase(v_LGenBase_Test_Enable_tcIdxOfTc1, vl_i);
}
}
f_LGenBase_Test_runEnableTestsRunning(
pl_expectedNotFinished := 0,
pl_enable := enable);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_enableDisabledFreeRunningTCRandom
//
// Purpose:
// Tests the same as <tc_LGenBase_Test_enableDisabledFreeRunningTCCont>
// with random entity selection
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_enableDisabledFreeRunningTCRandom()
runs on LGenBase_Test_Enable_CT{
f_LGenBase_Test_initEnableTests(
%definitionId,
random,
false);
for ( var integer vl_i := 0; vl_i < c_LGenBase_Test_Enable_DefEGrpSize ; vl_i := vl_i+1 ){
if(vl_i != c_LGenBase_Test_Enable_DefEIdx){
f_EPTF_LGenBase_enableEntityInTrafficCase(v_LGenBase_Test_Enable_tcIdxOfTc1, vl_i);
}
}
f_LGenBase_Test_runEnableTestsRunning(
pl_expectedNotFinished := 0,
pl_enable := enable);
}
/////////////////////////////////////////////////////////////
// Disable
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_disableEnabledFreeRunningTCCont
//
// Purpose:
// Tests test the disabling of the
// entity in a traffic case while it's free, the TC is not running
//
// Action:
// Create a TC where the entities are enabled
// entitySelection == round_robin
// Enable entity
// Start the TC
//
// Expected Result:
// The entity must not be started.
// The test must be finished.
// All the entities must be started, except the disabled ->
// started == c_LGenBase_Test_Enable_DefEGrpSize -1
// All the entities must be finished, except the disabled ->
// not finished == 1
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_disableEnabledFreeRunningTCCont()
runs on LGenBase_Test_Enable_CT{
f_LGenBase_Test_initEnableTests(
%definitionId,
round_robin,
true);
f_LGenBase_Test_runEnableTestsRunning(
pl_expectedNotFinished := 1,
pl_enable := disable);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_disableEnabledFreeRunningTCRandom
//
// Purpose:
// Tests the same as <tc_LGenBase_Test_disableEnabledFreeRunningTCCont>
// but with random entity selection.
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_disableEnabledFreeRunningTCRandom()
runs on LGenBase_Test_Enable_CT{
f_LGenBase_Test_initEnableTests(
%definitionId,
random,
true);
f_LGenBase_Test_runEnableTestsRunning(
pl_expectedNotFinished := 1,
pl_enable := disable);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_disableDisabledFreeRunningTCCont
//
// Purpose:
// Tests test the disabling of the
// entity in a traffic case while it's free, the TC is not running
// The entities are disabled by default
//
// Action:
// Create a TC where the entities are disabled
// Enable entities
// Enable the first entity to start the TC
// Start the TC
//
// Expected Result:
// The entity must not be started.
// Only the enabled entity can be started ->
// started == 1
// Only the enabled entity can be finished ->
// not finished == c_LGenBase_Test_Enable_DefEGrpSize-1
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_disableDisabledFreeRunningTCCont()
runs on LGenBase_Test_Enable_CT{
f_LGenBase_Test_initEnableTests(
%definitionId,
round_robin,
false);
for ( var integer vl_i := 0; vl_i < c_LGenBase_Test_Enable_DefEGrpSize ; vl_i := vl_i+1 ){
if(vl_i != c_LGenBase_Test_Enable_DefEIdx){
f_EPTF_LGenBase_enableEntityInTrafficCase(v_LGenBase_Test_Enable_tcIdxOfTc1, vl_i);
}
}
f_LGenBase_Test_runEnableTestsRunning(
pl_expectedNotFinished := 1,
pl_enable := disable);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_disableDisabledFreeRunningTCRandom
//
// Purpose:
// Tests the same as <tc_LGenBase_Test_disableDisabledFreeRunningTCCont>
// with random entity selection
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_disableDisabledFreeRunningTCRandom()
runs on LGenBase_Test_Enable_CT{
f_LGenBase_Test_initEnableTests(
%definitionId,
round_robin,
false);
for ( var integer vl_i := 0; vl_i < c_LGenBase_Test_Enable_DefEGrpSize ; vl_i := vl_i+1 ){
if(vl_i != c_LGenBase_Test_Enable_DefEIdx){
f_EPTF_LGenBase_enableEntityInTrafficCase(v_LGenBase_Test_Enable_tcIdxOfTc1, vl_i);
}
}
f_LGenBase_Test_runEnableTestsRunning(
pl_expectedNotFinished := 1,
pl_enable := disable);
}
///////////////////////////////////////////////////////////
// Running entity
//
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_enableBusyTCCont
//
// Purpose:
// Tests test the enabling of the
// entity in a traffic case while it's running
//
// Action:
// Create a TC where the entities are enabled
// entitySelection == round_robin
// Start the TC
// Enable entity
//
// Expected Result:
// The entity must be started.
// The test must be finished.
// All the entities must be finished -> not finished 0
// The enabled entity must be called
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_enableBusyTCCont()
runs on LGenBase_Test_Enable_CT{
f_LGenBase_Test_initEnableTests(
%definitionId,
round_robin,
true);
f_LGenBase_Test_runEnableTestsRunning(
pl_expectedNotFinished := 0,
pl_enable := enable,
pl_putE2BusyState := true);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_enableBusyTCRandom
//
// Purpose:
// Tests the same as <tc_LGenBase_Test_enableBusyTCCont>
// but with random entity selection.
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_enableBusyTCRandom()
runs on LGenBase_Test_Enable_CT{
f_LGenBase_Test_initEnableTests(
%definitionId,
random,
true);
f_LGenBase_Test_runEnableTestsRunning(
pl_expectedNotFinished := 0,
pl_enable := enable,
pl_putE2BusyState := true);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_enableBusyTCCont
//
// Purpose:
// Tests test the enabling of the
// entity in a traffic case while it's running
//
// Action:
// Create a TC where the entities are enabled
// entitySelection == round_robin
// Start the TC
// Enable entity
//
// Expected Result:
// The entity must be started.
// The test must be finished.
// All the entities must be finished, except the disabled -> not finished 1
// The enabled entity must be called
//
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_disableBusyTCCont()
runs on LGenBase_Test_Enable_CT{
f_LGenBase_Test_initEnableTests(
%definitionId,
round_robin,
true);
f_LGenBase_Test_runEnableTestsRunning(
pl_expectedNotFinished := 1,
pl_enable := disable,
pl_putE2BusyState := true);
}
///////////////////////////////////////////////////////////
// Testcase: tc_LGenBase_Test_enableBusyTCRandom
//
// Purpose:
// Tests the same as <tc_LGenBase_Test_enableBusyTCCont>
// but with random entity selection.
///////////////////////////////////////////////////////////
testcase tc_LGenBase_Test_disableBusyTCRandom()
runs on LGenBase_Test_Enable_CT{
f_LGenBase_Test_initEnableTests(
%definitionId,
random,
true);
f_LGenBase_Test_runEnableTestsRunning(
pl_expectedNotFinished := 1,
pl_enable := disable,
pl_putE2BusyState := true);
}
} //enableEntity
control{
execute(tc_LGenBase_Test_fsmVariablesFSMList())
execute(tc_LGenBase_Test_Neg_fsmVarDiffInitVal());
execute(tc_LGenBase_Test_Neg_fsmVarDiffType());
execute(tc_LGenBase_Test_fsmVarFsmScope());
execute(tc_LGenBase_Test_fsmVarTcScope());
execute(tc_LGenBase_Test_siblingDispatch1())
execute(tc_LGenBase_Test_siblingFsm_Neg_activateFsm())
execute(tc_LGenBase_Test_replyEvent())
execute(tc_LGenBase_Test_replyEventOfFsm())
execute(tc_LGenBase_Test_siblingInvalidSiblingName())
execute(tc_LGenBase_Test_siblingInvalidSiblingNameWithoutVarName())
execute(tc_LGenBase_Test_siblingInvalidSiblingBehaviorName())
execute(tc_LGenBase_Test_siblingInvalidSiblingInputName())
execute(tc_LGenBase_Test_siblingInvalidSiblingBehaviorPlusInput())
execute(tc_LGenBase_Test_siblingInvalidSiblingVariableName())
execute(tc_LGenBase_Test_replyInvalidBehaviorName())
execute(tc_LGenBase_Test_replyInvalidInputName())
execute(tc_LGenBase_Test_replyInvalidBehaviorPlusInput())
execute(tc_LGenBase_Test_replyInvalidVariableName())
execute(tc_LGenBase_Test_pushPopReply_Dispatch())
execute(tc_LGenBase_Test_pushPopReply_stackOrder())
execute(tc_LGenBase_Test_pushPopReply_stackOrder2())
execute(tc_LGenBase_Test_pushPopReply_morePopThanPush())
execute(tc_LGenBase_Test_pushPopReply_moreReplyThanPush())
execute(tc_LGenBase_Test_pushPopReply_Post())
execute(tc_LGenBase_Test_pushPostReply_morePostReplyThanPush());
execute(tc_LGenBase_Test_pushPopReply_Reply2Both())
execute(tc_LGenBase_Test_pushPopReply_Reply2Times())
execute(tc_LGenBase_Test_pushPopReplyOwnEventDispatch());
execute(tc_LGenBase_Test_pushPopReply_moreOwnEventDispatch());
execute(tc_LGenBase_Test_pushPopReplyOwnEventPost());
execute(tc_LGenBase_Test_pushPopReply_moreOwnEventPost());
execute(tc_LGenBase_Test_invalidEventToTC_tcName());
execute(tc_LGenBase_Test_invalidEventToTC_behaviorName());
execute(tc_LGenBase_Test_invalidEventToTC_inputName());
execute(tc_LGenBase_Test_invalidEventToTC_argVarName());
execute(tc_LGenBase_Test_eventToTC());
execute(tc_LGenBase_Test_eventFromSibling_fsmListener());
execute(tc_LGenBase_Test_eventFromSibling_entityListener());
execute(tc_LGenBase_Test_eventFromSibling_generalListener());
execute(tc_LGenBase_Test_eventFromSibling_invalidBehavior());
execute(tc_LGenBase_Test_eventFromSibling_invalidInput());
execute(tc_LGenBase_Test_eventFromSibling_singleEvent());
execute(tc_LGenBase_Test_eventFromSibling_eventList());
execute(tc_LGenBase_Test_eventFromSibling_eventRange());
execute(tc_LGenBase_Test_declareEvent());
execute(tc_LGenBase_Test_eventOfFsmToSibling_Dispatch());
execute(tc_LGenBase_Test_eventOfFsmToSibling_Post());
execute(tc_LGenBase_Test_Neg_fsmStatHandlersWithDiffProvider1());
execute(tc_LGenBase_Test_Neg_fsmStatHandlersWithDiffProvider2());
execute(tc_LGenBase_Test_Neg_fsmStatHandlersWithDiffResetValue1());
execute(tc_LGenBase_Test_Neg_fsmStatHandlersWithDiffResetValue2());
execute(tc_LGenBase_Test_Neg_fsmStatHandlersWithDiffScope1());
execute(tc_LGenBase_Test_Neg_fsmStatHandlersWithDiffScope2());
execute(tc_LGenBase_Test_Neg_fsmStatHandlersWithDiffScope3());
execute(tc_LGenBase_Test_Neg_fsmStatHandlersWithDiffScope4());
execute(tc_LGenBase_Test_Neg_fsmStatHandlersWithDiffScope5());
execute(tc_LGenBase_Test_Neg_fsmStatHandlersWithDiffScope6());
execute(tc_LGenBase_Test_Neg_fsmStatHandlersWithDiffMethod());
execute(tc_LGenBase_Test_fsmStatHandlerVarProviders1());
execute(tc_LGenBase_Test_fsmStatHandlerVarProviders2());
execute(tc_LGenBase_Test_fsmStatHandlerVarProviders3());
execute(tc_LGenBase_Test_fsmStatHandlerVarProviders4());
execute(tc_LGenBase_Test_fsmStatHandlerVarProviders5());
execute(tc_LGenBase_Test_fsmStatHandlerVarProviders6());
execute(tc_LGenBase_Test_fsmStatHandlerVarProviders7());
execute(tc_LGenBase_Test_fsmStatHandlerVarProviders8());
execute(tc_LGenBase_Test_fsmStatHandlerVarProviders9());
//execute(tc_LGenBase_Test_Neg_fsmStatHandlerVarProviders1());
//execute(tc_LGenBase_Test_Neg_fsmStatHandlerVarProviders2());
//execute(tc_LGenBase_Test_Neg_fsmStatHandlerVarProviders3());
execute(tc_LGenBase_Test_fsmStatHandlerStatMeasProviders1());
execute(tc_LGenBase_Test_fsmStatHandlerStatMeasProviders2());
execute(tc_LGenBase_Test_fsmStatHandlerStatMeasProviders3());
execute(tc_LGenBase_Test_fsmStatHandlerStatMeasProviders4());
execute(tc_LGenBase_Test_fsmStatHandlerStatMeasProviders5());
execute(tc_LGenBase_Test_fsmStatHandlerStatMeasProviders6());
execute(tc_LGenBase_Test_fsmStatHandlerStatMeasProviders7());
execute(tc_LGenBase_Test_fsmStatHandlerStatMeasProviders8());
execute(tc_LGenBase_Test_fsmStatHandlerStatMeasProviders9());
//execute(tc_LGenBase_Test_Neg_fsmStatHandlerStatMeasProviders1());
//execute(tc_LGenBase_Test_Neg_fsmStatHandlerStatMeasProviders2());
//execute(tc_LGenBase_Test_Neg_fsmStatHandlerStatMeasProviders3());
execute(tc_LGenBase_Test_fsmStatHandlerStatHandlerProviders1());
execute(tc_LGenBase_Test_fsmStatHandlerStatHandlerProviders2());
execute(tc_LGenBase_Test_fsmStatHandlerStatHandlerProviders3());
execute(tc_LGenBase_Test_fsmStatHandlerStatHandlerProviders4());
execute(tc_LGenBase_Test_fsmStatHandlerStatHandlerProviders5());
execute(tc_LGenBase_Test_fsmStatHandlerStatHandlerProviders6());
execute(tc_LGenBase_Test_fsmStatHandlerStatHandlerProviders7());
execute(tc_LGenBase_Test_fsmStatHandlerStatHandlerProviders8());
execute(tc_LGenBase_Test_fsmStatHandlerStatHandlerProviders9());
//execute(tc_LGenBase_Test_Neg_fsmStatHandlerStatHandlerProviders1());
//execute(tc_LGenBase_Test_Neg_fsmStatHandlerStatHandlerProviders2());
//execute(tc_LGenBase_Test_Neg_fsmStatHandlerStatHandlerProviders3());
execute(tc_LGenBase_Test_Neg_siblingFsmVariables_differentInitValue());
execute(tc_LGenBase_Test_Neg_siblingFsmVariables_differentType());
execute(tc_LGenBase_Test_Neg_siblingFsmVariables_differentScope1());
execute(tc_LGenBase_Test_Neg_siblingFsmVariables_differentScope2());
execute(tc_LGenBase_Test_Neg_siblingFsmVariables_differentScope3());
execute(tc_LGenBase_Test_Neg_siblingFsmVariables_differentScope4());
execute(tc_LGenBase_Test_Neg_siblingFsmVariables_differentScope5());
execute(tc_LGenBase_Test_Neg_siblingFsmVariables_differentScope6());
execute(tc_LGenBase_Test_Neg_siblingFsmVariables_redefinition());
execute(tc_LGenBase_Test_Neg_fsmStatMeasDiffProvider1());
execute(tc_LGenBase_Test_Neg_fsmStatMeasDiffProvider2());
execute(tc_LGenBase_Test_Neg_fsmStatMeasDiffTarget1());
execute(tc_LGenBase_Test_Neg_fsmStatMeasDiffTarget2());
execute(tc_LGenBase_Test_Neg_fsmStatMeasDiffStatType1());
execute(tc_LGenBase_Test_Neg_fsmStatMeasDiffStatType2());
execute(tc_LGenBase_Test_Neg_fsmStatMeasDiffStatMeasParams1());
execute(tc_LGenBase_Test_Neg_fsmStatMeasDiffStatMeasParams2());
execute(tc_LGenBase_Test_Neg_fsmStatMeasDiffScope1());
execute(tc_LGenBase_Test_Neg_fsmStatMeasDiffScope2());
execute(tc_LGenBase_Test_Neg_fsmStatMeasDiffScope3());
execute(tc_LGenBase_Test_Neg_fsmStatMeasDiffScope4());
execute(tc_LGenBase_Test_Neg_fsmStatMeasDiffScope5());
execute(tc_LGenBase_Test_Neg_fsmStatMeasDiffScope6());
execute(tc_LGenBase_Test_Neg_fsmStatMeasDiffScope7());
execute(tc_LGenBase_Test_Neg_fsmStatMeasDiffScope8());
execute(tc_LGenBase_Test_fsmTCStatsForSiblingFSMs());
execute(tc_LGenBase_Test_fsmStatMeasCheck());
execute(tc_LGenBase_Test_verdictStep())
execute(tc_LGenBase_Test_verdictStepOmit())
//FSM hookpoints
execute(tc_LGenBase_Test_FSMMergeClassic());
execute(tc_LGenBase_Test_FSMMergeExtended());
execute(tc_LGenBase_Test_FSMMergeNoHookpoint());
execute(tc_LGenBase_Test_FSMMergeNoMatchingHookpoint());
execute(tc_LGenBase_Test_enableBusyTCCont());
execute(tc_LGenBase_Test_enableBusyTCRandom());
execute(tc_LGenBase_Test_disableBusyTCCont());
execute(tc_LGenBase_Test_disableBusyTCRandom());
execute(tc_LGenBase_Test_enableDisabledFreeRunningTCRandom());
execute(tc_LGenBase_Test_enableDisabledFreeRunningTCCont());
execute(tc_LGenBase_Test_enableEnabledFreeRunningTCRandom());
execute(tc_LGenBase_Test_enableEnabledFreeRunningTCCont());
execute(tc_LGenBase_Test_disableEnabledFreeRunningTCCont());
execute(tc_LGenBase_Test_disableEnabledFreeRunningTCRandom());
execute(tc_LGenBase_Test_disableDisabledFreeRunningTCCont());
execute(tc_LGenBase_Test_disableDisabledFreeRunningTCRandom());
execute(tc_LGenBase_Test_enableDisabledFreeNotRunningTCRandom());
execute(tc_LGenBase_Test_enableDisabledFreeNotRunningTCCont());
execute(tc_LGenBase_Test_enableEnabledFreeNotRunningTCRandom());
execute(tc_LGenBase_Test_enableEnabledFreeNotRunningTCCont());
execute(tc_LGenBase_Test_disableEnabledFreeNotRunningTCRandom());
execute(tc_LGenBase_Test_disableEnabledFreeNotRunningTCCont());
execute(tc_LGenBase_Test_disableDisabledFreeNotRunningTCRandom());
execute(tc_LGenBase_Test_disableDisabledFreeNotRunningTCCont());
}
} // end of module