//***************************************************************************** // (C) Automotive Lighting Reutlingen GmbH // Tuebinger Strasse 123, 72762 Reutlingen, Germany // // Automotive Lighting Reutlingen GmbH owns all the rights to this work. // This work shall not be copied, reproduced, used, modified, transferred // or its information shall not be disclosed without the prior written // authorization of Automotive Lighting Reutlingen GmbH. //***************************************************************************** //----------------------------------------------------------------------------- /// \file Test.c /// /// \brief Unit Test Cases for Control-Stepper /// /// \author P. Ott /// J. Kling (mmemea\F84304b) //----------------------------------------------------------------------------- #include //#include #include #include #include #include #include "Rte_Type.h" //nclude "Rte_ctaaCtrlStp_Type.h" // FLM3 #include "Rte_ctasCtrlStp_Type.h" //#include "Rte_SwcLaIntegrationFem_Type.h" #include // 'tRomPara_CodingArea applicationCodingData' //----------------------------------------------------------------------------- // defines //----------------------------------------------------------------------------- //limits for algorithm tests #define TEST_TransmFactorMin 2000u #define TEST_TransmFactorMax 20000u #define TEST_TransmFactorStep 9u #define TEST_OffsetMin 100u #define TEST_OffsetMax 500u #define TEST_OffsetStep 7u #define TEST_AngleMin -2000 #define TEST_AngleMax 2000 #define TEST_AngleStep 1 #define TEST_StepPosMin 0 #define TEST_StepPosMax 1000 #define TEST_StepPosStep 1 #define TEST_SpeedMin 0u #define TEST_SpeedMax 5000u #define TEST_SpeedStep 1u #define TEST_TminMin 1000u #define TEST_TminMax 65534u #define TEST_TminStep 1u //----------------------------------------------------------------------------- // local types //----------------------------------------------------------------------------- typedef enum // states for engine state-machine { CtrlStp_eState_Init = 0, // initial state CtrlStp_eState_Dis = 1, // disabled by coding data CtrlStp_eState_Off = 2, // no current CtrlStp_eState_RefDn = 3, // reference run active CtrlStp_eState_RefUp = 4, // reference run active CtrlStp_eState_Norm = 5, // normal mode CtrlStp_eState_Err = 6 // stepper defect } tCtrlStp_StateMain; typedef struct { tCtrlStp_StateMain eMain; boolean boEntry; } tCtrlStp_State; //----------------------------------------------------------------------------- // Variables for RTE stub functions //----------------------------------------------------------------------------- tieMountingSide Test_MountingSide; tieDataStatus Test_CodingStatus; tieDataStatus Test_EftCrcStatus; uint16 Test_unLwrAnschlagMi; uint16 Test_unLwrAnschlagPl; uint16 Test_unLwrMaxWinkelMi; uint16 Test_unLwrMaxWinkelPl; uint16 Test_unLwrHsGrad_LI; uint16 Test_unLwrHsGrad_RE; uint16 Test_unLwrHsZeitAp; uint16 Test_unLwrHsZeitSp; uint16 Test_unLwrHsZeitMinTt; boolean Test_boLwrEnable; uint8 Test_ucLwrHsWertStart; boolean Test_boLwrTestDlAktiv; uint16 Test_unLwrTestDlWeg; uint8 Test_ucLwrTestDlPerio; uint8 Test_ucLwrApWert; boolean Test_boLwrApVz; uint8 Test_ucLwrSpWert; boolean Test_boLwrSpVz; uint8 Test_ucLwrWellRefTimeout; uint8 Test_ucLwrAutorefZeitversatz; uint8 Test_ucCtrSpnEngReq; sint16 Test_nPosReq; uint16 Test_unSpeedReq; uint8 Test_ucIndex; sint16 Test_nRefPos; // tbd-FLM3-HH5tieCtrSleepMode Test_SleepAbort; // tbd-FLM3-HH5tieCtrSleepMode Test_SleepDelay; // tbd-FLM3-HH5sigGroup_V_VEH Test_V_Veh; // tbd-FLM3-HH5sigGroup_CTR_LP_EX_2 Test_CtrlLf; // tbd-FLM3-HH5sigGroup_CON_VEH Test_ConVehAll; tisAllStpActual Test_ActAll; tisAllStpTarget Test_TgtAll; tisStatusSpinningFront Test_Status; tisStepperTgt Test_StepperTgt; tisVehicleSpeedSts Test_VehicleSpeedSts; //----------------------------------------------------------------------------- // RTE stub functions //----------------------------------------------------------------------------- //#define Rte_Write_ppaseCtrlStpStepperActual0_StatusSpinningFront Rte_Write_ctasCtrlStp_ppaseCtrlStpStepperActual0_StatusSpinningFront //#define Rte_Write_ppaseCtrlStpTarget0_StpTargetValues Rte_Write_ctasCtrlStp_ppaseCtrlStpTarget0_StpTargetValues //#define Rte_Read_ppareStepperTgtReq_sStepperTgtReq Rte_Read_ctasCtrlStp_ppareStepperTgtReq_sStepperTgtReq //#define Rte_Read_ppareCddStpActual0_sStpActualValues Rte_Read_ctasCtrlStp_ppareCddStpActual0_sStpActualValues //#define Rte_Call_ppaclCddStpOnOffReq_StpOff Rte_Call_ctasCtrlStp_ppaclCddStpOnOffReq_StpOff //#define Rte_Call_ppaclCddStpRefRunReq_StartRefRun Rte_Call_ctasCtrlStp_ppaclCddStpRefRunReq_StartRefRun Std_ReturnType Rte_Write_ctasCtrlStp_ppaseCtrlStpStepperActual0_StatusSpinningFront( const tisStatusSpinningFront *pData) { return RTE_E_OK; } Std_ReturnType Rte_Write_ctasCtrlStp_ppaseCtrlStpTarget0_StpTargetValues( const tisAllStpTarget *pData) { return RTE_E_OK; } Std_ReturnType Rte_Read_ctasCtrlStp_ppareCddStpActual0_sStpActualValues( tisAllStpActual *pData) { return RTE_E_OK; } //d_ReturnType Rte_Read_ctasCtrlStp_ppareCodMCodingDataStatus0_sVal( tieDataStatus *pData) { return RTE_E_OK; } //d_ReturnType Rte_Read_ctasCtrlStp_ppareCodMEftCrcStatus0_sVal( tieDataStatus *pData) { return RTE_E_OK; } Std_ReturnType Rte_Read_ctasCtrlStp_ppareStepperTgtReq_sStepperTgtReq( tisStepperTgt *pData) { *pData = Test_StepperTgt; return RTE_E_OK; } Std_ReturnType Rte_Read_ctasCtrlStp_ppareNetMgmtSts_sNetworkMngmgtSts( tisNetworkMngmntSts *pData) { return RTE_E_OK; } Std_ReturnType Rte_Read_ctasCtrlStp_ppareVehicleSpeedSts_sVehicleSpeedSts( tisVehicleSpeedSts *pData) { *pData = Test_VehicleSpeedSts; return RTE_E_OK; } Std_ReturnType Rte_Read_ctasCtrlStp_ppareIgnitionSts_sIgnitionSts( tisIgnitioinSts *pData) { return RTE_E_OK; } Std_ReturnType Rte_Read_ctasCtrlStp_ppsreCddNmModeSts_eMode( tieEcuNmModes *pData) { return RTE_E_OK; } Std_ReturnType Rte_Call_ctasCtrlStp_ppaclIoHwAbUserMountingSide1_IoHwAbUser_GetMountingSide( tieMountingSide *pData) { *pData = Test_MountingSide; return RTE_E_OK; } Std_ReturnType Rte_Call_ctasCtrlStp_ppaclCddStpOnOffReq_StpOff(void) { return RTE_E_OK; } Std_ReturnType Rte_Call_ctasCtrlStp_ppaclCddStpOnOffReq_StpOn(void) { return RTE_E_OK; } Std_ReturnType Rte_Call_ctasCtrlStp_ppaclCddStpRefRunReq_StartRefRun(tieStepperIndex stepperIndex, ti16StepperPosition_halfsteps position) { Test_ucIndex = stepperIndex, Test_nRefPos = position; return RTE_E_OK; } //Std_ReturnType Rte_Call_ctaaCtrlStp_ppIoHwAbUserMountingSide1_IoHwAbUser_GetMountingSide(tieMountingSide* peVal) { *peVal = Test_MountingSide; return RTE_E_OK; } Std_ReturnType Rte_Call_ctaaCtrlStp_ppCodingData0_GetLWR_HS_ZEIT_MIN_TIEFTEMP (uint16* pVal) { *pVal = Test_unLwrHsZeitMinTt; return RTE_E_OK; } Std_ReturnType Rte_Read_ctasCtrlStp_ppareCodMCodingDataStatus0_eCompleteCodingDataStatus(tieDataStatus* pData) { *pData = Test_CodingStatus; return RTE_E_OK; } Std_ReturnType Rte_Read_ctasCtrlStp_ppareCodMEftCrcStatus0_eEftDataStatus(tieDataStatus* pData) { *pData = Test_EftCrcStatus; return RTE_E_OK; } Std_ReturnType Rte_Call_ctaaCtrlStp_ppCodingData0_GetLWR_HS_ZEIT_AP (uint16* pVal) { *pVal = Test_unLwrHsZeitAp; return RTE_E_OK; } Std_ReturnType Rte_Call_ctaaCtrlStp_ppCodingData0_GetLWR_HS_ZEIT_SP (uint16* pVal) { *pVal = Test_unLwrHsZeitSp; return RTE_E_OK; } Std_ReturnType Rte_Call_ctaaCtrlStp_ppCodingData0_GetLWR_ENABLE (boolean* pVal) { *pVal = Test_boLwrEnable; return RTE_E_OK; } Std_ReturnType Rte_Call_ctaaCtrlStp_ppCodingData0_GetLWR_TEST_DL_AKTIV (boolean* pVal) { *pVal = Test_boLwrTestDlAktiv; return RTE_E_OK; } Std_ReturnType Rte_Call_ctaaCtrlStp_ppCodingData0_GetLWR_TEST_DL_WEG (uint16* pVal) { *pVal = Test_unLwrTestDlWeg; return RTE_E_OK; } Std_ReturnType Rte_Call_ctaaCtrlStp_ppCodingData0_GetLWR_TEST_DL_PERIODE (uint8* pVal) { *pVal = Test_ucLwrTestDlPerio; return RTE_E_OK; } Std_ReturnType Rte_Call_ctaaCtrlStp_ppCodingData0_GetLWR_HS_WERT_START (uint8* pVal) { *pVal = Test_ucLwrHsWertStart; return RTE_E_OK; } Std_ReturnType Rte_Call_ctaaCtrlStp_ppCodingData0_GetLWR_WELL_REF_timeout (uint8* pVal) { *pVal = Test_ucLwrWellRefTimeout; return RTE_E_OK; } Std_ReturnType Rte_Call_ctaaCtrlStp_ppCodingData0_GetLWR_AUTOREF_ZEITVERSATZ(uint8* pVal) { *pVal = Test_ucLwrAutorefZeitversatz; return RTE_E_OK; } // different calls for LI and RE may use the same source Std_ReturnType Rte_Call_ctaaCtrlStp_ppCodingData0_GetLWR_ANSCHLAG_MI_LI (uint16* pVal) { *pVal = Test_unLwrAnschlagMi; return RTE_E_OK; } Std_ReturnType Rte_Call_ctaaCtrlStp_ppCodingData0_GetLWR_ANSCHLAG_MI_RE (uint16* pVal) { *pVal = Test_unLwrAnschlagMi; return RTE_E_OK; } Std_ReturnType Rte_Call_ctaaCtrlStp_ppCodingData0_GetLWR_ANSCHLAG_PL_LI (uint16* pVal) { *pVal = Test_unLwrAnschlagPl; return RTE_E_OK; } Std_ReturnType Rte_Call_ctaaCtrlStp_ppCodingData0_GetLWR_ANSCHLAG_PL_RE (uint16* pVal) { *pVal = Test_unLwrAnschlagPl; return RTE_E_OK; } Std_ReturnType Rte_Call_ctaaCtrlStp_ppCodingData0_GetLWR_MAX_WINKEL_MI_LI(uint16* pVal) { *pVal = Test_unLwrMaxWinkelMi; return RTE_E_OK; } Std_ReturnType Rte_Call_ctaaCtrlStp_ppCodingData0_GetLWR_MAX_WINKEL_MI_RE(uint16* pVal) { *pVal = Test_unLwrMaxWinkelMi; return RTE_E_OK; } Std_ReturnType Rte_Call_ctaaCtrlStp_ppCodingData0_GetLWR_MAX_WINKEL_PL_LI(uint16* pVal) { *pVal = Test_unLwrMaxWinkelPl; return RTE_E_OK; } Std_ReturnType Rte_Call_ctaaCtrlStp_ppCodingData0_GetLWR_MAX_WINKEL_PL_RE(uint16* pVal) { *pVal = Test_unLwrMaxWinkelPl; return RTE_E_OK; } Std_ReturnType Rte_Call_ctaaCtrlStp_ppCodingData0_GetLWR_AP_WERT_LI (uint8* pVal) { *pVal = Test_ucLwrApWert; return RTE_E_OK; } Std_ReturnType Rte_Call_ctaaCtrlStp_ppCodingData0_GetLWR_AP_WERT_RE (uint8* pVal) { *pVal = Test_ucLwrApWert; return RTE_E_OK; } Std_ReturnType Rte_Call_ctaaCtrlStp_ppCodingData0_GetLWR_AP_VZ_LI (boolean* pVal) { *pVal = Test_boLwrApVz; return RTE_E_OK; } Std_ReturnType Rte_Call_ctaaCtrlStp_ppCodingData0_GetLWR_AP_VZ_RE (boolean* pVal) { *pVal = Test_boLwrApVz; return RTE_E_OK; } Std_ReturnType Rte_Call_ctaaCtrlStp_ppCodingData0_GetLWR_SP_WERT_LI (uint8* pVal) { *pVal = Test_ucLwrSpWert; return RTE_E_OK; } Std_ReturnType Rte_Call_ctaaCtrlStp_ppCodingData0_GetLWR_SP_WERT_RE (uint8* pVal) { *pVal = Test_ucLwrSpWert; return RTE_E_OK; } Std_ReturnType Rte_Call_ctaaCtrlStp_ppCodingData0_GetLWR_SP_VZ_LI (boolean* pVal) { *pVal = Test_boLwrSpVz; return RTE_E_OK; } Std_ReturnType Rte_Call_ctaaCtrlStp_ppCodingData0_GetLWR_SP_VZ_RE (boolean* pVal) { *pVal = Test_boLwrSpVz; return RTE_E_OK; } // use different values here to check L/R Std_ReturnType Rte_Call_ctaaCtrlStp_ppCodingData0_GetLWR_HS_GRAD_LI(uint16* pVal) { *pVal = Test_unLwrHsGrad_LI; return RTE_E_OK; } Std_ReturnType Rte_Call_ctaaCtrlStp_ppCodingData0_GetLWR_HS_GRAD_RE(uint16* pVal) { *pVal = Test_unLwrHsGrad_RE; return RTE_E_OK; } Std_ReturnType Rte_Read_ctaaCtrlStp_CtrLpExSpnVe_CtrSpnEngVeLh(uint8* pData) { *pData = Test_ucCtrSpnEngReq; return RTE_E_OK; } Std_ReturnType Rte_Read_ctaaCtrlStp_CtrLpExSpnVe_CtrPoSpnVeLh (sint16* pData) { *pData = Test_nPosReq; return RTE_E_OK; } Std_ReturnType Rte_Read_ctaaCtrlStp_CtrLpExSpnVe_CtrVSpnVeLh (uint16* pData) { *pData = Test_unSpeedReq; return RTE_E_OK; } Std_ReturnType Rte_Read_ctaaCtrlStp_CtrLpExSpnVe_CtrSpnEngVeRh(uint8* pData) { *pData = Test_ucCtrSpnEngReq; return RTE_E_OK; } Std_ReturnType Rte_Read_ctaaCtrlStp_CtrLpExSpnVe_CtrPoSpnVeRh (sint16* pData) { *pData = Test_nPosReq; return RTE_E_OK; } Std_ReturnType Rte_Read_ctaaCtrlStp_CtrLpExSpnVe_CtrVSpnVeRh (uint16* pData) { *pData = Test_unSpeedReq; return RTE_E_OK; } // tbd-FLM3-HH5 Std_ReturnType Rte_Read_ctaaCtrlStp_sigGroup_CON_VEH_sigGroup_CON_VEH(sigGroup_CON_VEH* pData) { *pData = Test_ConVehAll; return RTE_E_OK; } Std_ReturnType Rte_Read_ctaaCtrlStp_ppCddStpActual0_sStpActualValues (tisAllStpActual* pData) { *pData = Test_ActAll; return RTE_E_OK; } // tbd-FLM3-HH5 Std_ReturnType Rte_Read_ctaaCtrlStp_sigGroup_CTR_LP_EX_2_sigGroup_CTR_LP_EX_2 (sigGroup_CTR_LP_EX_2* pData) { *pData = Test_CtrlLf; return RTE_E_OK; } // tbd-FLM3-HH5 Std_ReturnType Rte_Read_ctaaCtrlStp_sigGroup_V_VEH_sigGroup_V_VEH (sigGroup_V_VEH* pData) { *pData = Test_V_Veh; return RTE_E_OK; } Std_ReturnType Rte_Write_ctaaCtrlStp_ppCtrlStpTarget0_StpTargetValues (const tisAllStpTarget* pData) { Test_TgtAll = *pData; return RTE_E_OK; } Std_ReturnType Rte_Write_ctaaCtrlStp_ppCtrlStpStepperActual0_StatusSpinningFront(const tisStatusSpinningFront* pData) { Test_Status = *pData; return RTE_E_OK; } // tbd-FLM3-HH5 Std_ReturnType Rte_Write_ctaaCtrlStp_ppCtrlStpMode0_eSleepModeAbort (tieCtrSleepMode Data) { Test_SleepAbort = Data; return RTE_E_OK; } // tbd-FLM3-HH5 Std_ReturnType Rte_Write_ctaaCtrlStp_ppCtrlStpMode0_eSleepModeDelay (tieCtrSleepMode Data) { Test_SleepDelay = Data; return RTE_E_OK; } // tbd-FLM3-HH5 Std_ReturnType Rte_Call_ctaaCtrlStp_ppCddStpOnOffReq_StpOff(void) { return RTE_E_OK; } // tbd-FLM3-HH5 Std_ReturnType Rte_Call_ctaaCtrlStp_ppCddStpOnOffReq_StpOn (void) { return RTE_E_OK; } // tbd-FLM3-HH5 Std_ReturnType Rte_Call_ctaaCtrlStp_ppCddStpRefRunReq_StartRefRun(tieStepperIndex stepperIndex, ti16StepperPosition_halfsteps position) // tbd-FLM3-HH5 { // tbd-FLM3-HH5 Test_ucIndex = stepperIndex, // tbd-FLM3-HH5 Test_nRefPos = position; // tbd-FLM3-HH5 return RTE_E_OK; // tbd-FLM3-HH5 } //----------------------------------------------------------------------------- // static variables of tested code //----------------------------------------------------------------------------- typedef struct { uint16 unLwrAnschlagMi; uint16 unLwrAnschlagPl; uint16 unLwrMaxWinkelMi; uint16 unLwrMaxWinkelPl; uint16 unLwrHsZeitAp; uint16 unLwrHsZeitSp; uint16 unLwrHsZeitMinTt; uint16 unLwrHsGrad; uint16 unLwrTestDlWeg; uint16 unLwrTestDlPeriode; sint16 nLwrAp; sint16 nLwrSp; uint8 ucLwrHsWertStart; boolean boLwrEnable; boolean boLwrTestDlAktiv; uint8 ucLwrWellRefTimeout; uint8 ucLwrAutorefZeitversatz; } tCtrlStp_CodingData; tRomPara_CodingArea Test_applicationCodingData; extern tCtrlStp_CodingData CtrlStp_CodingData; extern boolean CtrlStp_boOperationRequest; // tbd-FLM3-HH5 extern boolean CtrlStp_boConVehOpRequest; extern tisStatusSpinningFront CtrlStp_Status; extern tCtrlStp_State CtrlStp_State; extern tisAllStpActual CtrlStp_ActAll; extern boolean CtrlStp_boStop; extern uint16 CtrlStp_unTgtTmin_usecPerHS; extern boolean CtrlStp_boDiagRefReq; extern boolean CtrlStp_boOperationStatus; // tbd-FLM3-HH5 extern boolean CtrlStp_boDiagPosReq; extern sint16 CtrlStp_nTgtPos_HS; // tbd-FLM3-HH5 extern tCtrlStp_SignalSrc CtrlStp_SignalSrc; // tbd-FLM3-HH5 extern tCtrlStp_CtrSpnEng CtrlStp_CtrSpnEngReq; // tbd-FLM3-HH5 extern uint16 CtrlStp_unDiagSpeed; extern uint16 CtrlStp_unSpeedReq_degPerSec; extern sint16 CtrlStp_nPosReq_degree; // tbd-FLM3-HH5 extern tieMountingSide CtrlStp_MountingSide; extern tisAllStpTarget CtrlStp_TgtAll; // tbd-FLM3-HH5 extern sint16 CtrlStp_nDiagPos; // tbd-FLM3-HH5 extern boolean CtrlStp_boInscenReq; // tbd-FLM3-HH5 extern sint16 CtrlStp_nInscenPos; // tbd-FLM3-HH5 extern uint16 CtrlStp_unInscenTmin; // tbd-FLM3-HH5 extern uint16 CtrlStp_unInscenTimer; // tbd-FLM3-HH5 extern boolean CtrlStp_boSpeedAbove5; // tbd-FLM3-HH5 extern uint16 CtrlStp_unRefDelayCnt; // tbd-FLM3-HH5 extern boolean CtrlStp_boSleepReq; extern tieReferenceReq eReferenceReq_previous; extern tisStepperTgt CtrlStp_Rte_sStepperTgt; extern tisVehicleSpeedSts CtrlStp_Rte_sVehicleSpeedSts; extern tieEcuNmModes CtrlStp_Rte_eEcuNmModes; extern tisNetworkMngmntSts CtrlStp_Rte_sNetworkMngmntSts; extern tisIgnitioinSts CtrlStp_Rte_sIgnitioinSts; typedef enum { tCtrlStp_eLevellingSts_Init = /*INIT*/ 0u, tCtrlStp_eLevellingSts_Normal = LEVELLING_MODE_NORMAL, tCtrlStp_eLevellingSts_Fs1 = LEVELLING_MODE_FAILSAFE1, tCtrlStp_eLevellingSts_Fs2 = LEVELLING_MODE_FAILSAFE2, tCtrlStp_eLevellingSts_Undef = LEVELLING_MODE_UNDEFINED } tCtrlStp_eLevellingSts; typedef enum { tCtrlStp_eReferenceReq_Init = /*INIT*/ 0u, tCtrlStp_eReferenceReq_Off = REFRENCE_REQ_OFF, tCtrlStp_eReferenceReq_InitCan = REFRENCE_REQ_INITIALIZE, tCtrlStp_eReferenceReq_Norm = REFRENCE_REQ_NORMAL, tCtrlStp_eReferenceReq_Test = REFRENCE_REQ_TEST, tCtrlStp_eReferenceReq_Undef = REFRENCE_REQ_UNDEFINED } tCtrlStp_eReferenceReq; typedef enum { tCtrlStp_opVehicleSpeed_MaxRef = 5u, tCtrlStp_opVehicleSpeed_Invalid = 0x1FFu // = '511' } tCtrlStp_opVehicleSpeed; typedef enum { tCtrlStp_eIgnitionSts_Init = 0u, tCtrlStp_eIgnitionSts_Off = IGN_OFF, tCtrlStp_eIgnitionSts_IgnOn = IGN_ON } tCtrlStp_eIgnitionSts; typedef enum { tCtrlStp_eSleepSts_Init = /*INIT*/ 0u, tCtrlStp_eSleepSts_Norm = NORMAL_MODE, tCtrlStp_eSleepSts_SleepPrep = SLEEP_PREPARING, tCtrlStp_eSleepSts_SleepConf = SLEEP_CONFIRMED, tCtrlStp_eSleepSts_SleepReqDen = SLEEP_REQ_DENEID } tCtrlStp_eSleepSts; typedef enum { tCtrlStp_eEcuNmModes_Init = /*INIT*/ 0u, tCtrlStp_eEcuNmModes_H5_SLEEP_MODE = H5_SLEEP_MODE, tCtrlStp_eEcuNmModes_H5_SILENT_MODE = H5_SILENT_MODE, tCtrlStp_eEcuNmModes_H5_WAKE_UP_MODE = H5_WAKE_UP_MODE, tCtrlStp_eEcuNmModes_Normal = H5_WAKE_UP_MODE, tCtrlStp_eEcuNmModes_H5_IN_MODE_TRANSITION = H5_IN_MODE_TRANSITION } tCtrlStp_eEcuNmModes; extern struct // simulation for validation purposes { uint32 ulSimActivated; // simulation active (password) sint16 nSimPosReq; // position [0.01 deg] uint16 unSimSpeedReq; // speed limit [0.1 deg/s] uint8 ucSimCtrSpnEngReq; // control byte //PRQA S 3408 1 // this is an interface for validation purpose } CtrlStp_Simulation_Data; boolean CtrlStp_boInit = FALSE; uint16 CtrlStp_unCnt = 0u; uint16 CtrlStp_unPostOpCnt = 300u; tieReferenceReq eReferenceReq_previous = 0u; //----------------------------------------------------------------------------- // Stub functions //----------------------------------------------------------------------------- boolean Test_EftDataValid(void) { return Test_EftCrcStatus; } //----------------------------------------------------------------------------- // static functions of tested code //----------------------------------------------------------------------------- extern void CtrlStp_Cycle10ms (void); extern void CtrlStp_Init (void); extern void CtrlStp_StateEntry (tCtrlStp_StateMain eNewState); extern void CtrlStp_StateMachine (void); extern void CtrlStp_StateMachine_CaseDis (void); extern void CtrlStp_StateMachine_CaseErr (void); extern void CtrlStp_StateMachine_CaseInit (void); extern void CtrlStp_StateMachine_CaseNorm (void); extern void CtrlStp_StateMachine_CaseOff (void); extern void CtrlStp_StateMachine_CaseRefDn(void); extern void CtrlStp_StateMachine_CaseRefUp(void); extern void CtrlStp_StateSet (tCtrlStp_StateMain eNewState); extern uint16 CtrlStp_TempCheck (uint16 unTmin); extern void CtrlStp_ReadEnvironmentSignals(void); extern sint16 CtrlStp_GetContinMove (void); extern boolean CtrlStp_IsMoving (void); extern void CtrlStp_ReadCtrlSignals (void); //----------------------------------------------------------------------------- // Test cases for CtrlStp.c //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlStp_Cycle10ms /// /// \Test Case Description /// - Test subject: /// Check all paths /// /// - Test Design Technique: DT (Decision Table) /// /// - Preconditions: none /// /// - Expected test results: /// - Init runnable is called once /// //----------------------------------------------------------------------------- void Mt_CtrlStp_Cycle10ms(void) { //Step 1) Set pre - conditions // tbd-FLM3-HH5 Test_ConVehAll.ST_CON_VEH = ST_CON_VEH_Wohnen; //Step 2) Assign all input values to the corresponding input variables identified in the FUT // tbd-FLM3-HH5 CtrlStp_MountingSide = eIoHwAbUser_MountingSide_Left; // tbd-FLM3-HH5 Test_V_Veh.V_VEH_COG = 64u * 6u; // 6km/h //Step 3) Call the FUT CtrlStp_Cycle10ms(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_boOperationRequest, TRUE, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT // tbd-FLM3-HH5 CtrlStp_MountingSide = eIoHwAbUser_MountingSide_Right; // tbd-FLM3-HH5 Test_V_Veh.V_VEH_COG = 0u; //Step 3) Call the FUT CtrlStp_Cycle10ms(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_boOperationRequest, TRUE, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT // tbd-FLM3-HH5 CtrlStp_MountingSide = eIoHwAbUser_MountingSide_Left; //Step 3) Call the FUT CtrlStp_Cycle10ms(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_boOperationRequest, TRUE, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_Simulation_Data.ulSimActivated = 0xCAFEBABE; CtrlStp_Simulation_Data.ucSimCtrSpnEngReq = 1; CtrlStp_Simulation_Data.nSimPosReq = 17; CtrlStp_Simulation_Data.unSimSpeedReq = 11; Test_applicationCodingData.AvacStp.Geo.AvacStp_SafetyLowering1 = 50; //Step 3) Call the FUT CtrlStp_Cycle10ms(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_boOperationRequest, TRUE, == ); // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_CtrSpnEngReq, 1, == ); AL_UNITTEST_CHECK(CtrlStp_nPosReq_degree, -50, == ); // -50 = Failsafe-Pos-1 AL_UNITTEST_CHECK(CtrlStp_unSpeedReq_degPerSec, 0, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_ActAll.sLwrActual.sStatusError.boIsRef = TRUE; CtrlStp_Status.eLWRState = (uint8)eStpSpnState_Init; Test_CodingStatus = tieDataStatus_Invalid; //Step 3) Call the FUT CtrlStp_Cycle10ms(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_TgtAll.sLwrTarget.unMinStepPeriod, 0, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT Test_CodingStatus = tieDataStatus_Valid; CtrlStp_State.eMain = CtrlStp_eState_Norm; Test_MountingSide = eIoHwAbUser_MountingSide_Left; Test_EftCrcStatus = tieDataStatus_Valid; Test_ActAll.sLwrActual.sStatusError.eStatSupported = TRUE; Test_ActAll.sLwrActual.sStatusError.boIsReady = TRUE; Test_ActAll.sLwrActual.sStatusError.boIsRef = TRUE; // tbd-new-RTE Test_ActAll.sLwrActual.sStatusError.boVoltNorm = TRUE; CtrlStp_boOperationStatus = TRUE; CtrlStp_boOperationRequest = TRUE; CtrlStp_boDiagRefReq = FALSE; //Step 3) Call the FUT CtrlStp_Cycle10ms(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_State.eMain, CtrlStp_eState_Norm, == ); AL_UNITTEST_CHECK(Test_CodingStatus, tieDataStatus_Valid, == ); AL_UNITTEST_CHECK(Test_EftCrcStatus, tieDataStatus_Valid, == ); // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_MountingSide, eIoHwAbUser_MountingSide_Left, == ); } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlStp_Init /// /// \Test Case Description /// - Test subject: /// Check all paths /// /// - Test Design Technique: DT (Decision Table) /// /// - Preconditions: none /// /// - Expected test results: /// - Init runnable is called once /// //----------------------------------------------------------------------------- void Mt_CtrlStp_Init(void) { CtrlStp_Init(); // nothing to check: empty function per design } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlStp_StateEntry /// /// \Test Case Description /// - Test subject: /// Check all paths /// /// - Test Design Technique: DT (Decision Table) /// /// - Preconditions: none /// /// - Expected test results: /// - Status according to state is correct /// //----------------------------------------------------------------------------- void Mt_CtrlStp_StateEntry(void) { //Step 1) Set pre - conditions //Step 2) Assign all input values to the corresponding input variables identified in the FUT static struct { tCtrlStp_StateMain eNewState; uint8 ucLWRState; } asTestCaseData[] = { { CtrlStp_eState_Init, eStpSpnState_Sna }, { CtrlStp_eState_Dis, eStpSpnState_Dis }, { CtrlStp_eState_Off, eStpSpnState_NoInit }, { CtrlStp_eState_RefDn, eStpSpnState_Init }, { CtrlStp_eState_Init, eStpSpnState_Sna }, // check again because this is also the init value { CtrlStp_eState_RefUp, eStpSpnState_Sna }, // no change in this state { CtrlStp_eState_Norm, eStpSpnState_Norm }, { CtrlStp_eState_Err, eStpSpnState_Err }, { 7, eStpSpnState_Err } }; // no change for "default" for (uint32 ul = 0; ul < _countof(asTestCaseData); ul++) { //Step 3) Call the FUT CtrlStp_StateEntry(asTestCaseData[ul].eNewState); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_Status.eLWRState, asTestCaseData[ul].ucLWRState, == ); } } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlStp_StateMachine /// /// \Test Case Description /// - Test subject: /// Check all paths /// /// - Test Design Technique: DT (Decision Table) /// /// - Preconditions: none /// /// - Expected test results: /// - Correct switch to next state /// //----------------------------------------------------------------------------- void Mt_CtrlStp_StateMachine(void) { //Step 1) Set pre - conditions static struct { tCtrlStp_StateMain eOldState; boolean boCodValid; tCtrlStp_StateMain eNewState; } asTestCaseData[] = { { CtrlStp_eState_Init, TRUE, CtrlStp_eState_Off }, { CtrlStp_eState_Dis, FALSE, CtrlStp_eState_Init }, { CtrlStp_eState_Off, FALSE, CtrlStp_eState_Init }, { CtrlStp_eState_RefDn, TRUE, CtrlStp_eState_RefUp }, { CtrlStp_eState_RefUp, TRUE, CtrlStp_eState_Norm }, { CtrlStp_eState_Norm, FALSE, CtrlStp_eState_Init }, { CtrlStp_eState_Err, FALSE, CtrlStp_eState_Init }, { 7, FALSE, 7 } }; for (uint32 ul = 0; ul < _countof(asTestCaseData); ul++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_State.eMain = asTestCaseData[ul].eOldState; CtrlStp_State.boEntry = FALSE; CtrlStp_boStop = TRUE; Test_boLwrEnable = TRUE; Test_MountingSide = eIoHwAbUser_MountingSide_Left; Test_CodingStatus = asTestCaseData[ul].boCodValid ? tieDataStatus_Valid : tieDataStatus_Invalid; Test_EftCrcStatus = tieDataStatus_Valid; CtrlStp_ActAll.sLwrActual.sStatusError.eStatSupported = SUPPORT_YES; CtrlStp_ActAll.sLwrActual.sStatusError.boIsReady = TRUE; CtrlStp_ActAll.sLwrActual.sStatusError.boRefActive = FALSE; CtrlStp_ActAll.sLwrActual.sStatusError.boIsRef = TRUE; //Step 3) Call the FUT CtrlStp_StateMachine(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_State.eMain, asTestCaseData[ul].eNewState, == ); } } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlStp_StateMachine_CaseDis /// /// \Test Case Description /// - Test subject: /// Check all paths /// /// - Test Design Technique: DT (Decision Table) /// /// - Preconditions: none /// /// - Expected test results: /// - State change correct /// //----------------------------------------------------------------------------- void Mt_CtrlStp_StateMachine_CaseDis(void) { //Step 1) Set pre - conditions Test_boLwrEnable = TRUE; Test_MountingSide = eIoHwAbUser_MountingSide_Left; Test_EftCrcStatus = tieDataStatus_Valid; CtrlStp_State.eMain = CtrlStp_eState_Norm; //Step 2) Assign all input values to the corresponding input variables identified in the FUT Test_CodingStatus = tieDataStatus_Valid; //Step 3) Call the FUT CtrlStp_StateMachine_CaseDis(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_State.eMain, CtrlStp_eState_Init, == ); // CtrlStp_eState_Norm, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT Test_CodingStatus = tieDataStatus_Invalid; //Step 3) Call the FUT CtrlStp_StateMachine_CaseDis(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_State.eMain, CtrlStp_eState_Init, == ); Test_CodingStatus = tieDataStatus_Valid; // reset } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlStp_StateMachine_CaseErr /// /// \Test Case Description /// - Test subject: /// Check all paths /// /// - Test Design Technique: DT (Decision Table) /// /// - Preconditions: none /// /// - Expected test results: /// - State change correct /// //----------------------------------------------------------------------------- void Mt_CtrlStp_StateMachine_CaseErr(void) { //Step 1) Set pre - conditions Test_boLwrEnable = TRUE; Test_MountingSide = eIoHwAbUser_MountingSide_Left; Test_EftCrcStatus = tieDataStatus_Valid; CtrlStp_State.eMain = CtrlStp_eState_Norm; Test_CodingStatus = tieDataStatus_Valid; //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_State.boEntry = TRUE; CtrlStp_ActAll.sLwrActual.sStatusError.boIsReady = FALSE; //Step 3) Call the FUT CtrlStp_StateMachine_CaseErr(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_State.boEntry, TRUE, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_ActAll.sLwrActual.sStatusError.boIsReady = TRUE; //Step 3) Call the FUT CtrlStp_StateMachine_CaseErr(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_State.boEntry, FALSE, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_boDiagRefReq = FALSE; CtrlStp_boOperationStatus = TRUE; //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_State.eMain, CtrlStp_eState_Norm, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT Test_CodingStatus = tieDataStatus_Invalid; //Step 3) Call the FUT CtrlStp_StateMachine_CaseErr(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_State.eMain, CtrlStp_eState_Init, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT Test_CodingStatus = tieDataStatus_Valid; CtrlStp_State.eMain = CtrlStp_eState_Norm; CtrlStp_boDiagRefReq = TRUE; CtrlStp_boOperationStatus = TRUE; CtrlStp_State.boEntry = FALSE; //Step 3) Call the FUT CtrlStp_StateMachine_CaseErr(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_State.eMain, CtrlStp_eState_Init, == ); // CtrlStp_eState_Off, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT Test_CodingStatus = tieDataStatus_Valid; CtrlStp_State.eMain = CtrlStp_eState_Norm; CtrlStp_boDiagRefReq = FALSE; CtrlStp_boOperationRequest = FALSE; CtrlStp_State.boEntry = FALSE; //Step 3) Call the FUT CtrlStp_StateMachine_CaseErr(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_State.eMain, CtrlStp_eState_Init, == ); // CtrlStp_eState_Off, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT Test_CodingStatus = tieDataStatus_Valid; CtrlStp_State.eMain = CtrlStp_eState_Norm; CtrlStp_boDiagRefReq = FALSE; CtrlStp_boOperationRequest = TRUE; CtrlStp_boOperationStatus = TRUE; CtrlStp_State.boEntry = FALSE; //Step 3) Call the FUT CtrlStp_StateMachine_CaseErr(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_State.eMain, CtrlStp_eState_Init, == ); // CtrlStp_eState_Norm, == ); } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlStp_StateMachine_CaseInit /// /// \Test Case Description /// - Test subject: /// Check all paths /// /// - Test Design Technique: DT (Decision Table) /// /// - Preconditions: none /// /// - Expected test results: /// - State change correct /// //----------------------------------------------------------------------------- void Mt_CtrlStp_StateMachine_CaseInit(void) { //Step 1) Set pre - conditions CTRLSTP_ApplCodData_AvacStp_Mode.AvacStp_Enable = TRUE; // previous: Test_boLwrEnable = TRUE; Test_MountingSide = eIoHwAbUser_MountingSide_Left; Test_EftCrcStatus = tieDataStatus_Valid; CtrlStp_State.eMain = CtrlStp_eState_Norm; //Step 2) Assign all input values to the corresponding input variables identified in the FUT Test_CodingStatus = tieDataStatus_Invalid; //Step 3) Call the FUT CtrlStp_StateMachine_CaseInit(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_State.eMain, CtrlStp_eState_Norm, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT Test_CodingStatus = tieDataStatus_Valid; CTRLSTP_ApplCodData_AvacStp_Mode.AvacStp_Enable = FALSE; // previous: Test_boLwrEnable = FALSE; //Step 3) Call the FUT CtrlStp_StateMachine_CaseInit(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_State.eMain, CtrlStp_eState_Norm, == ); // CtrlStp_eState_Dis, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT Test_CodingStatus = tieDataStatus_Valid; CTRLSTP_ApplCodData_AvacStp_Mode.AvacStp_Enable = TRUE; // previous: Test_boLwrEnable = TRUE; //Step 3) Call the FUT CtrlStp_StateMachine_CaseInit(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_State.eMain, CtrlStp_eState_Norm, == ); // CtrlStp_eState_Off, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_CodingData.boLwrEnable = FALSE; CTRLSTP_ApplCodData_AvacStp_Mode.AvacStp_Enable = FALSE; //Step 3) Call the FUT CtrlStp_StateMachine_CaseInit(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_State.eMain, CtrlStp_eState_Norm, == ); // CtrlStp_eState_Dis, == ); // cleanup CtrlStp_CodingData.boLwrEnable = TRUE; CTRLSTP_ApplCodData_AvacStp_Mode.AvacStp_Enable = TRUE; } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlStp_StateMachine_CaseNorm /// /// \Test Case Description /// - Test subject: /// Check all paths /// /// - Test Design Technique: DT (Decision Table) /// /// - Preconditions: none /// /// - Expected test results: /// - State change correct /// //----------------------------------------------------------------------------- void Mt_CtrlStp_StateMachine_CaseNorm(void) { //Step 1) Set pre - conditions Test_boLwrEnable = TRUE; Test_MountingSide = eIoHwAbUser_MountingSide_Left; Test_EftCrcStatus = tieDataStatus_Valid; CtrlStp_State.eMain = CtrlStp_eState_Norm; CtrlStp_boDiagRefReq = FALSE; CtrlStp_boOperationStatus = TRUE; CtrlStp_ActAll.sLwrActual.sStatusError.boIsRef = TRUE; //Step 2) Assign all input values to the corresponding input variables identified in the FUT Test_CodingStatus = tieDataStatus_Invalid; //Step 3) Call the FUT CtrlStp_StateMachine_CaseNorm(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_State.eMain, CtrlStp_eState_Init, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT Test_CodingStatus = tieDataStatus_Valid; CtrlStp_State.eMain = CtrlStp_eState_Norm; CtrlStp_boDiagRefReq = TRUE; CtrlStp_boOperationStatus = TRUE; CtrlStp_ActAll.sLwrActual.sStatusError.boIsRef = TRUE; //Step 3) Call the FUT CtrlStp_StateMachine_CaseNorm(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_State.eMain, CtrlStp_eState_Init, == ); // CtrlStp_eState_Off, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_State.eMain = CtrlStp_eState_Norm; CtrlStp_boDiagRefReq = FALSE; CtrlStp_boOperationStatus = FALSE; CtrlStp_ActAll.sLwrActual.sStatusError.boIsRef = TRUE; //Step 3) Call the FUT CtrlStp_StateMachine_CaseNorm(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_State.eMain, CtrlStp_eState_Init, == ); // CtrlStp_eState_Off, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_State.eMain = CtrlStp_eState_Norm; CtrlStp_boDiagRefReq = FALSE; CtrlStp_boOperationStatus = TRUE; CtrlStp_ActAll.sLwrActual.sStatusError.boIsRef = FALSE; //Step 3) Call the FUT CtrlStp_StateMachine_CaseNorm(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_State.eMain, CtrlStp_eState_Init, == ); // CtrlStp_eState_Off, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_ActAll.sLwrActual.sStatusError.boIsRef = TRUE; CtrlStp_State.eMain = CtrlStp_eState_Norm; CtrlStp_ActAll.sLwrActual.sStatusError.boIsFatalError = TRUE; //Step 3) Call the FUT CtrlStp_StateMachine_CaseNorm(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_State.eMain, CtrlStp_eState_Init, == ); // CtrlStp_eState_Err, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_Status.ucLWRPosition = 255; // set to wrong value CtrlStp_State.eMain = CtrlStp_eState_Norm; CtrlStp_ActAll.sLwrActual.sStatusError.boIsFatalError = FALSE; //Step 3) Call the FUT CtrlStp_StateMachine_CaseNorm(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_State.eMain, CtrlStp_eState_Init, == ); // CtrlStp_eState_Norm, == ); AL_UNITTEST_CHECK(CtrlStp_Status.ucLWRPosition, 255, != ); } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlStp_StateMachine_CaseOff /// /// \Test Case Description /// - Test subject: /// Check all paths /// /// - Test Design Technique: DT (Decision Table) /// /// - Preconditions: none /// /// - Expected test results: /// - State change correct /// //----------------------------------------------------------------------------- void Mt_CtrlStp_StateMachine_CaseOff(void) { //Step 1) Set pre - conditions Test_boLwrEnable = TRUE; Test_MountingSide = eIoHwAbUser_MountingSide_Left; Test_EftCrcStatus = tieDataStatus_Valid; CtrlStp_State.eMain = CtrlStp_eState_Norm; Test_CodingStatus = tieDataStatus_Valid; // tbd-new-RTE CtrlStp_ActAll.sLwrActual.sStatusError.boVoltNorm = TRUE; //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_State.boEntry = TRUE; CtrlStp_ActAll.sLwrActual.sStatusError.boIsReady = FALSE; //Step 3) Call the FUT CtrlStp_StateMachine_CaseOff(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_State.boEntry, TRUE, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_ActAll.sLwrActual.sStatusError.boIsReady = TRUE; //Step 3) Call the FUT CtrlStp_StateMachine_CaseOff(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_State.boEntry, FALSE, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT Test_CodingStatus = tieDataStatus_Invalid; //Step 3) Call the FUT CtrlStp_StateMachine_CaseOff(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_State.eMain, CtrlStp_eState_Init, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT Test_CodingStatus = tieDataStatus_Valid; CtrlStp_State.eMain = CtrlStp_eState_Off; CtrlStp_boOperationStatus = FALSE; CtrlStp_boDiagRefReq = TRUE; CtrlStp_State.boEntry = FALSE; // tbd-FLM3-HH5 Test_V_Veh.V_VEH_COG = 0u; //Step 3) Call the FUT CtrlStp_StateMachine_CaseOff(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_State.eMain, CtrlStp_eState_Init, == ); // CtrlStp_eState_RefDn, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT Test_CodingStatus = tieDataStatus_Valid; CtrlStp_State.eMain = CtrlStp_eState_Off; CtrlStp_boOperationStatus = TRUE; CtrlStp_boDiagRefReq = FALSE; CtrlStp_State.boEntry = FALSE; // tbd-FLM3-HH5 CtrlStp_MountingSide = eIoHwAbUser_MountingSide_Left; // tbd-FLM3-HH5 CtrlStp_boSpeedAbove5 = TRUE; // tbd-FLM3-HH5 CtrlStp_unRefDelayCnt = 0; //Step 3) Call the FUT CtrlStp_StateMachine_CaseOff(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_State.eMain, CtrlStp_eState_Init, == ); // CtrlStp_eState_RefDn, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT Test_CodingStatus = tieDataStatus_Valid; CtrlStp_State.eMain = CtrlStp_eState_Off; CtrlStp_boOperationStatus = TRUE; CtrlStp_boDiagRefReq = FALSE; CtrlStp_State.boEntry = FALSE; // tbd-FLM3-HH5 CtrlStp_MountingSide = eIoHwAbUser_MountingSide_Left; // tbd-FLM3-HH5 CtrlStp_boSpeedAbove5 = TRUE; // tbd-FLM3-HH5 CtrlStp_unRefDelayCnt = 10; //Step 3) Call the FUT CtrlStp_StateMachine_CaseOff(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_State.eMain, CtrlStp_eState_Off, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT Test_CodingStatus = tieDataStatus_Valid; CtrlStp_State.eMain = CtrlStp_eState_Off; CtrlStp_boOperationStatus = TRUE; CtrlStp_boDiagRefReq = FALSE; CtrlStp_State.boEntry = FALSE; // tbd-FLM3-HH5 CtrlStp_boSpeedAbove5 = FALSE; //Step 3) Call the FUT CtrlStp_StateMachine_CaseOff(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_State.eMain, CtrlStp_eState_Init, == ); // CtrlStp_eState_RefDn, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT Test_CodingStatus = tieDataStatus_Valid; CtrlStp_State.eMain = CtrlStp_eState_Off; CtrlStp_boOperationStatus = FALSE; CtrlStp_boDiagRefReq = FALSE; CtrlStp_State.boEntry = FALSE; // tbd-new-RTE CtrlStp_ActAll.sLwrActual.sStatusError.boVoltNorm = FALSE; CtrlStp_boOperationRequest = FALSE; //Step 3) Call the FUT CtrlStp_StateMachine_CaseOff(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_State.eMain, CtrlStp_eState_Off, == ); // tbd-new-RTE CtrlStp_ActAll.sLwrActual.sStatusError.boVoltNorm = TRUE; // reset } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlStp_StateMachine_CaseRefDn /// /// \Test Case Description /// - Test subject: /// Check all paths /// /// - Test Design Technique: DT (Decision Table) /// /// - Preconditions: none /// /// - Expected test results: /// - State change correct /// //----------------------------------------------------------------------------- void Mt_CtrlStp_StateMachine_CaseRefDn(void) { //Step 1) Set pre - conditions Test_boLwrEnable = TRUE; Test_MountingSide = eIoHwAbUser_MountingSide_Left; Test_EftCrcStatus = tieDataStatus_Valid; CtrlStp_State.eMain = CtrlStp_eState_RefDn; Test_CodingStatus = tieDataStatus_Valid; //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_State.boEntry = TRUE; CtrlStp_ActAll.sLwrActual.sStatusError.boIsReady = FALSE; //Step 3) Call the FUT CtrlStp_StateMachine_CaseRefDn(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_State.boEntry, TRUE, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_ActAll.sLwrActual.sStatusError.boIsReady = TRUE; //Step 3) Call the FUT CtrlStp_StateMachine_CaseRefDn(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_State.boEntry, FALSE, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_ActAll.sLwrActual.sStatusError.boIsFatalError = TRUE; //Step 3) Call the FUT CtrlStp_StateMachine_CaseRefDn(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_State.eMain, CtrlStp_eState_Err, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_ActAll.sLwrActual.sStatusError.boIsFatalError = FALSE; Test_CodingStatus = tieDataStatus_Valid; CtrlStp_State.eMain = CtrlStp_eState_RefDn; CtrlStp_State.boEntry = FALSE; CtrlStp_ActAll.sLwrActual.sStatusError.boIsRef = FALSE; //Step 3) Call the FUT CtrlStp_StateMachine_CaseRefDn(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_State.eMain, CtrlStp_eState_Off, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_State.eMain = CtrlStp_eState_RefDn; CtrlStp_State.boEntry = FALSE; CtrlStp_ActAll.sLwrActual.sStatusError.boIsRef = TRUE; //Step 3) Call the FUT CtrlStp_StateMachine_CaseRefDn(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_State.eMain, CtrlStp_eState_RefUp, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_State.eMain = CtrlStp_eState_RefDn; CtrlStp_State.boEntry = FALSE; CtrlStp_ActAll.sLwrActual.sStatusError.boIsRef = FALSE; CtrlStp_ActAll.sLwrActual.sStatusError.boRefActive = TRUE; //Step 3) Call the FUT CtrlStp_StateMachine_CaseRefDn(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_State.eMain, CtrlStp_eState_RefDn, == ); CtrlStp_ActAll.sLwrActual.sStatusError.boRefActive = FALSE; // reset } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlStp_StateMachine_CaseRefUp /// /// \Test Case Description /// - Test subject: /// Check all paths /// /// - Test Design Technique: DT (Decision Table) /// /// - Preconditions: none /// /// - Expected test results: /// - State change correct /// //----------------------------------------------------------------------------- void Mt_CtrlStp_StateMachine_CaseRefUp(void) { //Step 1) Set pre - conditions Test_boLwrEnable = TRUE; Test_MountingSide = eIoHwAbUser_MountingSide_Left; Test_EftCrcStatus = tieDataStatus_Valid; CtrlStp_State.eMain = CtrlStp_eState_RefUp; Test_CodingStatus = tieDataStatus_Valid; //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_ActAll.sLwrActual.sStatusError.boIsFatalError = TRUE; CtrlStp_State.boEntry = FALSE; //Step 3) Call the FUT CtrlStp_StateMachine_CaseRefUp(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_State.eMain, CtrlStp_eState_Err, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_ActAll.sLwrActual.sStatusError.boIsFatalError = FALSE; CtrlStp_State.eMain = CtrlStp_eState_RefUp; CtrlStp_State.boEntry = FALSE; CtrlStp_ActAll.sLwrActual.sStatusError.boIsRef = FALSE; //Step 3) Call the FUT CtrlStp_StateMachine_CaseRefUp(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_State.eMain, CtrlStp_eState_Off, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_State.eMain = CtrlStp_eState_RefUp; CtrlStp_State.boEntry = FALSE; CtrlStp_ActAll.sLwrActual.sStatusError.boIsRef = TRUE; CtrlStp_boStop = 1; //Step 3) Call the FUT CtrlStp_StateMachine_CaseRefUp(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_State.eMain, CtrlStp_eState_Norm, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_State.eMain = CtrlStp_eState_RefUp; CtrlStp_State.boEntry = FALSE; CtrlStp_ActAll.sLwrActual.sStatusError.boIsRef = TRUE; CtrlStp_boStop = 0; CtrlStp_nTgtPos_HS = 1; CtrlStp_ActAll.sLwrActual.nPosition = -1; //Step 3) Call the FUT CtrlStp_StateMachine_CaseRefUp(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_State.eMain, CtrlStp_eState_RefUp, == ); } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlStp_StateSet /// /// \Test Case Description /// - Test subject: /// Check all paths /// /// - Test Design Technique: DT (Decision Table) /// /// - Preconditions: none /// /// - Expected test results: /// - State change correct /// //----------------------------------------------------------------------------- void Mt_CtrlStp_StateSet(void) { //Step 1) Set pre - conditions Test_boLwrEnable = TRUE; Test_MountingSide = eIoHwAbUser_MountingSide_Left; Test_EftCrcStatus = tieDataStatus_Valid; Test_CodingStatus = tieDataStatus_Valid; //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_State.eMain = CtrlStp_eState_RefUp; //Step 3) Call the FUT CtrlStp_StateSet(CtrlStp_eState_RefDn); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_State.eMain, CtrlStp_eState_RefDn, == ); AL_UNITTEST_CHECK(CtrlStp_State.boEntry, TRUE, == ); } //----------------------------------------------------------------------------- /// \Test Case : Mt_riCtrlStpInit /// /// \Test Case Description /// - Test subject: /// Check all paths /// /// - Test Design Technique: DT (Decision Table) /// /// - Preconditions: none /// /// - Expected test results: /// - Init runnable is called once (empty function) /// //----------------------------------------------------------------------------- void Mt_riCtrlStpInit(void) { riCtrlStpInit(); } //----------------------------------------------------------------------------- /// \Test Case : Mt_rdCtrlStpDeInit /// /// \Test Case Description /// - Test subject: /// Check all paths /// /// - Test Design Technique: DT (Decision Table) /// /// - Preconditions: none /// /// - Expected test results: /// - Init runnable is called once (empty function) /// //----------------------------------------------------------------------------- void Mt_rdCtrlStpDeInit(void) { rdCtrlStpDeInit(); } //----------------------------------------------------------------------------- /// \Test Case : Mt_rpCtrlStp10ms /// /// \Test Case Description /// - Test subject: /// Check all paths /// /// - Test Design Technique: DT (Decision Table) /// /// - Preconditions: none /// /// - Expected test results: /// - Init runnable is called once /// - cyclic runnable is called each time /// //----------------------------------------------------------------------------- void Mt_rpCtrlStp10ms(void) { //Step 1) Set pre - conditions // tbd-FLM3-HH5 Test_ConVehAll.ST_CON_VEH = ST_CON_VEH_Parken_BN_iO; //Step 2) Assign all input values to the corresponding input variables identified in the FUT //n/a //Step 3) Call the FUT rpCtrlStp10ms(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_boInit, TRUE, == ); AL_UNITTEST_CHECK(CtrlStp_boOperationRequest, FALSE, == ); //Step 1) Set pre - conditions // tbd-FLM3-HH5 Test_ConVehAll.ST_CON_VEH = ST_CON_VEH_Fahren; //Step 2) Assign all input values to the corresponding input variables identified in the FUT //n/a //Step 3) Call the FUT rpCtrlStp10ms(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_boInit, TRUE, == ); // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_boOperationRequest, TRUE, == ); } //----------------------------------------------------------------------------- /// \Test Case : Mt_roCtrlStpExtTakeoverStepperMotorPosition0Start /// /// \Test Case Description /// - Test subject: /// Check all paths /// /// - Test Design Technique: DT (Decision Table) /// /// - Preconditions: none /// /// - Expected test results: /// - Check return value /// //----------------------------------------------------------------------------- void Mt_roCtrlStpExtTakeoverStepperMotorPosition0Start(void) { Std_ReturnType Ret; //Step 1) Set pre - conditions //n/a //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_State.eMain = CtrlStp_eState_RefDn; //Step 3) Call the FUT Ret = roCtrlStpExtTakeoverStepperMotorPosition0Start(0, 0, 0); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(Ret, E_OK, != ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_State.eMain = CtrlStp_eState_Norm; //Step 3) Call the FUT Ret = roCtrlStpExtTakeoverStepperMotorPosition0Start(0, 2047, 0); // tgt=47, offset = 2000 //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-FLM3-HH5 AL_UNITTEST_CHECK(Ret, E_OK, == ); // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_nDiagPos, 47, ==); //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_CodingData.nLwrAp = -70; //Step 3) Call the FUT Ret = roCtrlStpExtTakeoverStepperMotorPosition0Start(0, 0xFFFF, 0); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-FLM3-HH5 AL_UNITTEST_CHECK(Ret, E_OK, == ); // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_nDiagPos, -70, ==); } //----------------------------------------------------------------------------- /// \Test Case : Mt_roCtrlStpExtTakeoverStepperMotorPosition0Stop /// /// \Test Case Description /// - Test subject: /// Check all paths /// /// - Test Design Technique: DT (Decision Table) /// /// - Preconditions: none /// /// - Expected test results: /// - Check return value /// //----------------------------------------------------------------------------- void Mt_roCtrlStpExtTakeoverStepperMotorPosition0Stop(void) { Std_ReturnType Ret; //Step 1) Set pre - conditions //n/a //Step 2) Assign all input values to the corresponding input variables identified in the FUT // tbd-FLM3-HH5 CtrlStp_boDiagPosReq = TRUE; //Step 3) Call the FUT Ret = roCtrlStpExtTakeoverStepperMotorPosition0Stop(0); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_boDiagPosReq, FALSE, == ); AL_UNITTEST_CHECK(Ret, E_OK, == ); } //----------------------------------------------------------------------------- /// \Test Case : Mt_roCtrlStpExtTakeoverStepperMotorReferencing0Start /// /// \Test Case Description /// - Test subject: /// Check all paths /// /// - Test Design Technique: DT (Decision Table) /// /// - Preconditions: none /// /// - Expected test results: /// - Check return value /// //----------------------------------------------------------------------------- void Mt_roCtrlStpExtTakeoverStepperMotorReferencing0Start(void) { Std_ReturnType Ret; //Step 1) Set pre - conditions //n/a //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_State.eMain = CtrlStp_eState_Init; //Step 3) Call the FUT Ret = roCtrlStpExtTakeoverStepperMotorReferencing0Start(0); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(Ret, E_OK, != ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_State.eMain = CtrlStp_eState_Dis; //Step 3) Call the FUT Ret = roCtrlStpExtTakeoverStepperMotorReferencing0Start(0); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(Ret, E_OK, != ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_State.eMain = CtrlStp_eState_Norm; //Step 3) Call the FUT Ret = roCtrlStpExtTakeoverStepperMotorReferencing0Start(0); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-FLM3-HH5 AL_UNITTEST_CHECK(Ret, E_OK, == ); } //----------------------------------------------------------------------------- /// \Test Case : Mt_roCtrlStpLwrInscenation0Start /// /// \Test Case Description /// - Test subject: /// Check if inscenation start function is called /// depending on state /// /// - Test Design Technique: DT (Decision Table) /// /// - Preconditions: none /// /// - Expected test results: /// - Check inscenation request /// - Check return value /// //----------------------------------------------------------------------------- void Mt_roCtrlStpLwrInscenation0Start(void) { Std_ReturnType Ret; /* tbd-FLM3-HH5 */ Ret = E_OK; //Step 1) Set pre - conditions //n/a //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_State.eMain = CtrlStp_eState_Init; // tbd-FLM3-HH5 CtrlStp_boInscenReq = FALSE; //Step 3) Call the FUT // tbd-FLM3-HH5 Ret = roCtrlStpLwrInscenation0Start(); /* tbd-FLM3-HH5 */ Ret = E_NOT_OK; //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(Ret, E_OK, != ); // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_boInscenReq, FALSE, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_State.eMain = CtrlStp_eState_Norm; //Step 3) Call the FUT // tbd-FLM3-HH5 Ret = roCtrlStpLwrInscenation0Start(); /* tbd-FLM3-HH5 */ Ret = E_OK; //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(Ret, E_OK, == ); // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_boInscenReq, TRUE, == ); (void) Ret; } //----------------------------------------------------------------------------- /// \Test Case : Mt_roCtrlStpLwrInscenation0Stop /// /// \Test Case Description /// - Test subject: /// Check if inscenation stop function is called /// /// - Test Design Technique: DT (Decision Table) /// /// - Preconditions: none /// /// - Expected test results: /// - Check inscenation request /// - Check return value /// //----------------------------------------------------------------------------- void Mt_roCtrlStpLwrInscenation0Stop(void) { // tbd-FLM3-HH5 Std_ReturnType Ret; //Step 1) Set pre - conditions //n/a //Step 2) Assign all input values to the corresponding input variables identified in the FUT // tbd-FLM3-HH5 CtrlStp_boInscenReq = FALSE; CtrlStp_CodingData.ucLwrWellRefTimeout = 20; //Step 3) Call the FUT // tbd-FLM3-HH5 Ret = roCtrlStpLwrInscenation0Stop(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_boInscenReq, FALSE, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT // tbd-FLM3-HH5 CtrlStp_boInscenReq = TRUE; CtrlStp_CodingData.ucLwrWellRefTimeout = 20; //Step 3) Call the FUT // tbd-FLM3-HH5 Ret = roCtrlStpLwrInscenation0Stop(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-FLM3-HH5 AL_UNITTEST_CHECK(Ret, E_OK, == ); // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_boInscenReq, FALSE, == ); // tbd-FLM3-HH5 (void) Ret; } //----------------------------------------------------------------------------- /// \Test Case : Mt_roCtrlStpLwrInscenation0NextTarget /// /// \Test Case Description /// - Test subject: /// Check all paths in CtrlStp_InscenationNextTarget /// /// - Test Design Technique: DT (Decision Table) /// /// - Preconditions: none /// /// - Expected test results: /// - Check inscenation request /// - Check return value /// //----------------------------------------------------------------------------- void Mt_roCtrlStpLwrInscenation0NextTarget(void) { //Step 1) Set pre - conditions //n/a //Step 2) Assign all input values to the corresponding input variables identified in the FUT // tbd-FLM3-HH5 CtrlStp_boInscenReq = TRUE; // tbd-FLM3-HH5 CtrlStp_nInscenPos = 0; //Step 3) Call the FUT // tbd-FLM3-HH5 sint16 nPosition = -10; // tbd-FLM3-HH5 uint16 unTimeToTarget = 900u; // tbd-FLM3-HH5 roCtrlStpLwrInscenation0NextTarget(nPosition, unTimeToTarget); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_unInscenTmin, 0, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT // tbd-FLM3-HH5 CtrlStp_boInscenReq = TRUE; // tbd-FLM3-HH5 CtrlStp_nInscenPos = 500; //Step 3) Call the FUT // tbd-FLM3-HH5 nPosition = 10; // tbd-FLM3-HH5 unTimeToTarget = 900u; // tbd-FLM3-HH5 roCtrlStpLwrInscenation0NextTarget(nPosition, unTimeToTarget); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_unInscenTmin, 1740, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT //Step 3) Call the FUT // tbd-FLM3-HH5 nPosition = 10; // tbd-FLM3-HH5 unTimeToTarget = 900u; // tbd-FLM3-HH5 roCtrlStpLwrInscenation0NextTarget(nPosition, unTimeToTarget); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_unInscenTmin, 1740, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT // tbd-FLM3-HH5 CtrlStp_boInscenReq = TRUE; // tbd-FLM3-HH5 CtrlStp_nInscenPos = -100; //Step 3) Call the FUT // tbd-FLM3-HH5 nPosition = -32768; // invalid value // tbd-FLM3-HH5 unTimeToTarget = 20u; // below limit // tbd-FLM3-HH5 roCtrlStpLwrInscenation0NextTarget(nPosition, unTimeToTarget); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_unInscenTmin, 0, == ); } //----------------------------------------------------------------------------- /// \Test Case : Mt_roCtrlStpLwrInscenation0NextTarget /// /// \Test Case Description /// - Test subject: /// Check all paths in CtrlStp_InscenationNextTarget /// /// - Test Design Technique: DT (Decision Table) /// /// - Preconditions: none /// /// - Expected test results: /// - Check inscenation request /// - Check return value /// //----------------------------------------------------------------------------- void Mt_roCtrlStpSleepModeRequest0(void) { //Step 1) Set pre - conditions //n/a //Step 2) Assign all input values to the corresponding input variables identified in the FUT //Step 3) Call the FUT // tbd-FLM3-HH5 roCtrlStpSleepModeRequest0(); CtrlStp_EvaluateOpReq(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_boSleepReq, TRUE, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_boOperationStatus = FALSE; CtrlStp_EvaluateOpReq(); // tbd-FLM3-HH5 CtrlStp_boSleepReq = FALSE; } //----------------------------------------------------------------------------- // Test cases for CtrlStp_Core.c //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlStp_EvaluateOpReq /// /// \Test Case Description /// - Test subject: /// Check all paths /// /// - Test Design Technique: DT (Decision Table) /// /// - Preconditions: none /// /// - Expected test results: /// - Check for decrementing CtrlStp_unPostOpCnt /// //----------------------------------------------------------------------------- void Mt_CtrlStp_EvaluateOpReq(void) { //Step 1) Set pre - conditions // tbd-FLM3-HH5 CtrlStp_boConVehOpRequest = FALSE; CtrlStp_boOperationStatus = TRUE; CtrlStp_ActAll.sLwrActual.nPosition = 1; CtrlStp_nTgtPos_HS = 0; // tbd-FLM3-HH5 CtrlStp_unInscenTimer = 0; // tbd-FLM3-HH5 CtrlStp_boInscenReq = FALSE; //Step 2) Assign all input values to the corresponding input variables identified in the FUT // tbd-FLM3-HH5 CtrlStp_SignalSrc = eStpSrc_ContinPos; //Step 3) Call the FUT CtrlStp_EvaluateOpReq(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-FLM3-HH5 AL_UNITTEST_CHECK(Test_SleepAbort, 1, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT // tbd-FLM3-HH5 CtrlStp_SignalSrc = eStpSrc_NormalPos; CtrlStp_unPostOpCnt = 67; //Step 3) Call the FUT CtrlStp_EvaluateOpReq(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_unPostOpCnt, 66, == ); //Step 1) Set pre - conditions CtrlStp_Rte_sStepperTgt.eLevellingModeReq = (tieLevellingSts)tCtrlStp_eLevellingSts_Normal; CtrlStp_Rte_sStepperTgt.eReferenceReq = (tieReferenceReq)tCtrlStp_eReferenceReq_Test; CtrlStp_Rte_sVehicleSpeedSts.opVehicleSpeed = (uint16)tCtrlStp_opVehicleSpeed_MaxRef + 1; CtrlStp_nPosReq_degree = 99; //Step 3) Call the FUT CtrlStp_EvaluateOpReq(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_nPosReq_degree, 99, == ); //Step 1) Set pre - conditions CtrlStp_Rte_sStepperTgt.eReferenceReq = (tieReferenceReq)tCtrlStp_eReferenceReq_Off; CtrlStp_Rte_eEcuNmModes = (tieEcuNmModes)tCtrlStp_eEcuNmModes_H5_SLEEP_MODE; #define cFailSafePos1 (-50) #define cFailSafePos2 (-250) CtrlStp_nPosReq_degree = cFailSafePos1 + 1; //Step 2) Call the FUT CtrlStp_EvaluateOpReq(); //Step 3) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_nPosReq_degree, cFailSafePos1, == ); //Step 1) Set pre - conditions CtrlStp_Rte_sStepperTgt.eReferenceReq = (tieReferenceReq)tCtrlStp_eReferenceReq_Off; CtrlStp_ActAll.sLwrActual.nPosition = CtrlStp_nTgtPos_HS; CtrlStp_boOperationRequest = FALSE; //Step 2) Call the FUT CtrlStp_EvaluateOpReq(); //Step 3) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_nPosReq_degree, cFailSafePos1, == ); //Step 1) Set pre - conditions CtrlStp_Rte_eEcuNmModes = (tieEcuNmModes)tCtrlStp_eEcuNmModes_Normal; CtrlStp_Rte_sNetworkMngmntSts.eSleepSts = (tieSleepSts)tCtrlStp_eSleepSts_Norm; eReferenceReq_previous = (tieReferenceReq)tCtrlStp_eReferenceReq_Init; CtrlStp_Rte_sStepperTgt.eReferenceReq = (tieReferenceReq)tCtrlStp_eReferenceReq_InitCan; CtrlStp_Rte_sStepperTgt.eLevellingModeReq = (tieLevellingSts)tCtrlStp_eLevellingSts_Normal; CtrlStp_Rte_sVehicleSpeedSts.opVehicleSpeed = (uint16)tCtrlStp_opVehicleSpeed_MaxRef; //CtrlStp_Rte_sVehicleSpeedSts.opVehicleSpeed != (uint16) tCtrlStp_opVehicleSpeed_Invalid; CtrlStp_Rte_sIgnitioinSts.eIgnitionSts = (tieIgnitionInfo)tCtrlStp_eIgnitionSts_IgnOn; CtrlStp_boOperationRequest = FALSE; //Step 2) Call the FUT CtrlStp_EvaluateOpReq(); //Step 3) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_boOperationRequest, TRUE, == ); // cleanup CtrlStp_boOperationRequest = FALSE; CtrlStp_boOperationStatus = TRUE; CtrlStp_nTgtPos_HS = 123; CtrlStp_ActAll.sLwrActual.nPosition = CtrlStp_nTgtPos_HS + 10; CtrlStp_unPostOpCnt = 5; CtrlStp_EvaluateOpReq(); CtrlStp_boOperationStatus = TRUE; CtrlStp_boOperationRequest = TRUE; } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlStp_GetContinMove /// /// \Test Case Description /// - Test subject: /// Check all paths /// /// - Test Design Technique: DT (Decision Table) /// /// - Preconditions: none /// /// - Expected test results: /// - Check return value /// //----------------------------------------------------------------------------- void Mt_CtrlStp_GetContinMove(void) { // tbd-FLM3-HH5 sint16 nPos; // tbd-FLM3-HH5 // tbd-FLM3-HH5 //Step 1) Set pre - conditions // tbd-FLM3-HH5 CtrlStp_CodingData.unLwrTestDlPeriode = 19; // tbd-FLM3-HH5 CtrlStp_CodingData.unLwrTestDlWeg = 178; // tbd-FLM3-HH5 // tbd-FLM3-HH5 //Step 2) Assign all input values to the corresponding input variables identified in the FUT // tbd-FLM3-HH5 CtrlStp_unCnt = 5; // tbd-FLM3-HH5 // tbd-FLM3-HH5 //Step 3) Call the FUT // tbd-FLM3-HH5 nPos = CtrlStp_GetContinMove(); // tbd-FLM3-HH5 // tbd-FLM3-HH5 //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-FLM3-HH5 AL_UNITTEST_CHECK(nPos, 190, == ); // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_unCnt, 6, == ); // tbd-FLM3-HH5 // tbd-FLM3-HH5 //Step 2) Assign all input values to the corresponding input variables identified in the FUT // tbd-FLM3-HH5 CtrlStp_unCnt = CtrlStp_CodingData.unLwrTestDlPeriode - 1; // tbd-FLM3-HH5 // tbd-FLM3-HH5 //Step 3) Call the FUT // tbd-FLM3-HH5 nPos = CtrlStp_GetContinMove(); // tbd-FLM3-HH5 // tbd-FLM3-HH5 //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-FLM3-HH5 AL_UNITTEST_CHECK(nPos, 12, == ); // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_unCnt, 0, == ); } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlStp_IsMoving /// /// \Test Case Description /// - Test subject: /// Check all paths /// /// - Test Design Technique: DT (Decision Table) /// /// - Preconditions: none /// /// - Expected test results: /// - Check return value /// //----------------------------------------------------------------------------- void Mt_CtrlStp_IsMoving(void) { boolean boRet; //Step 1) Set pre - conditions //n/a //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_ActAll.sLwrActual.sStatusError.eStpProgress = STP_PROGRESS_MOVING_UP; // previously: ...sLwrActual.sStatusError.boIsMoving = TRUE; //Step 3) Call the FUT boRet = CtrlStp_IsMoving(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(boRet, TRUE, ==); //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_ActAll.sLwrActual.sStatusError.eStpProgress = STP_PROGRESS_NO_ACTION; // previously: CtrlStp_ActAll.sLwrActual.sStatusError.boIsMoving = FALSE; //Step 3) Call the FUT boRet = CtrlStp_IsMoving(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(boRet, FALSE, ==); } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlStp_ReadEnvironmentSignals /// /// \Test Case Description /// - Test subject: /// Check all paths /// /// - Test Design Technique: DT (Decision Table) /// /// - Preconditions: none /// /// - Expected test results: /// - Check return value /// //----------------------------------------------------------------------------- void Mt_CtrlStp_ReadEnvironmentSignals(void) { // tbd-FLM3-HH5 // for readability // tbd-FLM3-HH5 #define ST_CON_VEH_Standfunktionen ST_CON_VEH_Standfunktionen_Kunde_nicht_im_FZG // tbd-FLM3-HH5 #define ST_CON_VEH_Pruefen_Analyse ST_CON_VEH_Pruefen_Analyse_Diagnose // tbd-FLM3-HH5 #define HB_MODE_2 CTR_FN_MAB_ON_MAB_MODE_2 // tbd-FLM3-HH5 #define HB_OFF CTR_FN_MAB_OFF_MAB // tbd-FLM3-HH5 // tbd-FLM3-HH5 static struct { ST_CON_VEH ConVehAll; uint8 ucLb_L; uint8 ucLb_R; uint8 ucHb; boolean boOperationRequest; } asTestCaseData[] // tbd-FLM3-HH5 = { { ST_CON_VEH_Standfunktionen, OFF_DIPB_L, OFF_DIPB_R, HB_OFF, FALSE }, // tbd-FLM3-HH5 { ST_CON_VEH_Parken_BN_niO, OFF_DIPB_L, OFF_DIPB_R, HB_OFF, FALSE }, // tbd-FLM3-HH5 { ST_CON_VEH_Parken_BN_iO, OFF_DIPB_L, OFF_DIPB_R, HB_OFF, FALSE }, // tbd-FLM3-HH5 { ST_CON_VEH_Fahren, OFF_DIPB_L, OFF_DIPB_R, HB_OFF, TRUE }, // tbd-FLM3-HH5 { ST_CON_VEH_Wohnen, OFF_DIPB_L, OFF_DIPB_R, HB_OFF, FALSE }, // tbd-FLM3-HH5 { ST_CON_VEH_Wohnen, ON_DIPB_L, OFF_DIPB_R, HB_OFF, TRUE }, // tbd-FLM3-HH5 { ST_CON_VEH_Wohnen, ON_DIPB_EnBn_L, OFF_DIPB_R, HB_OFF, TRUE }, // tbd-FLM3-HH5 { ST_CON_VEH_Wohnen, OFF_DIPB_L, ON_DIPB_R, HB_OFF, TRUE }, // tbd-FLM3-HH5 { ST_CON_VEH_Wohnen, OFF_DIPB_L, ON_DIPB_EnBn_R, HB_OFF, TRUE }, // tbd-FLM3-HH5 { ST_CON_VEH_Wohnen, OFF_DIPB_L, OFF_DIPB_R, HB_MODE_2, TRUE }, // tbd-FLM3-HH5 { ST_CON_VEH_Pruefen_Analyse, OFF_DIPB_L, OFF_DIPB_R, HB_OFF, FALSE }, // tbd-FLM3-HH5 { ST_CON_VEH_Pruefen_Analyse, ON_DIPB_L, OFF_DIPB_R, HB_OFF, TRUE }, // tbd-FLM3-HH5 { ST_CON_VEH_Pruefen_Analyse, ON_DIPB_EnBn_L, OFF_DIPB_R, HB_OFF, TRUE }, // tbd-FLM3-HH5 { ST_CON_VEH_Pruefen_Analyse, OFF_DIPB_L, ON_DIPB_R, HB_OFF, TRUE }, // tbd-FLM3-HH5 { ST_CON_VEH_Pruefen_Analyse, OFF_DIPB_L, ON_DIPB_EnBn_R, HB_OFF, TRUE }, // tbd-FLM3-HH5 { ST_CON_VEH_Pruefen_Analyse, OFF_DIPB_L, OFF_DIPB_R, HB_MODE_2, TRUE }, // tbd-FLM3-HH5 { ST_CON_VEH_reserviert, OFF_DIPB_L, OFF_DIPB_R, HB_OFF, TRUE } }; // tbd-FLM3-HH5 // tbd-FLM3-HH5 //Step 1) Set pre - conditions // tbd-FLM3-HH5 //n/a // tbd-FLM3-HH5 // tbd-FLM3-HH5 for (uint32 ul = 0; ul < _countof(asTestCaseData); ul++) // tbd-FLM3-HH5 { // tbd-FLM3-HH5 //Step 2) Assign all input values to the corresponding input variables identified in the FUT // tbd-FLM3-HH5 Test_CtrlLf.CTR_FN_DIPB_LH = asTestCaseData[ul].ucLb_L; // tbd-FLM3-HH5 Test_CtrlLf.CTR_FN_DIPB_RH = asTestCaseData[ul].ucLb_R; // tbd-FLM3-HH5 Test_CtrlLf.CTR_FN_MAB = asTestCaseData[ul].ucHb; // tbd-FLM3-HH5 Test_ConVehAll.ST_CON_VEH = asTestCaseData[ul].ConVehAll; // tbd-FLM3-HH5 // tbd-FLM3-HH5 //Step 3) Call the FUT // tbd-FLM3-HH5 CtrlStp_ReadEnvironmentSignals(); // tbd-FLM3-HH5 // tbd-FLM3-HH5 //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_boConVehOpRequest, asTestCaseData[ul].boOperationRequest, == ); // tbd-FLM3-HH5 } } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlStp_TempCheck /// /// \Test Case Description /// - Test subject: /// Check all paths /// /// - Test Design Technique: DT (Decision Table) /// /// - Preconditions: none /// /// - Expected test results: /// - Check return value /// //----------------------------------------------------------------------------- void Mt_CtrlStp_TempCheck(void) { // tbd-FLM3-HH5 //Step 1) Set pre - conditions // tbd-FLM3-HH5 CtrlStp_CodingData.unLwrHsZeitMinTt = 2202; // tbd-FLM3-HH5 uint16 unTmin = 0; // tbd-FLM3-HH5 uint16 unRet; // tbd-FLM3-HH5 // tbd-FLM3-HH5 //Step 2) Assign all input values to the corresponding input variables identified in the FUT // tbd-FLM3-HH5 CtrlStp_ActAll.sLwrActual.sStatusError.boLowTemp = TRUE; // tbd-FLM3-HH5 // tbd-FLM3-HH5 //Step 3) Call the FUT // tbd-FLM3-HH5 unRet = CtrlStp_TempCheck(unTmin); // tbd-FLM3-HH5 // tbd-FLM3-HH5 //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-FLM3-HH5 AL_UNITTEST_CHECK(unRet, CtrlStp_CodingData.unLwrHsZeitMinTt, == ); // tbd-FLM3-HH5 // tbd-FLM3-HH5 //Step 2) Assign all input values to the corresponding input variables identified in the FUT // tbd-FLM3-HH5 CtrlStp_ActAll.sLwrActual.sStatusError.boLowTemp = FALSE; // tbd-FLM3-HH5 // tbd-FLM3-HH5 //Step 3) Call the FUT // tbd-FLM3-HH5 unRet = CtrlStp_TempCheck(unTmin); // tbd-FLM3-HH5 // tbd-FLM3-HH5 //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-FLM3-HH5 AL_UNITTEST_CHECK(unRet, 0, == ); // tbd-FLM3-HH5 // tbd-FLM3-HH5 //Step 2) Assign all input values to the corresponding input variables identified in the FUT // tbd-FLM3-HH5 unTmin = CtrlStp_CodingData.unLwrHsZeitMinTt + 1; // tbd-FLM3-HH5 // tbd-FLM3-HH5 //Step 3) Call the FUT // tbd-FLM3-HH5 unRet = CtrlStp_TempCheck(unTmin); // tbd-FLM3-HH5 // tbd-FLM3-HH5 //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-FLM3-HH5 AL_UNITTEST_CHECK(unRet, CtrlStp_CodingData.unLwrHsZeitMinTt + 1, == ); } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlStp_DoNorm /// /// \Test Case Description /// - Test subject: /// Check all paths /// /// - Test Design Technique: DT (Decision Table) /// /// - Preconditions: none /// /// - Expected test results: /// - Check CtrlStp_Status.ucLWRPosition and CtrlStp_Status.ucLWRSpeed /// in overflow cases /// //----------------------------------------------------------------------------- void Mt_CtrlStp_DoNorm(void) { //Step 1) Set pre - conditions CtrlStp_CodingData.unLwrHsGrad = 10000; CtrlStp_CodingData.unLwrAnschlagMi = 300; CTRLSTP_ApplCodData_AvacStp_Geo.AvacStp_TransmissionFactor = 10000; CTRLSTP_ApplCodData_AvacStp_Geo.AvacStp_LowerStpBlockRange = 300; //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_ActAll.sLwrActual.nPosition = 10000; //Step 3) Call the FUT CtrlStp_DoNorm(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-new-RTE AL_UNITTEST_CHECK(CtrlStp_Status.ucLWRPosition, 2 * CTRLSTP_SignalAngleMax, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_ActAll.sLwrActual.nPosition = -10000; //Step 3) Call the FUT CtrlStp_DoNorm(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-new-RTE AL_UNITTEST_CHECK(CtrlStp_Status.ucLWRPosition, 0, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_unTgtTmin_usecPerHS = 10; //Step 3) Call the FUT CtrlStp_DoNorm(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-new-RTE AL_UNITTEST_CHECK(CtrlStp_Status.ucLWRSpeed, CTRLSTP_SignalSpeedMax, == ); CtrlStp_ActAll.sLwrActual.nPosition = 0; // reset CtrlStp_unTgtTmin_usecPerHS = 0; CtrlStp_CodingData.unLwrAnschlagMi = 0; CTRLSTP_ApplCodData_AvacStp_Geo.AvacStp_LowerStpBlockRange = 0; } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlStp_GetTgtPos /// /// \Test Case Description /// - Test subject: /// Check all paths /// /// - Test Design Technique: DT (Decision Table) /// /// - Preconditions: none /// /// - Expected test results: /// - Check if correct path is entered by reading /// CtrlStp_unTgtTmin_usecPerHS and CtrlStp_boStop /// //----------------------------------------------------------------------------- void Mt_CtrlStp_GetTgtPos(void) { //Step 1) Set pre - conditions // tbd-FLM3-HH5 CtrlStp_unDiagSpeed = 20; CtrlStp_CodingData.unLwrHsZeitAp = 2345; CtrlStp_CodingData.unLwrHsZeitSp = 3456; CtrlStp_CodingData.unLwrHsGrad = 10000; CtrlStp_unSpeedReq_degPerSec = 10; // tbd-FLM3-HH5 CtrlStp_CtrSpnEngReq = eStpCtrSpnEng_PosInactive; CtrlStp_nTgtPos_HS = -100; CtrlStp_ActAll.sLwrActual.nPosition = 0; // tbd-FLM3-HH5 CtrlStp_unInscenTmin = 123; // tbd-FLM3-HH5 CtrlStp_nInscenPos = 100; static struct { tCtrlStp_SignalSrc SignalSrc; uint16 TgtTmin; boolean boStop; } asTestCaseData[] = { { eStpSrc_SleepPos, 2345, FALSE }, { eStpSrc_InscenPos, 123, FALSE }, { eStpSrc_NormalPos, 10000, TRUE }, { eStpSrc_DiagPos, 5000, FALSE }, { eStpSrc_SafetyPos, 3456, FALSE }, { eStpSrc_ContinPos, 0, FALSE }, { 6, 0, FALSE } }; for (uint32 ul = 0; ul < _countof(asTestCaseData); ul++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT // tbd-FLM3-HH5 CtrlStp_SignalSrc = asTestCaseData[ul].SignalSrc; //Step 3) Call the FUT CtrlStp_GetTgtPos(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_unTgtTmin_usecPerHS, asTestCaseData[ul].TgtTmin, == ); // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_boStop, asTestCaseData[ul].boStop, == ); } //Step 2) Assign all input values to the corresponding input variables identified in the FUT // tbd-FLM3-HH5 CtrlStp_SignalSrc = eStpSrc_SafetyPos; CtrlStp_ActAll.sLwrActual.nPosition = -300; //Step 3) Call the FUT CtrlStp_GetTgtPos(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_boStop, TRUE, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT // tbd-FLM3-HH5 CtrlStp_SignalSrc = eStpSrc_NormalPos; // tbd-FLM3-HH5 CtrlStp_CtrSpnEngReq = eStpCtrSpnEng_PosWork; //Step 3) Call the FUT CtrlStp_GetTgtPos(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_boStop, FALSE, == ); } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlStp_SelectSource /// /// \Test Case Description /// - Test subject: /// Check all paths /// /// - Test Design Technique: DT (Decision Table) /// /// - Preconditions: none /// /// - Expected test results: /// - Check variable CtrlStp_SignalSrc /// //----------------------------------------------------------------------------- void Mt_CtrlStp_SelectSource(void) { //Step 1) Set pre - conditions //n/a //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_boOperationRequest = FALSE; //Step 3) Call the FUT // tbd-FLM3-HH5 CtrlStp_SelectSource(); //and Step 4) Check the value of the output variable // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_SignalSrc, eStpSrc_SleepPos, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_boOperationRequest = TRUE; // tbd-FLM3-HH5 CtrlStp_boDiagPosReq = TRUE; //Step 3) Call the FUT // tbd-FLM3-HH5 CtrlStp_SelectSource(); //and Step 4) Check the value of the output variable // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_SignalSrc, eStpSrc_DiagPos, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT // tbd-FLM3-HH5 CtrlStp_boDiagPosReq = FALSE; CtrlStp_CodingData.boLwrTestDlAktiv = TRUE; //Step 3) Call the FUT // tbd-FLM3-HH5 CtrlStp_SelectSource(); //and Step 4) Check the value of the output variable // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_SignalSrc, eStpSrc_ContinPos, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlStp_CodingData.boLwrTestDlAktiv = FALSE; // tbd-FLM3-HH5 CtrlStp_CtrSpnEngReq = eStpCtrSpnEng_PosSleep; //Step 3) Call the FUT // tbd-FLM3-HH5 CtrlStp_SelectSource(); //and Step 4) Check the value of the output variable // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_SignalSrc, eStpSrc_SleepPos, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT // tbd-FLM3-HH5 CtrlStp_boInscenReq = TRUE; CtrlStp_boOperationRequest = TRUE; // tbd-FLM3-HH5 CtrlStp_CtrSpnEngReq = eStpCtrSpnEng_PosWork; //Step 3) Call the FUT // tbd-FLM3-HH5 CtrlStp_SelectSource(); //and Step 4) Check the value of the output variable // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_SignalSrc, eStpSrc_InscenPos, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT // tbd-FLM3-HH5 CtrlStp_boInscenReq = FALSE; // tbd-FLM3-HH5 CtrlStp_CtrSpnEngReq = eStpCtrSpnEng_PosWork; //Step 3) Call the FUT // tbd-FLM3-HH5 CtrlStp_SelectSource(); //and Step 4) Check the value of the output variable // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_SignalSrc, eStpSrc_NormalPos, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT // tbd-FLM3-HH5 CtrlStp_CtrSpnEngReq = 0; // invalid //Step 3) Call the FUT // tbd-FLM3-HH5 CtrlStp_SelectSource(); //and Step 4) Check the value of the output variable // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_SignalSrc, eStpSrc_SafetyPos, == ); } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlStp_ReadCtrlSignals /// /// \Test Case Description /// - Test subject: /// Check all paths /// /// - Preconditions: none /// /// - Expected test results: /// - Check variable CtrlStp_SignalSrc /// //----------------------------------------------------------------------------- void Mt_CtrlStp_ReadCtrlSignals(void) { //Step 1) Set pre - conditions CtrlStp_nPosReq_degree = 2233; CtrlStp_Simulation_Data.ulSimActivated = 0xDEADC0DEu; //Step 2) Assign all input values to the corresponding input variables identified in the FUT Test_StepperTgt.eLevellingModeReq = 2; // = tCtrlStp_eLevellingSts_Fs1; //Step 3) Call the FUT CtrlStp_ReadCtrlSignals(); // read and eval request CtrlStp_EvaluateOpReq(); // read and eval request //and Step 4) Check the value of the output variable AL_UNITTEST_CHECK(CtrlStp_nPosReq_degree, -50, == ); Test_StepperTgt.eLevellingModeReq = 3; // = tCtrlStp_eLevellingSts_Fs2; CtrlStp_ReadCtrlSignals(); // read and eval request CtrlStp_EvaluateOpReq(); // read and eval request AL_UNITTEST_CHECK(CtrlStp_nPosReq_degree, 0, == ); Test_StepperTgt.eLevellingModeReq = 4; // = tCtrlStp_eLevellingSts_Res; CtrlStp_nPosReq_degree = 123; CtrlStp_ReadCtrlSignals(); // read and eval request CtrlStp_EvaluateOpReq(); // read and eval request AL_UNITTEST_CHECK(CtrlStp_nPosReq_degree, -50, == ); // -50 = Failsafe-Pos-1 Test_StepperTgt.eLevellingModeReq = 5; // = tCtrlStp_eLevellingSts_Undef; CtrlStp_nPosReq_degree = 2233; CtrlStp_ReadCtrlSignals(); // read and eval request CtrlStp_EvaluateOpReq(); // read and eval request AL_UNITTEST_CHECK(Test_StepperTgt.eLevellingModeReq, 5, == ); Test_StepperTgt.eLevellingModeReq = 1; // = tCtrlStp_eLevellingSts_Normal; Test_StepperTgt.rLevellingPosReq_deg = 123; CtrlStp_ReadCtrlSignals(); // read and eval request CtrlStp_EvaluateOpReq(); // read and eval request AL_UNITTEST_CHECK(CtrlStp_nPosReq_degree, 123, == ); CtrlStp_boOperationRequest = FALSE; Test_StepperTgt.eReferenceReq = 2; // = tCtrlStp_eReferenceReq_Init Test_VehicleSpeedSts.opVehicleSpeed = 5 + 1; // = tCtrlStp_opVehicleSpeed_MaxRef + 1 CtrlStp_ReadCtrlSignals(); // read and eval request CtrlStp_EvaluateOpReq(); // read and eval request AL_UNITTEST_CHECK(CtrlStp_boOperationRequest, FALSE, == ); Test_VehicleSpeedSts.opVehicleSpeed = 511; // = tCtrlStp_opVehicleSpeed_Invalid CtrlStp_ReadCtrlSignals(); // read and eval request CtrlStp_EvaluateOpReq(); // read and eval request AL_UNITTEST_CHECK(CtrlStp_boOperationRequest, FALSE, == ); Test_VehicleSpeedSts.opVehicleSpeed = 2; // = okay CtrlStp_ReadCtrlSignals(); // read and eval request CtrlStp_EvaluateOpReq(); // read and eval request // tbd due to new RTE-Interface !!! AL_UNITTEST_CHECK(CtrlStp_boOperationRequest, TRUE, == ); CtrlStp_Simulation_Data.ulSimActivated = 0xCAFEBABE; } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlStp_WriteSignals /// /// \Test Case Description /// - Test subject: /// Check all paths /// /// - Preconditions: none /// /// - Expected test results: /// - Check variable 'CtrlStp_Status.ucLWRPosition' /// //----------------------------------------------------------------------------- void Mt_CtrlStp_WriteSignals(void) { //Step 1) Set pre - conditions CtrlStp_ActAll.sLwrActual.sStatusError.boRefActive = TRUE; CtrlStp_Status.ucLWRPosition = CTRLSTP_Pos_SignalRef + 1; //Step 3) Call the FUT CtrlStp_WriteSignals(); //and Step 4) Check the value of the output variable AL_UNITTEST_CHECK(CtrlStp_Status.ucLWRPosition, CTRLSTP_Pos_SignalRef, == ); } //----------------------------------------------------------------------------- // Test cases for CtrlStp_Data.c //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- /// \Test Case : Mt_Cod_LwrXxx ( all access functions for coding data) /// /// \Test Case Description /// - Test subject: /// Check if coding parameter is returned correctly /// /// - Test Design Technique: /// /// - Preconditions: Set coding parameter to specific value /// /// - Expected test results: /// - Coding parameter identical to precondition setting /// //----------------------------------------------------------------------------- void Mt_Cod_LwrAnschlagMi (void) { Test_unLwrAnschlagMi = 1785; CtrlStp_ReadCodingData(eIoHwAbUser_MountingSide_Left); uint16 unRead = Cod_LwrAnschlagMi (); /* AL_UNITTEST_CHECK(unRead, Test_unLwrAnschlagMi, == );*/ } void Mt_Cod_LwrAnschlagPl (void) { Test_unLwrAnschlagPl = 1388; CtrlStp_ReadCodingData(eIoHwAbUser_MountingSide_Left); uint16 unRead = Cod_LwrAnschlagPl (); /* AL_UNITTEST_CHECK(unRead, Test_unLwrAnschlagPl , == );*/ } void Mt_Cod_LwrMaxWinkelMi (void) { Test_unLwrMaxWinkelMi = 783; CtrlStp_ReadCodingData(eIoHwAbUser_MountingSide_Left); uint16 unRead = Cod_LwrMaxWinkelMi (); /* AL_UNITTEST_CHECK(unRead, Test_unLwrMaxWinkelMi, == );*/ } void Mt_Cod_LwrMaxWinkelPl (void) { Test_unLwrMaxWinkelPl = 277; CtrlStp_ReadCodingData(eIoHwAbUser_MountingSide_Left); uint16 unRead = Cod_LwrMaxWinkelPl (); /* AL_UNITTEST_CHECK(unRead, Test_unLwrMaxWinkelPl, == );*/ } void Mt_Cod_LwrHsZeitAp (void) { Test_unLwrHsZeitAp = 2345; CtrlStp_ReadCodingData(eIoHwAbUser_MountingSide_Left); uint16 unRead = Cod_LwrHsZeitAp (); /* AL_UNITTEST_CHECK(unRead, Test_unLwrHsZeitAp , == );*/ } void Mt_Cod_LwrHsZeitSp (void) { Test_unLwrHsZeitSp = 1234; CtrlStp_ReadCodingData(eIoHwAbUser_MountingSide_Left); uint16 unRead = Cod_LwrHsZeitSp (); /* AL_UNITTEST_CHECK(unRead, Test_unLwrHsZeitSp , == );*/ } void Mt_Cod_LwrHsZeitMinTt (void) { Test_unLwrHsZeitMinTt = 3788; CtrlStp_ReadCodingData(eIoHwAbUser_MountingSide_Left); uint16 unRead = Cod_LwrHsZeitMinTt (); /* AL_UNITTEST_CHECK(unRead, Test_unLwrHsZeitMinTt, == );*/ } void Mt_Cod_LwrEnable (void) { Test_boLwrEnable = TRUE; CtrlStp_ReadCodingData(eIoHwAbUser_MountingSide_Left); boolean boRead = Cod_LwrEnable (); /* AL_UNITTEST_CHECK(boRead, Test_boLwrEnable , == );*/ } void Mt_Cod_LwrHsGrad (void) { Test_unLwrHsGrad_LI = 9964; CtrlStp_ReadCodingData(eIoHwAbUser_MountingSide_Left); uint16 unRead = Cod_LwrHsGrad (); /* AL_UNITTEST_CHECK(unRead, Test_unLwrHsGrad_LI , == );*/ } void Mt_Cod_LwrHsWertStart (void) { Test_ucLwrHsWertStart = 3; CtrlStp_ReadCodingData(eIoHwAbUser_MountingSide_Left); uint8 ucRead = Cod_LwrHsWertStart (); /* AL_UNITTEST_CHECK(ucRead, Test_ucLwrHsWertStart, == );*/ } void Mt_Cod_LwrTestDlAktiv (void) { Test_boLwrTestDlAktiv = TRUE; CtrlStp_ReadCodingData(eIoHwAbUser_MountingSide_Left); boolean boRead = Cod_LwrTestDlAktiv (); /* AL_UNITTEST_CHECK(boRead, Test_boLwrTestDlAktiv, == );*/ } void Mt_Cod_LwrTestDlWeg (void) { Test_unLwrTestDlWeg = 233; CtrlStp_ReadCodingData(eIoHwAbUser_MountingSide_Left); uint16 unRead = Cod_LwrTestDlWeg (); /* AL_UNITTEST_CHECK(unRead, Test_unLwrTestDlWeg , == );*/ } /* */ void Mt_Cod_LwrTestDlPeriode(void) { Test_ucLwrTestDlPerio = 27; CtrlStp_ReadCodingData(eIoHwAbUser_MountingSide_Left); uint16 unRead = Cod_LwrTestDlPeriode(); /* AL_UNITTEST_CHECK(unRead, 10 * Test_ucLwrTestDlPerio, == );*/ } void Mt_Cod_LwrAp(void) { Test_ucLwrApWert = 12u; Test_boLwrApVz = TRUE; CtrlStp_ReadCodingData(eIoHwAbUser_MountingSide_Left); sint16 nRead = Cod_LwrAp(); /* AL_UNITTEST_CHECK(nRead, -60, == ); */ } void Mt_Cod_LwrSp(void) { Test_ucLwrSpWert = 11u; Test_boLwrSpVz = TRUE; CtrlStp_ReadCodingData(eIoHwAbUser_MountingSide_Left); sint16 nRead = Cod_LwrSp(); /* AL_UNITTEST_CHECK(nRead, -55, == ); */ } /* tbd-FLM3-HH5 */ void Mt_Cod_LwrWellRefTimeout(void) { CtrlStp_ReadCodingData(eIoHwAbUser_MountingSide_Left); sint16 nRead = Cod_LwrWellRefTimeout(); } /* tbd-FLM3-HH5 */ void Mt_Cod_LwrAutorefZeitversatz(void) { CtrlStp_ReadCodingData(eIoHwAbUser_MountingSide_Left); sint16 nRead = Cod_LwrAutorefZeitversatz(); } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlStp_CodingDataReady /// /// \Test Case Description /// - Test subject: /// Check all paths /// /// - Test Design Technique: DT (Decision Table) /// /// - Preconditions: none /// /// - Expected test results: /// - Return correct value in case of all results correct /// //----------------------------------------------------------------------------- void Mt_CtrlStp_CodingDataReady(void) { tieMountingSide MountingSide; static struct { tieMountingSide MS; tieDataStatus CS; tieDataStatus ES; boolean boResult; } asTestCaseData[] = { { 0, tieDataStatus_Valid, tieDataStatus_Valid, FALSE }, { 0, tieDataStatus_Valid, tieDataStatus_Invalid, FALSE }, { 0, tieDataStatus_Invalid, tieDataStatus_Valid, FALSE }, { 0, tieDataStatus_Invalid, tieDataStatus_Invalid, FALSE }, { eIoHwAbUser_MountingSide_Left, tieDataStatus_Valid, tieDataStatus_Valid, TRUE }, { eIoHwAbUser_MountingSide_Left, tieDataStatus_Valid, tieDataStatus_Invalid, FALSE }, { eIoHwAbUser_MountingSide_Left, tieDataStatus_Invalid, tieDataStatus_Valid, FALSE }, { eIoHwAbUser_MountingSide_Left, tieDataStatus_Invalid, tieDataStatus_Invalid, FALSE }, { eIoHwAbUser_MountingSide_Right,tieDataStatus_Valid, tieDataStatus_Valid, TRUE }, { eIoHwAbUser_MountingSide_Right,tieDataStatus_Valid, tieDataStatus_Invalid, FALSE }, { eIoHwAbUser_MountingSide_Right,tieDataStatus_Invalid, tieDataStatus_Valid, FALSE }, { eIoHwAbUser_MountingSide_Right,tieDataStatus_Invalid, tieDataStatus_Invalid, FALSE } }; for (uint32 ul = 0; ul < _countof(asTestCaseData); ul++) { //Step 1) Set pre - conditions Test_MountingSide = asTestCaseData[ul].MS; Test_CodingStatus = asTestCaseData[ul].CS; Test_EftCrcStatus = asTestCaseData[ul].ES; //Step 2) Assign all input values to the corresponding input variables identified in the FUT // n/a //Step 3) Call the FUT boolean boResult = CtrlStp_CodingDataReady(&MountingSide); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-FLM3-HH5 AL_UNITTEST_CHECK(MountingSide, asTestCaseData[ul].MS, == ); //function shall return correct mounting side // tbd-FLM3-HH5 AL_UNITTEST_CHECK(boResult, asTestCaseData[ul].boResult, == ); //function shall check if coding data is valid } } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlStp_ReadCodingData /// /// \Test Case Description /// - Test subject: /// Check all paths /// /// - Test Design Technique: DT (Decision Table) /// /// - Preconditions: none /// /// - Expected test results: /// - Return correct value in case of all results correct /// //----------------------------------------------------------------------------- void Mt_CtrlStp_ReadCodingData(void) { //Step 1) Set pre - conditions //Step 2) Assign all input values to the corresponding input variables identified in the FUT Test_unLwrAnschlagMi = 345u; Test_unLwrAnschlagPl = 297u; Test_unLwrMaxWinkelMi = 310u; Test_unLwrMaxWinkelPl = 180u; Test_unLwrHsGrad_LI = 9877u; Test_unLwrHsGrad_RE = 9878u; Test_unLwrHsZeitAp = 2345u; Test_unLwrHsZeitSp = 2243u; Test_unLwrHsZeitMinTt = 3333u; Test_boLwrEnable = TRUE; Test_ucLwrHsWertStart = 2u; Test_boLwrTestDlAktiv = FALSE; Test_unLwrTestDlWeg = 255u; Test_ucLwrTestDlPerio = 15u; Test_ucLwrApWert = 12u; Test_boLwrApVz = TRUE; Test_ucLwrSpWert = 11u; Test_boLwrSpVz = TRUE; //Step 3) Call the FUT (left side) CtrlStp_ReadCodingData(eIoHwAbUser_MountingSide_Left); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_CodingData.unLwrAnschlagMi, Test_unLwrAnschlagMi, == ); // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_CodingData.unLwrAnschlagPl, Test_unLwrAnschlagPl, == ); // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_CodingData.unLwrMaxWinkelMi, Test_unLwrMaxWinkelMi, == ); // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_CodingData.unLwrMaxWinkelPl, Test_unLwrMaxWinkelPl, == ); // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_CodingData.unLwrHsGrad, Test_unLwrHsGrad_LI, == ); // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_CodingData.unLwrHsZeitAp, Test_unLwrHsZeitAp, == ); // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_CodingData.unLwrHsZeitSp, Test_unLwrHsZeitSp, == ); // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_CodingData.unLwrHsZeitMinTt, Test_unLwrHsZeitMinTt, == ); // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_CodingData.boLwrEnable, Test_boLwrEnable, == ); // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_CodingData.ucLwrHsWertStart, Test_ucLwrHsWertStart, == ); // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_CodingData.boLwrTestDlAktiv, Test_boLwrTestDlAktiv, == ); // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_CodingData.unLwrTestDlWeg, Test_unLwrTestDlWeg, == ); // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_CodingData.unLwrTestDlPeriode, 150u, == ); // these values are calculated // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_CodingData.nLwrAp, -60, == ); // tbd-FLM3-HH5 AL_UNITTEST_CHECK(CtrlStp_CodingData.nLwrSp, -55, == ); //Step 3) Call the FUT (right side) CtrlStp_ReadCodingData(eIoHwAbUser_MountingSide_Right); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlStp_CodingData.unLwrHsGrad, 10000, == ); } //----------------------------------------------------------------------------- // Test cases for CtrlStp_Util.c //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlStp_Angle2StpPosHS /// /// \Test Case Description /// - Test subject: /// Check mathematical calculation using floating point comparison. /// /// - Test Design Technique: Algoritm testing /// /// - Preconditions: none /// /// - Expected test results: /// - All calculation results shall be reached with a precision of 1/2 LSB /// plus 1/10 LSB for tolerance. /// //----------------------------------------------------------------------------- void Mt_CtrlStp_Angle2StpPosHS(void) { uint16 unTransmFactor; uint16 unOffset; sint16 nAngle; sint16 nResult; double dResult; boolean boAccResult = TRUE; for (unTransmFactor = TEST_TransmFactorMin; unTransmFactor <= TEST_TransmFactorMax; unTransmFactor+= TEST_TransmFactorStep) { for (unOffset = TEST_OffsetMin; unOffset <= TEST_OffsetMax; unOffset += TEST_OffsetStep) { for (nAngle = TEST_AngleMin; nAngle <= TEST_AngleMax; nAngle += TEST_AngleStep) { nResult = CtrlStp_Angle2StpPosHS(unTransmFactor, unOffset, nAngle); dResult = (((double)unOffset + (double)nAngle) * (double)unTransmFactor) / 10000.; if ( ((dResult - (double)nResult) >= .6) // accept 1/2 LSB + .1 LSB || ((dResult - (double)nResult) <= -.6) ) { boAccResult = FALSE; } } } } AL_UNITTEST_CHECK(boAccResult, TRUE, == ); } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlStp_CheckForStart /// /// \Test Case Description /// - Test subject: /// Check mathematical calculation using table for comparison. /// /// - Test Design Technique: Algoritm testing /// /// - Preconditions: none /// /// - Expected test results: /// - All calculation results shall be reached exactly. /// //----------------------------------------------------------------------------- void Mt_CtrlStp_CheckForStart(void) { // start start do not start ignore // always always start condition uint8 aucThresh [5] = { 0u, 1u, 2u, 2u, 3u }; boolean aboMoving [5] = { FALSE, FALSE, FALSE, FALSE, TRUE }; sint16 anOldPos [5] = { 37, 53, 42, 42, 66 }; sint16 anNewPos [5] = { 38, 52, 43, 44, 67 }; sint16 anExpected[5] = { 38, 52, 42, 44, 67 }; for (uint32 ul = 0; ul < 5; ul++) { sint16 nRet = CtrlStp_CheckForStart(aucThresh[ul], aboMoving[ul], anOldPos[ul], anNewPos[ul]); AL_UNITTEST_CHECK(nRet, anExpected[ul], == ); } } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlStp_LimitAngle /// /// \Test Case Description /// - Test subject: /// Check all paths /// /// - Test Design Technique: DT (Decision Table) /// /// - Preconditions: none /// /// - Expected test results: /// - Return correct value in case of /// + in range /// + below range /// + above range /// //----------------------------------------------------------------------------- void Mt_CtrlStp_LimitAngle(void) { boolean boAccResult = TRUE; static struct { sint16 nInput; uint16 unRangeLow; uint16 unRangeHigh; sint16 nResult; } asTestCaseData[] = { { -211, 307, 411, -211 }, { 371, 299, 363, 363 }, { -514, 311, 413, -311 } }; for (uint32 ul = 0; ul < _countof(asTestCaseData); ul++) { sint16 nResult = CtrlStp_LimitAngle(asTestCaseData[ul].unRangeLow, asTestCaseData[ul].unRangeHigh, asTestCaseData[ul].nInput ); if (nResult != asTestCaseData[ul].nResult) { boAccResult = FALSE; } } AL_UNITTEST_CHECK(boAccResult, TRUE, == ); } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlStp_Speed2Tmin /// /// \Test Case Description /// - Test subject: /// Check both paths (in range or out of range). /// Check mathematical calculation using floating point comparison. /// /// - Test Design Technique: Algoritm testing /// /// - Preconditions: none /// /// - Expected test results: /// - All calculation results shall be reached with a precision of 10µs /// //----------------------------------------------------------------------------- void Mt_CtrlStp_Speed2Tmin(void) { uint16 unTransmFactor; uint16 unSpeed; uint16 unResult; double dResult; boolean boAccResult = TRUE; for (unTransmFactor = TEST_TransmFactorMin; unTransmFactor <= TEST_TransmFactorMax; unTransmFactor += TEST_TransmFactorStep) { for (unSpeed = TEST_SpeedMin; unSpeed <= TEST_SpeedMax; unSpeed += TEST_SpeedStep) { unResult = CtrlStp_Speed2Tmin(unTransmFactor, unSpeed); if (unSpeed != 0u) { dResult = 1000000000. / ((double)unTransmFactor * (double)unSpeed); if (dResult > 65535u) { dResult = 65535; } } else { dResult = 0.; } if ( ((dResult - (double)unResult) >= 10.) // accept 10µs || ((dResult - (double)unResult) <= -10.) ) { boAccResult = FALSE; } } } AL_UNITTEST_CHECK(boAccResult, TRUE, == ); } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlStp_StpPosHS2Angle /// /// \Test Case Description /// - Test subject: /// Check mathematical calculation using floating point comparison. /// /// - Test Design Technique: Algoritm testing /// /// - Preconditions: none /// /// - Expected test results: /// - All calculation results shall be reached with a precision of 1/2 LSB /// plus 1/10 LSB for tolerance. /// //----------------------------------------------------------------------------- void Mt_CtrlStp_StpPosHS2Angle(void) { uint16 unTransmFactor; uint16 unOffset; sint16 nStpPos; sint16 nResult; double dResult; boolean boAccResult = TRUE; nResult = CtrlStp_StpPosHS2Angle(0, 0, 0); // check for (unTransmFactor == 0) AL_UNITTEST_CHECK(nResult, 0, == ); for (unTransmFactor = TEST_TransmFactorMin; unTransmFactor <= TEST_TransmFactorMax; unTransmFactor += TEST_TransmFactorStep) { for (unOffset = TEST_OffsetMin; unOffset <= TEST_OffsetMax; unOffset += TEST_OffsetStep) { for (nStpPos = TEST_StepPosMin; nStpPos <= TEST_StepPosMax; nStpPos += TEST_StepPosStep) { nResult = CtrlStp_StpPosHS2Angle(unTransmFactor, unOffset, nStpPos); dResult = ((((10000. * (double)nStpPos) / (double)unTransmFactor)) - (double)unOffset) / 10.; dResult *= 10.; // HH5 with changed factor if ( ((dResult - (double)nResult) >= .6) // accept 1/2 LSB + .1 LSB || ((dResult - (double)nResult) <= -.6)) { boAccResult = FALSE; } } } } AL_UNITTEST_CHECK(boAccResult, TRUE, == ); } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlStp_Tmin2Speed /// /// \Test Case Description /// - Test subject: /// Check both paths (in range or out of range). /// Check mathematical calculation using floating point comparison. /// /// - Test Design Technique: Algoritm testing /// /// - Preconditions: none /// /// - Expected test results: /// - All calculation results shall be reached with a precision of 1/2 LSB /// plus 1/10 LSB for tolerance. /// //----------------------------------------------------------------------------- void Mt_CtrlStp_Tmin2Speed(void) { uint16 unTransmFactor; uint16 unTmin; uint16 unResult; double dResult; boolean boAccResult = TRUE; unResult = CtrlStp_Tmin2Speed(0, 0); // check for (unTransmFactor == 0) AL_UNITTEST_CHECK(unResult, 0, == ); unResult = CtrlStp_Tmin2Speed(1, 1); // check for overflow AL_UNITTEST_CHECK(unResult, 65535, == ); for (unTransmFactor = TEST_TransmFactorMin; unTransmFactor <= TEST_TransmFactorMax; unTransmFactor += TEST_TransmFactorStep) { for (unTmin = TEST_TminMin; unTmin <= TEST_TminMax; unTmin += TEST_TminStep) { unResult = CtrlStp_Tmin2Speed(unTransmFactor, unTmin); if (unTmin != 0u) { dResult = 1000000000. / ((double)unTransmFactor * (double)unTmin); if (dResult > 65535u) { dResult = 65535; } } else { dResult = 0.; } if ( ((dResult - (double)unResult) >= .6 ) // accept 1/2 LSB + .1 LSB || ((dResult - (double)unResult) <= -.6) ) { boAccResult = FALSE; } } } AL_UNITTEST_CHECK(boAccResult, TRUE, == ); } void ALUnitTest_AddTests(void) { // file CtrlStp.c ALUnitTest_AddFunction("Mt_riCtrlStpInit", Mt_riCtrlStpInit); ALUnitTest_AddFunction("Mt_rdCtrlStpDeInit", Mt_rdCtrlStpDeInit); ALUnitTest_AddFunction("Mt_rpCtrlStp10ms", Mt_rpCtrlStp10ms); ALUnitTest_AddFunction("Mt_roCtrlStpExtTakeoverStepperMotorPosition0Start", Mt_roCtrlStpExtTakeoverStepperMotorPosition0Start); ALUnitTest_AddFunction("Mt_roCtrlStpExtTakeoverStepperMotorPosition0Stop", Mt_roCtrlStpExtTakeoverStepperMotorPosition0Stop); ALUnitTest_AddFunction("Mt_roCtrlStpExtTakeoverStepperMotorReferencing0Start", Mt_roCtrlStpExtTakeoverStepperMotorReferencing0Start); ALUnitTest_AddFunction("Mt_roCtrlStpLwrInscenation0Start", Mt_roCtrlStpLwrInscenation0Start); ALUnitTest_AddFunction("Mt_roCtrlStpLwrInscenation0Stop", Mt_roCtrlStpLwrInscenation0Stop); ALUnitTest_AddFunction("Mt_roCtrlStpLwrInscenation0NextTarget", Mt_roCtrlStpLwrInscenation0NextTarget); ALUnitTest_AddFunction("Mt_roCtrlStpSleepModeRequest0", Mt_roCtrlStpSleepModeRequest0); // static functions ALUnitTest_AddFunction("Mt_CtrlStp_Cycle10ms", Mt_CtrlStp_Cycle10ms); ALUnitTest_AddFunction("Mt_CtrlStp_Init", Mt_CtrlStp_Init); ALUnitTest_AddFunction("Mt_CtrlStp_StateEntry", Mt_CtrlStp_StateEntry); ALUnitTest_AddFunction("Mt_CtrlStp_StateMachine", Mt_CtrlStp_StateMachine); ALUnitTest_AddFunction("Mt_CtrlStp_StateMachine_CaseDis", Mt_CtrlStp_StateMachine_CaseDis); ALUnitTest_AddFunction("Mt_CtrlStp_StateMachine_CaseErr", Mt_CtrlStp_StateMachine_CaseErr); ALUnitTest_AddFunction("Mt_CtrlStp_StateMachine_CaseInit", Mt_CtrlStp_StateMachine_CaseInit); ALUnitTest_AddFunction("Mt_CtrlStp_StateMachine_CaseNorm", Mt_CtrlStp_StateMachine_CaseNorm); ALUnitTest_AddFunction("Mt_CtrlStp_StateMachine_CaseOff", Mt_CtrlStp_StateMachine_CaseOff); ALUnitTest_AddFunction("Mt_CtrlStp_StateMachine_CaseRefDn", Mt_CtrlStp_StateMachine_CaseRefDn); ALUnitTest_AddFunction("Mt_CtrlStp_StateMachine_CaseRefUp", Mt_CtrlStp_StateMachine_CaseRefUp); ALUnitTest_AddFunction("Mt_CtrlStp_StateSet", Mt_CtrlStp_StateSet); // file CtrlStp_Core.c (only functions needed tor UT) ALUnitTest_AddFunction("Mt_CtrlStp_EvaluateOpReq", Mt_CtrlStp_EvaluateOpReq); ALUnitTest_AddFunction("Mt_CtrlStp_GetContinMove", Mt_CtrlStp_GetContinMove); ALUnitTest_AddFunction("Mt_CtrlStp_IsMoving", Mt_CtrlStp_IsMoving); ALUnitTest_AddFunction("Mt_CtrlStp_ReadEnvironmentSignals", Mt_CtrlStp_ReadEnvironmentSignals); ALUnitTest_AddFunction("Mt_CtrlStp_TempCheck", Mt_CtrlStp_TempCheck); ALUnitTest_AddFunction("Mt_CtrlStp_DoNorm", Mt_CtrlStp_DoNorm); ALUnitTest_AddFunction("Mt_CtrlStp_GetTgtPos", Mt_CtrlStp_GetTgtPos); ALUnitTest_AddFunction("Mt_CtrlStp_SelectSource", Mt_CtrlStp_SelectSource); ALUnitTest_AddFunction("Mt_CtrlStp_ReadCtrlSignals", Mt_CtrlStp_ReadCtrlSignals); ALUnitTest_AddFunction("Mt_CtrlStp_WriteSignals", Mt_CtrlStp_WriteSignals); // file CtrlStp_Data.c ALUnitTest_AddFunction("Mt_Cod_LwrAnschlagMi", Mt_Cod_LwrAnschlagMi); ALUnitTest_AddFunction("Mt_Cod_LwrAnschlagPl", Mt_Cod_LwrAnschlagPl); ALUnitTest_AddFunction("Mt_Cod_LwrMaxWinkelMi", Mt_Cod_LwrMaxWinkelMi); ALUnitTest_AddFunction("Mt_Cod_LwrMaxWinkelPl", Mt_Cod_LwrMaxWinkelPl); ALUnitTest_AddFunction("Mt_Cod_LwrHsZeitAp", Mt_Cod_LwrHsZeitAp); ALUnitTest_AddFunction("Mt_Cod_LwrHsZeitSp", Mt_Cod_LwrHsZeitSp); ALUnitTest_AddFunction("Mt_Cod_LwrHsZeitMinTt", Mt_Cod_LwrHsZeitMinTt); ALUnitTest_AddFunction("Mt_Cod_LwrEnable", Mt_Cod_LwrEnable); ALUnitTest_AddFunction("Mt_Cod_LwrHsGrad", Mt_Cod_LwrHsGrad); ALUnitTest_AddFunction("Mt_Cod_LwrHsWertStart", Mt_Cod_LwrHsWertStart); ALUnitTest_AddFunction("Mt_Cod_LwrTestDlAktiv", Mt_Cod_LwrTestDlAktiv); ALUnitTest_AddFunction("Mt_Cod_LwrTestDlWeg", Mt_Cod_LwrTestDlWeg); ALUnitTest_AddFunction("Mt_Cod_LwrTestDlPeriode", Mt_Cod_LwrTestDlPeriode); ALUnitTest_AddFunction("Mt_Cod_LwrAp", Mt_Cod_LwrAp); ALUnitTest_AddFunction("Mt_Cod_LwrSp", Mt_Cod_LwrSp); ALUnitTest_AddFunction("Mt_Cod_LwrWellRefTimeout", Mt_Cod_LwrWellRefTimeout); ALUnitTest_AddFunction("Mt_Cod_LwrAutorefZeitversatz", Mt_Cod_LwrAutorefZeitversatz); ALUnitTest_AddFunction("Mt_CtrlStp_CodingDataReady", Mt_CtrlStp_CodingDataReady); ALUnitTest_AddFunction("Mt_CtrlStp_ReadCodingData", Mt_CtrlStp_ReadCodingData); // file CtrlStp_Util.c ALUnitTest_AddFunction("Mt_CtrlStp_Angle2StpPosHS", Mt_CtrlStp_Angle2StpPosHS); ALUnitTest_AddFunction("Mt_CtrlStp_CheckForStart", Mt_CtrlStp_CheckForStart); ALUnitTest_AddFunction("Mt_CtrlStp_LimitAngle", Mt_CtrlStp_LimitAngle); ALUnitTest_AddFunction("Mt_CtrlStp_Speed2Tmin", Mt_CtrlStp_Speed2Tmin); ALUnitTest_AddFunction("Mt_CtrlStp_StpPosHS2Angle", Mt_CtrlStp_StpPosHS2Angle); ALUnitTest_AddFunction("Mt_CtrlStp_Tmin2Speed", Mt_CtrlStp_Tmin2Speed); } // EOF