blob: 5be751732490bda57ee96b6476347dabb939834a [file] [log] [blame]
///////////////////////////////////////////////////////////////////////////////
// //
// Copyright (c) 2000-2018 Ericsson Telecom AB //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v2.0 //
// which accompanies this distribution, and is available at //
// https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html //
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
//
// Purpose:
// This module provides functions for testing 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);