//***************************************************************************** // (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 software component module CtrlHss /// /// \author Kai Zhao ALDE-RT (zhk2rt) /// mailTo:kai.zhao[at]marelli.com //----------------------------------------------------------------------------- #ifndef UNIT_TEST #else #ifndef RTE_ALLOW_CROSS_HEADER_INCLUSION #define RTE_ALLOW_CROSS_HEADER_INCLUSION #endif #endif #include #include #include #include #include //#include #include #include #include //defines #define tieStatus_Invalid 0 #define tieStatus_Valid 1 #ifndef DEM_EVENT_STATUS_PASSED #define DEM_EVENT_STATUS_PASSED 0U #endif /*DEM_EVENT_STATUS_PASSED*/ #ifndef DEM_EVENT_STATUS_FAILED #define DEM_EVENT_STATUS_FAILED 1U #endif /*DEM_EVENT_STATUS_FAILED*/ //external variablen extern STATIC_AL tisSwitchStatus CtrlHss_aSwitchStatus[CFG_CTRLHSS_HSS_MAX_NO_OF_HSS_CHANNELS]; extern tisCtrlHssState CtrlHss_sState; extern tisCtrlHssVoltState CtrlHss_sVoltState; extern tisDiagControl_CtrlHss CtrlHss_sDiagControl; extern tieHssState CtrlHss_aboAppMTargetState[CFG_CTRLHSS_HSS_MAX_NO_OF_HSS_CHANNELS]; extern tisCtrlHssErrState CtrlHss_sErrState; //extern uint8 CtrlHss_aucErrorStates[CFG_CTRLHSS_HSS_MAX_NO_OF_HSS_CHANNELS][ERRORTYPE_MAX]; extern boolean CtrlHss_aboCddSwiTarget[CFG_CTRLHSS_HSS_MAX_NO_OF_HSS_CHANNELS]; extern uint8 CtrlHss_ucDelayErrorDetectionTimer[CFG_CTRLHSS_HSS_MAX_NO_OF_HSS_CHANNELS]; extern uint16 CtrlHss_unDelaySwitchOnTimer[CFG_CTRLHSS_HSS_MAX_NO_OF_HSS_CHANNELS]; //extern boolean CtrlHss_Diag_boIsCodingDataValid; extern uint8 CtrlHss_aErrorDebounce[CFG_CTRLHSS_HSS_MAX_NO_OF_HSS_CHANNELS]; //extern uint8 CtrlHss_ucShortToGNDNewCycleCheckTimer[CFG_CTRLHSS_HSS_MAX_NO_OF_HSS_CHANNELS]; extern boolean CtrlHss_boMlcSupplyRestart; //external functions extern void rpCtrlHss10ms(void); extern void riCtrlHssInit(void); //extern Std_ReturnType roCtrlHssGetOnTime(tiu32HssChannel ulIx, tiu32TimeDiff_us* ulTimeDiff); extern void CtrlHss_ReadRTEPorts(void); extern void CtrlHss_CheckExternalTakeover(uint8 ucHssChannel); extern void CtrlHss_Diag_CheckAllErrors(uint8 ucHssChannel, boolean boActualState, boolean boDiagDelayDisabled); extern void CtrlHss_Diag_CheckOpenloadDuringOn(uint8 ucHssChannel); extern void CtrlHss_Diag_CheckShort2GndDuringOn(uint8 ucHssChannel); extern void CtrlHss_Diag_CheckShort2VbatDuringOff(uint8 ucHssChannel); //extern void CtrlHss_GetErrorState(uint8 ucHssChannel, uint8 ucErrorStates[]); extern void CtrlHss_ExtTakeoverSwitchHssOutputChannel0Start(uint8 channelNo, uint8 switchOutput); extern void CtrlHss_ExtTakeoverSwitchHssOutputChannel0Stop(uint8 channelNo); extern void CtrlHss_OperateOutputWithVoltState(uint8 ucHssChannel); extern void CtrlHss_SwitchOutput(uint8 ucHssChannel, boolean boSwitch); //extern void CtrlHss_Cycle10ms(void); extern void CtrlHss_DeInit(void); extern void CtrlHss_CheckDelaySwitchOnTimer(uint8 ucHssChannel); //extern void CtrlHss_Diag_DataInit(void); extern void CtrlHss_DTCHandling(void); //Mocks tRomPara_CodingArea applicationCodingData; static uint8 Mt_CtrlHss_ucEFT_ECUVARCFG_HSS[3]; //static tieEftData Mt_pEftData; //static uint8 Mt_HSS_DIAG_DEBOUNCE; STATIC_AL VAR(tisAllSwitchTarget, RTE_DATA) Rte_GstppareCtrlHssSwiTarget_sAllSwitchTarget_ctaaSysMon = Rte_GstppareCtrlHssSwiTarget_sAllSwitchTarget_ctaaSysMon_Init_DEF; STATIC_AL VAR(tisHssStatusErrorArr, RTE_VAR_INIT) Rte_GaappaseCtrlHssStatusError0_sVal_ctasCtrlHss = Rte_GaappaseCtrlHssStatusError0_sVal_ctasCtrlHss_Init_DEF; STATIC_AL VAR(tisAllSwitchStatus, RTE_DATA) Rte_GstppareSysMonSwiStatus_sAllSwitchStatus_ctasCtrlHss = Rte_GstppareSysMonSwiStatus_sAllSwitchStatus_ctasCtrlHss_Init_DEF; STATIC_AL VAR(tisHssTarget, RTE_DATA) Rte_GstppareCPMFanRequest_sSetting_ctasCtrlHss = Rte_GstppareCPMFanRequest_sSetting_ctasCtrlHss_Init_DEF; STATIC_AL VAR(tieDataStatus, RTE_VAR_INIT) Rte_GucppaseCodMCodingDataStatus0_eCompleteCodingDataStatus_ctaaCodM = (tieDataStatus)Rte_GucppaseCodMCodingDataStatus0_eCompleteCodingDataStatus_ctaaCodM_Init_DEF; STATIC_AL VAR(tieDataStatus, RTE_DATA) Rte_GucppaseCddEftCrcStatus0_sVal_ctadCddEft = tieStatus_Invalid; STATIC_AL VAR(tisSysVoltStatus, RTE_DATA) Rte_GstppaseSysVoltStatus_sSysVoltStatus_ctasSysVolt = Rte_GstppaseSysVoltStatus_sSysVoltStatus_ctasSysVolt_Init_DEF; FUNC(void, RTE_CODE) Rte_Memcpy (void * LpDestination, const void * LpSource, uint32 LulDataSize) { uint32 LulIndex; uint8* LpDest = (uint8*)LpDestination; const uint8* LpSrc = (const uint8*)LpSource; if ((NULL != LpDest) && (NULL != LpSrc)) { for (LulIndex = 0; LulIndex < LulDataSize; LulIndex++) { LpDest[LulIndex] = LpSrc[LulIndex]; } } } FUNC(Std_ReturnType, RTE_CODE) Rte_Write_ctasCtrlHss_ppaseCtrlHssSwiTarget_sAllSwitchTarget (P2CONST(tisAllSwitchTarget, AUTOMATIC, RTE_APPL_DATA) Data) { VAR(Std_ReturnType, RTE_DATA) LddRetVal; LddRetVal = RTE_E_OK; (void)Rte_Memcpy(&Rte_GstppareCtrlHssSwiTarget_sAllSwitchTarget_ctaaSysMon, Data, sizeof(tisAllSwitchTarget)); return LddRetVal; } FUNC(Std_ReturnType, RTE_CODE) Rte_Write_ctasCtrlHss_ppaseCtrlHssStatusError0_sVal (P2CONST(tisHssStatusError, AUTOMATIC, RTE_APPL_DATA) Data) { VAR(Std_ReturnType, RTE_DATA) LddRetVal; LddRetVal = RTE_E_OK; (void)Rte_Memcpy(&Rte_GaappaseCtrlHssStatusError0_sVal_ctasCtrlHss[0], Data, sizeof(tisHssStatusErrorArr)); return LddRetVal; } FUNC(Std_ReturnType, RTE_CODE) Rte_Read_ctasCtrlHss_ppareSysMonSwiStatus_sAllSwitchStatus (P2VAR(tisAllSwitchStatus, AUTOMATIC, RTE_APPL_DATA)Data) { VAR(Std_ReturnType, RTE_DATA) LddRetVal; LddRetVal = RTE_E_OK; (void)Rte_Memcpy(Data, &(Rte_GstppareSysMonSwiStatus_sAllSwitchStatus_ctasCtrlHss), sizeof(tisAllSwitchStatus)); return LddRetVal; } FUNC(Std_ReturnType, RTE_CODE) Rte_Read_ctasCtrlHss_ppareCddEftCrcStatus0_eEftDataStatus (P2VAR(tieDataStatus, AUTOMATIC, RTE_APPL_DATA)Data) { VAR(Std_ReturnType, RTE_DATA) LddRetVal; *Data = Rte_GucppaseCddEftCrcStatus0_sVal_ctadCddEft; LddRetVal = RTE_E_OK; return LddRetVal; } FUNC(Std_ReturnType, RTE_CODE) Rte_Read_ctasCtrlHss_ppareCodMCodingDataStatus0_eCompleteCodingDataStatus (P2VAR(tieDataStatus, AUTOMATIC, RTE_APPL_DATA)Data) { VAR(Std_ReturnType, RTE_DATA) LddRetVal; *Data = Rte_GucppaseCodMCodingDataStatus0_eCompleteCodingDataStatus_ctaaCodM; LddRetVal = RTE_E_OK; return LddRetVal; } FUNC(Std_ReturnType, RTE_CODE) Rte_Read_ctasCtrlHss_ppareSysVoltStatus_sSysVoltStatus (P2VAR(tisSysVoltStatus, AUTOMATIC, RTE_APPL_DATA)Data) { VAR(Std_ReturnType, RTE_DATA) LddRetVal; LddRetVal = RTE_E_OK; (void)Rte_Memcpy(Data, &(Rte_GstppaseSysVoltStatus_sSysVoltStatus_ctasSysVolt), sizeof(tisSysVoltStatus)); return LddRetVal; } FUNC(Std_ReturnType, RTE_CODE) Rte_Read_ctasCtrlHss_ppareCPMFanRequest_sSetting (P2VAR(tisHssTarget, AUTOMATIC, RTE_APPL_DATA)Data) { VAR(Std_ReturnType, RTE_DATA) LddRetVal; LddRetVal = RTE_E_OK; (void)Rte_Memcpy(Data, &(Rte_GstppareCPMFanRequest_sSetting_ctasCtrlHss), sizeof(tisHssTarget)); return LddRetVal; } static void Mt_Initialisation(void) { uint8 i; for (i = 0; i < CFG_CTRLHSS_HSS_MAX_NO_OF_HSS_CHANNELS; i++) { Rte_GstppareCPMFanRequest_sSetting_ctasCtrlHss.aeSetting[i] = HSS_SNA; Rte_GstppareSysMonSwiStatus_sAllSwitchStatus_ctasCtrlHss.asSwitchStatus[i].unActVal = 0u; Rte_GstppareSysMonSwiStatus_sAllSwitchStatus_ctasCtrlHss.asSwitchStatus[i].unActCurrent = 0u; Rte_GstppareSysMonSwiStatus_sAllSwitchStatus_ctasCtrlHss.asSwitchStatus[i].eShortGND = ERR_SNA; Rte_GstppareSysMonSwiStatus_sAllSwitchStatus_ctasCtrlHss.asSwitchStatus[i].eOpenLoad = ERR_SNA; Rte_GstppareSysMonSwiStatus_sAllSwitchStatus_ctasCtrlHss.asSwitchStatus[i].eShortVBAT = ERR_SNA; Rte_GstppareSysMonSwiStatus_sAllSwitchStatus_ctasCtrlHss.asSwitchStatus[i].eHwState = SUPPORT_SNA; CtrlHss_sErrState.ucErrShortToGnd[i] = ERR_SNA; CtrlHss_sErrState.ucErrShortToVbat[i] = ERR_SNA; CtrlHss_sErrState.ucErrOpenLoad[i] = ERR_SNA; CtrlHss_sErrState.ucCntShortToGnd[i] = 0; CtrlHss_sErrState.ucCntShortToVbat[i] = 0; CtrlHss_sErrState.ucCntOpenLoad[i] = 0; CtrlHss_sDiagControl.teMode[i] = eDiagCtrl_CtrlHss_Disabled; CtrlHss_sDiagControl.ucHssOutput[i] = 0; CtrlHss_unDelaySwitchOnTimer[i] = 0; CtrlHss_sState.aboHssSwitchOnDelay[i] = FALSE; CtrlHss_aboCddSwiTarget[i] = 0; CtrlHss_sState.aboHssShort2GNDDetected[i] = 0; } CtrlHss_aErrorDebounce[HSS1] = CFG_CTRLHSS_HSS1_ERROR_DEBOUNCE; CtrlHss_aErrorDebounce[HSS2] = CFG_CTRLHSS_HSS2_ERROR_DEBOUNCE; CtrlHss_aErrorDebounce[HSS3] = CFG_CTRLHSS_HSS3_ERROR_DEBOUNCE; CtrlHss_boMlcSupplyRestart = FALSE; Rte_GstppaseSysVoltStatus_sSysVoltStatus_ctasSysVolt.boFanSwitchOn = FALSE; Rte_GstppaseSysVoltStatus_sSysVoltStatus_ctasSysVolt.boFanRemainOn = FALSE; Rte_GstppaseSysVoltStatus_sSysVoltStatus_ctasSysVolt.boErrorDiagEnabled = FALSE; Rte_GstppareSysMonSwiStatus_sAllSwitchStatus_ctasCtrlHss.asSwitchStatus[0].eHwState = HSS_SUPPORT; Rte_GstppareSysMonSwiStatus_sAllSwitchStatus_ctasCtrlHss.asSwitchStatus[1].eHwState = HSS_SUPPORT; Rte_GstppareSysMonSwiStatus_sAllSwitchStatus_ctasCtrlHss.asSwitchStatus[2].eHwState = HSS_SUPPORT; } //----------------------------------------------------------------------------- /// \Test Case : Mt_riCtrlHssInit_1 /// /// \Test Case Description /// - Test subject: /// Set the RTE port ppCodMEftCrcStatus0 with FALSE /// Call the RTE runnable riCtrlHssInit(). /// Check RTE port GaappCtrlHssStatusError0 /// Check the status of IoHwAbUser Dio Ports /// /// - Test Design Technique: ET (Exploratory Testing) /// /// - Preconditions: none /// /// - Expected test results: /// - All conditions and assigned values in the step3 need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_riCtrlHssInit_1(void) { uint8 i; // Initialize the static variables for unit tests. //Mt_Initialisation(); //// Step1: set RTE port ppCodMEftCrcStatus0 with Valid //(void)Rte_Write_ctaaCodM_ppCodMEftCrcStatus0_sVal(tieStatus_Valid); //Mt_CtrlHss_ucEFT_ECUVARCFG_HSS[0] = 1u; //Mt_CtrlHss_ucEFT_ECUVARCFG_HSS[1] = 2u; //Mt_CtrlHss_ucEFT_ECUVARCFG_HSS[2] = 3u; Rte_GucppaseCddEftCrcStatus0_sVal_ctadCddEft = tieStatus_Valid; Rte_GucppaseCodMCodingDataStatus0_eCompleteCodingDataStatus_ctaaCodM = tieDataStatus_Valid; applicationCodingData.Fan1.HSS_DIAG.HSS_DIAG_DEBOUNCE = 30u; // Step2: call function riCtrlHssInit(); //// Step3: check RTE port GaappCtrlHssStatusError0 and stauts of IoHwAbUser Dio Ports //for (i = 0; i < CFG_CTRLHSS_HSS_MAX_NO_OF_HSS_CHANNELS; i++) //{ // AL_UNITTEST_CHECK(Rte_GaappCtrlHssStatusError0_sVal_ctaaCtrlHss[i].eStatSupported, SUPPORT_YES, == ); // AL_UNITTEST_CHECK(Rte_GaappCtrlHssStatusError0_sVal_ctaaCtrlHss[i].eStatOn, HSS_SNA, == ); // AL_UNITTEST_CHECK(Rte_GaappCtrlHssStatusError0_sVal_ctaaCtrlHss[i].eErrShortToGnd, ERR_SNA, == ); // AL_UNITTEST_CHECK(Rte_GaappCtrlHssStatusError0_sVal_ctaaCtrlHss[i].eErrShortToVBat, ERR_SNA, == ); // AL_UNITTEST_CHECK(Rte_GaappCtrlHssStatusError0_sVal_ctaaCtrlHss[i].eErrOpenLoad, ERR_SNA, == ); //} Rte_GucppaseCodMCodingDataStatus0_eCompleteCodingDataStatus_ctaaCodM = tieDataStatus_Invalid; applicationCodingData.Fan1.HSS_DIAG.HSS_DIAG_DEBOUNCE = 0u; // Step2: call function riCtrlHssInit(); } // ////----------------------------------------------------------------------------- ///// \Test Case : Mt_riCtrlHssInit_2 ///// ///// \Test Case Description ///// - Test subject: ///// Set the RTE port ppCodMEftCrcStatus0 with FALSE ///// Call the RTE runnable riCtrlHssInit(). ///// Check RTE port GaappCtrlHssStatusError0 ///// Check the status of IoHwAbUser Dio Ports ///// ///// - Test Design Technique: ET (Exploratory Testing) ///// ///// - Preconditions: none ///// ///// - Expected test results: ///// - All conditions and assigned values in the step3 need to be reached and passed. ///// ////----------------------------------------------------------------------------- //void Mt_riCtrlHssInit_2(void) //{ // uint8 i; // // // Initialize the static variables for unit tests. // Mt_Initialisation(); // // // Step1: set RTE port ppCodMEftCrcStatus0 with Valid // (void)Rte_Write_ctaaCodM_ppCodMEftCrcStatus0_sVal(tieStatus_Valid); // Mt_CtrlHss_ucEFT_ECUVARCFG_HSS[0] = 1u; // Mt_CtrlHss_ucEFT_ECUVARCFG_HSS[1] = 0u; // Mt_CtrlHss_ucEFT_ECUVARCFG_HSS[2] = 3u; // // // Step2: call function // riCtrlHssInit(); // // // Step3: check RTE port GaappCtrlHssStatusError0 and stauts of IoHwAbUser Dio Ports // AL_UNITTEST_CHECK(Rte_GaappCtrlHssStatusError0_sVal_ctaaCtrlHss[0].eStatSupported, SUPPORT_YES, == ); // AL_UNITTEST_CHECK(Rte_GaappCtrlHssStatusError0_sVal_ctaaCtrlHss[0].eStatOn, HSS_SNA, == ); // AL_UNITTEST_CHECK(Rte_GaappCtrlHssStatusError0_sVal_ctaaCtrlHss[0].eErrShortToGnd, ERR_SNA, == ); // AL_UNITTEST_CHECK(Rte_GaappCtrlHssStatusError0_sVal_ctaaCtrlHss[0].eErrShortToVBat, ERR_SNA, == ); // AL_UNITTEST_CHECK(Rte_GaappCtrlHssStatusError0_sVal_ctaaCtrlHss[0].eErrOpenLoad, ERR_SNA, == ); // // AL_UNITTEST_CHECK(Rte_GaappCtrlHssStatusError0_sVal_ctaaCtrlHss[1].eStatSupported, SUPPORT_NO, == ); // AL_UNITTEST_CHECK(Rte_GaappCtrlHssStatusError0_sVal_ctaaCtrlHss[1].eErrShortToGnd, ERR_DISABLED, == ); // AL_UNITTEST_CHECK(Rte_GaappCtrlHssStatusError0_sVal_ctaaCtrlHss[1].eErrShortToVBat, ERR_DISABLED, == ); // AL_UNITTEST_CHECK(Rte_GaappCtrlHssStatusError0_sVal_ctaaCtrlHss[1].eErrOpenLoad, ERR_DISABLED, == ); // // AL_UNITTEST_CHECK(Rte_GaappCtrlHssStatusError0_sVal_ctaaCtrlHss[2].eStatSupported, SUPPORT_YES, == ); // AL_UNITTEST_CHECK(Rte_GaappCtrlHssStatusError0_sVal_ctaaCtrlHss[2].eStatOn, HSS_SNA, == ); // AL_UNITTEST_CHECK(Rte_GaappCtrlHssStatusError0_sVal_ctaaCtrlHss[2].eErrShortToGnd, ERR_SNA, == ); // AL_UNITTEST_CHECK(Rte_GaappCtrlHssStatusError0_sVal_ctaaCtrlHss[2].eErrShortToVBat, ERR_SNA, == ); // AL_UNITTEST_CHECK(Rte_GaappCtrlHssStatusError0_sVal_ctaaCtrlHss[2].eErrOpenLoad, ERR_SNA, == ); // // AL_UNITTEST_CHECK(Mt_CtrlHss_IoHwAbUser_Dio_11_0, FALSE, == ); // AL_UNITTEST_CHECK(Mt_CtrlHss_IoHwAbUser_Dio_11_1, FALSE, == ); // AL_UNITTEST_CHECK(Mt_CtrlHss_IoHwAbUser_Dio_11_2, FALSE, == ); // AL_UNITTEST_CHECK(Mt_CtrlHss_IoHwAbUser_Dio_23_3, TRUE, == ); // // AL_UNITTEST_CHECK(CtrlHss_sState.boEftCrcStatus, TRUE, == ); //} // //----------------------------------------------------------------------------- /// \Test Case : Mt_riCtrlHssInit_3 /// /// \Test Case Description /// - Test subject: /// Set the RTE port ppCodMEftCrcStatus0 with TRUE /// Call the RTE runnable riCtrlHssInit(). /// Check RTE port GaappCtrlHssStatusError0 /// Check the status of IoHwAbUser Dio Ports /// /// - Test Design Technique: ET (Exploratory Testing) /// /// - Preconditions: none /// /// - Expected test results: /// - All conditions and assigned values in the step3 need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_riCtrlHssInit_3(void) { // Initialize the static variables for unit tests. Mt_Initialisation(); // Step1: set RTE port ppCodMEftCrcStatus0 with Invalid Rte_GucppaseCddEftCrcStatus0_sVal_ctadCddEft = tieStatus_Invalid; // Step2: call function riCtrlHssInit(); // Step3: check RTE ports // GaappCtrlHssActual and stauts of IoHwAbUser Dio Ports AL_UNITTEST_CHECK(Rte_GaappaseCtrlHssStatusError0_sVal_ctasCtrlHss[HSS1].eStatSupported, SUPPORT_UNKNOWN, == ); AL_UNITTEST_CHECK(Rte_GaappaseCtrlHssStatusError0_sVal_ctasCtrlHss[HSS2].eStatSupported, SUPPORT_UNKNOWN, == ); AL_UNITTEST_CHECK(Rte_GaappaseCtrlHssStatusError0_sVal_ctasCtrlHss[HSS3].eStatSupported, SUPPORT_UNKNOWN, == ); AL_UNITTEST_CHECK(CtrlHss_sState.boEftCrcStatus, FALSE, == ); } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlHss_ReadRTEPorts /// /// \Test Case Description /// - Test subject: /// Read the RTE ports /// /// - Test Design Technique: ET (Exploratory Testing) /// /// - Preconditions: none /// /// - Expected test results: /// - All conditions and assigned values in the step3 need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_CtrlHss_ReadRTEPorts(void) { // Step1: write the RTE ports Rte_GstppaseSysVoltStatus_sSysVoltStatus_ctasSysVolt.boFanSwitchOn = TRUE; Rte_GstppaseSysVoltStatus_sSysVoltStatus_ctasSysVolt.boFanRemainOn = TRUE; Rte_GstppaseSysVoltStatus_sSysVoltStatus_ctasSysVolt.boErrorDiagEnabled = TRUE; Rte_GstppareCPMFanRequest_sSetting_ctasCtrlHss.aeSetting[0] = TRUE; Rte_GstppareCPMFanRequest_sSetting_ctasCtrlHss.aeSetting[1] = FALSE; Rte_GstppareCPMFanRequest_sSetting_ctasCtrlHss.aeSetting[2] = TRUE; Rte_GstppareSysMonSwiStatus_sAllSwitchStatus_ctasCtrlHss.asSwitchStatus[0].unActVal = 32768u; Rte_GstppareSysMonSwiStatus_sAllSwitchStatus_ctasCtrlHss.asSwitchStatus[1].unActVal = 0u; Rte_GstppareSysMonSwiStatus_sAllSwitchStatus_ctasCtrlHss.asSwitchStatus[2].unActVal = 32768u; // Step2: call function CtrlHss_ReadRTEPorts(); // Step3: check static Variables AL_UNITTEST_CHECK(CtrlHss_sVoltState.boSwitchOn[0], TRUE, == ); AL_UNITTEST_CHECK(CtrlHss_sVoltState.boRemainOn[0], TRUE, == ); AL_UNITTEST_CHECK(CtrlHss_sVoltState.boDiagEnabled, TRUE, == ); AL_UNITTEST_CHECK(CtrlHss_aboAppMTargetState[0], TRUE, == ); AL_UNITTEST_CHECK(CtrlHss_aboAppMTargetState[1], FALSE, == ); AL_UNITTEST_CHECK(CtrlHss_aboAppMTargetState[2], TRUE, == ); AL_UNITTEST_CHECK(CtrlHss_aSwitchStatus[0].unActVal, 32768u, == ); AL_UNITTEST_CHECK(CtrlHss_aSwitchStatus[1].unActVal, 0u, == ); AL_UNITTEST_CHECK(CtrlHss_aSwitchStatus[2].unActVal, 32768u, == ); } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlHss_CheckExternalTakeover /// /// \Test Case Description /// - Test subject: /// Read the static variable CtrlHss_sDiagControl /// Set the static variable CtrlHss_sState.aboHssTargetState /// ///// - Test Design Technique: DT (Decision Table) ///// The Decision Table asTestCaseData[] is used in this test case. This DT contains all possible values of all inputs ///// which are taken into account by the algorithm of the FUT, as well as the expected values of all outputs which are ///// set by the FUT. Every DT-entry represents a different Test Case interaction. ///// - DT-Info: ///// - Inputs: ///// - aboAppMTarget[]: Array for the Hss target value from AppM Module ///// - tDiagHssMode: Diagnose control mode ///// - tDiagHssOutput: Target vaule in diagnose control mode ///// - Outputs: ///// - aboHssTarget[]: Array for the Hss target value to IoHwAbUser Module ///// ///// - Preconditions: EFT data is available ///// ///// - Expected test results: ///// - All conditions and assigned values of the DT need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_CtrlHss_CheckExternalTakeover(void) { // test step int nStep; typedef struct { uint8 tDiagHssMode[3]; uint8 aucDiagOutput[3]; boolean aboAppMTarget[3]; boolean boMlcSupplyRestart; } tSetValues_FixData; typedef struct { boolean aboHssTarget[3]; }tCheckValues_FixData; typedef struct { tSetValues_FixData SetValues; tCheckValues_FixData CheckValues; } tUtCtrlHss_TestSteps_FixData; static const tUtCtrlHss_TestSteps_FixData aTestSteps[] = { // Intputs || Outputs // tDiagHssMode, aucDiagOutput, aboAppMTarget, boMlcSupplyRestart ; || aboHssTarget /* 0 */{ { { 1, 0, 1 },{ 1u, 0u, 0u },{ FALSE, TRUE, TRUE }, FALSE }, { { TRUE, TRUE, FALSE } } }, /* 1 */{ { { 0, 1, 0 },{ 1u, 1u, 1u },{ FALSE, FALSE, FALSE }, FALSE }, { { FALSE, TRUE, FALSE } } }, /* 2 */{ { { 1, 0, 1 },{ 0u, 0u, 0u },{ TRUE, TRUE, TRUE }, FALSE }, { { FALSE, TRUE, FALSE } } }, /* 3 */{ { { 1, 0, 1 },{ 0u, 0u, 0u },{ TRUE, TRUE, TRUE }, TRUE }, { { FALSE, FALSE, FALSE } } }, }; const int nNrSteps = sizeof(aTestSteps) / sizeof(tUtCtrlHss_TestSteps_FixData); for (nStep = 0; nStep < nNrSteps; nStep++) { // Step1: set the static variable CtrlHss_sDiagControl, CtrlHss_aboAppMTargetState CtrlHss_sDiagControl.teMode[0] = aTestSteps[nStep].SetValues.tDiagHssMode[0]; CtrlHss_sDiagControl.teMode[1] = aTestSteps[nStep].SetValues.tDiagHssMode[1]; CtrlHss_sDiagControl.teMode[2] = aTestSteps[nStep].SetValues.tDiagHssMode[2]; CtrlHss_sDiagControl.ucHssOutput[0] = aTestSteps[nStep].SetValues.aucDiagOutput[0]; CtrlHss_sDiagControl.ucHssOutput[1] = aTestSteps[nStep].SetValues.aucDiagOutput[1]; CtrlHss_sDiagControl.ucHssOutput[2] = aTestSteps[nStep].SetValues.aucDiagOutput[2]; CtrlHss_aboAppMTargetState[0] = aTestSteps[nStep].SetValues.aboAppMTarget[0]; CtrlHss_aboAppMTargetState[1] = aTestSteps[nStep].SetValues.aboAppMTarget[1]; CtrlHss_aboAppMTargetState[2] = aTestSteps[nStep].SetValues.aboAppMTarget[2]; CtrlHss_boMlcSupplyRestart = aTestSteps[nStep].SetValues.boMlcSupplyRestart; // Step2: call function CtrlHss_CheckExternalTakeover(0); CtrlHss_CheckExternalTakeover(1); CtrlHss_CheckExternalTakeover(2); //Step3: check RTE ports of Hss actual AL_UNITTEST_CHECK(CtrlHss_sState.aboHssTargetState[0], aTestSteps[nStep].CheckValues.aboHssTarget[0], == ); AL_UNITTEST_CHECK(CtrlHss_sState.aboHssTargetState[1], aTestSteps[nStep].CheckValues.aboHssTarget[1], == ); AL_UNITTEST_CHECK(CtrlHss_sState.aboHssTargetState[2], aTestSteps[nStep].CheckValues.aboHssTarget[2], == ); } } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlHss_Diag_CheckAllErrors /// /// \Test Case Description /// - Test subject: /// Read the RTE ports /// /// - Test Design Technique: ET (Exploratory Testing) /// /// - Preconditions: none /// /// - Expected test results: /// - All conditions and assigned values in the step3 need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_CtrlHss_Diag_CheckAllErrors(void) { // test step int nStep; typedef struct { uint8 ucIndex; boolean boActVal; boolean boDiagDelayDisabled; } tSetValues_FixData; typedef struct { uint8 ucCntOpenload; uint8 ucCntShortGND; uint8 ucCntShortVBAT; uint8 ucErrOpenload; uint8 ucErrShortGND; uint8 ucErrShortVBAT; }tCheckValues_FixData; typedef struct { tSetValues_FixData SetValues; tCheckValues_FixData CheckValues; } tUtCtrlHss_TestSteps_FixData; static const tUtCtrlHss_TestSteps_FixData aTestSteps[] = { // Intputs || Outputs // ucIndex, boActVal, boDiagDelayDisabled ; || ucCntOpenload, ucCntShortGND, ucCntShortVBAT, ucErrOpenload, ucErrShortGND, ucErrShortVBAT /* 0 */{ { 0 , 0u, FALSE }, { 0, 0, 0, 0, 0, 0 } }, /* 1 */{ { 0 , 1u, FALSE }, { 0, 0, 0, 0, 0, 0 } }, /* 2 */{ { 1 , 1u, TRUE }, { 0, 0, 0, 0, 0, 0 } }, }; const int nNrSteps = sizeof(aTestSteps) / sizeof(tUtCtrlHss_TestSteps_FixData); for (nStep = 0; nStep < nNrSteps; nStep++) { // Step1: intialization Mt_Initialisation(); // Step2: call function CtrlHss_Diag_CheckAllErrors(aTestSteps[nStep].SetValues.ucIndex, aTestSteps[nStep].SetValues.boActVal, aTestSteps[nStep].SetValues.boDiagDelayDisabled); //Step3: check the variable CtrlHss_sErrState AL_UNITTEST_CHECK(CtrlHss_sErrState.ucCntOpenLoad[aTestSteps[nStep].SetValues.ucIndex], aTestSteps[nStep].CheckValues.ucCntOpenload, == ); AL_UNITTEST_CHECK(CtrlHss_sErrState.ucCntShortToGnd[aTestSteps[nStep].SetValues.ucIndex], aTestSteps[nStep].CheckValues.ucCntShortGND, == ); AL_UNITTEST_CHECK(CtrlHss_sErrState.ucCntShortToVbat[aTestSteps[nStep].SetValues.ucIndex], aTestSteps[nStep].CheckValues.ucCntShortVBAT, == ); AL_UNITTEST_CHECK(CtrlHss_sErrState.ucErrOpenLoad[aTestSteps[nStep].SetValues.ucIndex], aTestSteps[nStep].CheckValues.ucErrOpenload, == ); AL_UNITTEST_CHECK(CtrlHss_sErrState.ucErrShortToGnd[aTestSteps[nStep].SetValues.ucIndex], aTestSteps[nStep].CheckValues.ucErrShortGND, == ); AL_UNITTEST_CHECK(CtrlHss_sErrState.ucErrShortToVbat[aTestSteps[nStep].SetValues.ucIndex], aTestSteps[nStep].CheckValues.ucErrShortVBAT, == ); } } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlHss_Diag_CheckShort2GndDuringOn /// /// \Test Case Description /// - Test subject: /// /// - Test Design Technique: DT (Decision Table) /// The Decision Table asTestCaseData[] is used in this test case. This DT contains all possible values of all inputs /// which are taken into account by the algorithm of the FUT, as well as the expected values of all outputs which are /// set by the FUT. Every DT-entry represents a different Test Case interaction. /// - DT-Info: /// - Inputs: /// - ucChannel: channel of the Hss-outputs /// - SwitchStatus: status of error /// - ucShort2GNDCnt: counter of short to GND error /// - Outputs: /// - ucShort2GNDCnt: counter of short to GND error /// - ucErrShortToGnd: error state of short to GND error /// /// /// - Preconditions: Target value is ON /// /// - Expected test results: /// - All conditions and assigned values of the DT need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_CtrlHss_Diag_CheckShort2GndDuringOn(void) { //test step int nStep; typedef struct { uint8 ucChannel; tieError SwitchStatus; uint8 ucShort2GNDCnt; } tSetValues_FixData; typedef struct { uint8 ucShort2GNDCnt; uint8 ucErrShortToGnd; }tCheckValues_FixData; typedef struct { tSetValues_FixData SetValues; tCheckValues_FixData CheckValues; } tUtCtrlHss_TestSteps_FixData; static const tUtCtrlHss_TestSteps_FixData aTestSteps[] = { // Intputs || Outputs // ucChannel, SwitchStatus, ucShort2GNDCnt ; || ucShort2GNDCnt ucErrShortToGnd /* 0 */{ { 0, ERR_YES, 2 }, { 3, ERR_SNA } }, /* 1 */{ { 0, ERR_NO, 5 }, { 4, ERR_SNA } }, /* 2 */{ { 0, ERR_YES, 9 }, {10, ERR_SNA } }, /* 3 */{ { 0, ERR_YES, 60 }, {60, ERR_YES } }, /* 4 */{ { 1, ERR_NO, 0 }, { 0, ERR_NO } }, /* 5 */{ { 2, ERR_YES, 59 }, {60, ERR_SNA } }, /* 6 */{ { 2, ERR_YES, 60 }, {60, ERR_YES } }, /* 7 */{ { 2, ERR_NO, 60 }, {59, ERR_YES } }, /* 8 */{ { 2, ERR_NO, 1 }, { 0, ERR_YES } }, /* 9 */{ { 2, ERR_NO, 0 }, { 0, ERR_NO } }, }; const int nNrSteps = sizeof(aTestSteps) / sizeof(tUtCtrlHss_TestSteps_FixData); for (nStep = 0; nStep < nNrSteps; nStep++) { uint8 i; // Step1: set the static variable CtrlHss_sErrState i = aTestSteps[nStep].SetValues.ucChannel; CtrlHss_aSwitchStatus[i].eShortGND = aTestSteps[nStep].SetValues.SwitchStatus; CtrlHss_sErrState.ucCntShortToGnd[i] = aTestSteps[nStep].SetValues.ucShort2GNDCnt; // Step2: call function CtrlHss_Diag_CheckShort2GndDuringOn(i); //Step3: check the static variable CtrlHss_sErrState AL_UNITTEST_CHECK(CtrlHss_sErrState.ucCntShortToGnd[i], aTestSteps[nStep].CheckValues.ucShort2GNDCnt, == ); AL_UNITTEST_CHECK(CtrlHss_sErrState.ucErrShortToGnd[i], aTestSteps[nStep].CheckValues.ucErrShortToGnd, == ); } } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlHss_Diag_CheckShort2GndDuringOn_No_Monitoring /// /// \Test Case Description /// - Test subject: /// /// - Test Design Technique: DT (Decision Table) /// The Decision Table asTestCaseData[] is used in this test case. This DT contains all possible values of all inputs /// which are taken into account by the algorithm of the FUT, as well as the expected values of all outputs which are /// set by the FUT. Every DT-entry represents a different Test Case interaction. /// - DT-Info: /// - Inputs: /// - ucChannel: channel of the Hss-outputs /// - SwitchStatus: error status of short to GND /// - ucShort2GNDCnt: counter of short to GND error /// - Outputs: /// - ucShort2GNDCnt: counter of short to GND error /// - ucErrShortToGnd: error state of short to GND error /// /// /// - Preconditions: Target value is ON /// /// - Expected test results: /// - All conditions and assigned values of the DT need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_CtrlHss_Diag_CheckShort2GndDuringOn_No_Monitoring(void) { //test step int nStep; typedef struct { uint8 ucChannel; tieError SwitchStatus; uint8 ucShort2GNDCnt; } tSetValues_FixData; typedef struct { uint8 ucShort2GNDCnt; uint8 ucErrShortToGnd; }tCheckValues_FixData; typedef struct { tSetValues_FixData SetValues; tCheckValues_FixData CheckValues; } tUtCtrlHss_TestSteps_FixData; static const tUtCtrlHss_TestSteps_FixData aTestSteps[] = { // Intputs || Outputs // ucChannel, SwitchStatus, ucShort2GNDCnt ; || ucShort2GNDCnt ucErrShortToGnd /* 0 */{ { 0, ERR_YES, 2 }, { 3, ERR_SNA } }, /* 1 */{ { 0, ERR_YES, 59 }, {60, ERR_SNA } }, /* 2 */{ { 2, ERR_YES, 0 }, { 1, ERR_SNA } }, /* 3 */{ { 2, ERR_YES, 60 }, {60, ERR_YES } }, /* 4 */{ { 1, ERR_SNA, 8 }, { 8, ERR_SNA } }, /* 5 */{ { 0, ERR_DISABLED, 3 }, { 3, ERR_SNA } }, }; const int nNrSteps = sizeof(aTestSteps) / sizeof(tUtCtrlHss_TestSteps_FixData); Mt_Initialisation(); for (nStep = 0; nStep < nNrSteps; nStep++) { uint8 i; // Step1: set the static variable CtrlHss_sErrState i = aTestSteps[nStep].SetValues.ucChannel; CtrlHss_aSwitchStatus[i].eShortGND = aTestSteps[nStep].SetValues.SwitchStatus; CtrlHss_sErrState.ucCntShortToGnd[i] = aTestSteps[nStep].SetValues.ucShort2GNDCnt; // Step2: call function CtrlHss_Diag_CheckShort2GndDuringOn(i); //Step3: check the static variable CtrlHss_sErrState AL_UNITTEST_CHECK(CtrlHss_sErrState.ucCntShortToGnd[i], aTestSteps[nStep].CheckValues.ucShort2GNDCnt, == ); AL_UNITTEST_CHECK(CtrlHss_sErrState.ucErrShortToGnd[i], aTestSteps[nStep].CheckValues.ucErrShortToGnd, == ); } } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlHss_Diag_CheckOpenloadDuringOn /// /// \Test Case Description /// - Test subject: /// /// - Test Design Technique: DT (Decision Table) /// The Decision Table asTestCaseData[] is used in this test case. This DT contains all possible values of all inputs /// which are taken into account by the algorithm of the FUT, as well as the expected values of all outputs which are /// set by the FUT. Every DT-entry represents a different Test Case interaction. /// - DT-Info: /// - Inputs: /// - ucChannel: channel of the Hss-outputs /// - SwitchStatus: status of error /// - ucErrShortToVBat: error state of short to VBAT error /// - ucOpenloadCnt: counter of openload error /// - ucShortToVbatCnt: counter of short to Vbat error /// - Outputs: /// - ucOpenloadCnt: counter of openload error /// - ucShortToVbatCnt: counter of short to Vbat error /// - ucErrOpenload: error state of openload error /// - ucErrShortToVBat: error state of short to VBAT error /// /// /// - Preconditions: Target value is ON /// /// - Expected test results: /// - All conditions and assigned values of the DT need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_CtrlHss_Diag_CheckOpenloadDuringOn(void) { //test step int nStep; typedef struct { uint8 ucChannel; tieError SwitchStatus; uint8 ucErrShortToVbat; uint8 ucOpenloadCnt; uint8 ucShortToVbatCnt; } tSetValues_FixData; typedef struct { uint8 ucOpenloadCnt; uint8 ucShortToVbatCnt; uint8 ucErrShortToVbat; uint8 ucErrOpenload; }tCheckValues_FixData; typedef struct { tSetValues_FixData SetValues; tCheckValues_FixData CheckValues; } tUtCtrlHss_TestSteps_FixData; static const tUtCtrlHss_TestSteps_FixData aTestSteps[] = { // Intputs || Outputs // ucChannel, SwitchStatus, ucErrShortToVbat, ucOpenloadCnt, ucShortToVbatCnt; || ucOpenloadCnt, ucShortToVbatCnt, ucErrShortToVbat, ucErrOpenload /* 0 */{ { 0, ERR_YES, ERR_NO, 0, 0 }, { 1, 0, ERR_NO, ERR_SNA } }, /* 1 */{ { 0, ERR_YES, ERR_NO, 2, 0 }, { 3, 0, ERR_NO, ERR_SNA } }, /* 2 */{ { 0, ERR_YES, ERR_NO, 60, 0 }, {60, 0, ERR_NO, ERR_YES } }, /* 3 */{ { 1, ERR_YES, ERR_YES, 0, 60 }, { 0, 60, ERR_YES, ERR_NO } }, /* 4 */{ { 1, ERR_NO, ERR_YES, 0, 60 }, { 0, 59, ERR_YES, ERR_NO } }, /* 5 */{ { 1, ERR_NO, ERR_YES, 0, 1 }, { 0, 0, ERR_YES, ERR_NO } }, /* 6 */{ { 2, ERR_YES, ERR_YES, 60, 60 }, {60, 60, ERR_YES, ERR_NO } }, /* 7 */{ { 2, ERR_NO, ERR_YES, 60, 60 }, {59, 59, ERR_YES, ERR_NO } }, /* 8 */{ { 2, ERR_NO, ERR_YES, 0, 0 }, { 0, 0, ERR_NO, ERR_NO } }, }; const int nNrSteps = sizeof(aTestSteps) / sizeof(tUtCtrlHss_TestSteps_FixData); Mt_Initialisation(); for (nStep = 0; nStep < nNrSteps; nStep++) { uint8 i; // Step1: set the static variable CtrlHss_sErrState i = aTestSteps[nStep].SetValues.ucChannel; CtrlHss_aSwitchStatus[i].eOpenLoad = aTestSteps[nStep].SetValues.SwitchStatus; CtrlHss_sErrState.ucErrShortToVbat[i] = aTestSteps[nStep].SetValues.ucErrShortToVbat; CtrlHss_sErrState.ucCntShortToVbat[i] = aTestSteps[nStep].SetValues.ucShortToVbatCnt; CtrlHss_sErrState.ucCntOpenLoad[i] = aTestSteps[nStep].SetValues.ucOpenloadCnt; // Step2: call function CtrlHss_Diag_CheckOpenloadDuringOn(i); //Step3: check the static variable CtrlHss_sErrState AL_UNITTEST_CHECK(CtrlHss_sErrState.ucCntOpenLoad[i], aTestSteps[nStep].CheckValues.ucOpenloadCnt, == ); AL_UNITTEST_CHECK(CtrlHss_sErrState.ucCntShortToVbat[i], aTestSteps[nStep].CheckValues.ucShortToVbatCnt, == ); AL_UNITTEST_CHECK(CtrlHss_sErrState.ucErrShortToVbat[i], aTestSteps[nStep].CheckValues.ucErrShortToVbat, == ); AL_UNITTEST_CHECK(CtrlHss_sErrState.ucErrOpenLoad[i], aTestSteps[nStep].CheckValues.ucErrOpenload, == ); } } ////----------------------------------------------------------------------------- ///// \Test Case : Mt_CtrlHss_Diag_CheckOpenloadDuringOn_No_Monitoring ///// ///// \Test Case Description ///// - Test subject: ///// ///// - Test Design Technique: DT (Decision Table) ///// The Decision Table asTestCaseData[] is used in this test case. This DT contains all possible values of all inputs ///// which are taken into account by the algorithm of the FUT, as well as the expected values of all outputs which are ///// set by the FUT. Every DT-entry represents a different Test Case interaction. ///// - DT-Info: ///// - Inputs: ///// - Cod_Threshold: threshold of openload detection ///// - ucChannel: channel of the Hss-outputs ///// - ulHssSense: measured ADC value of HssSense ///// - ucErrShortToVBat: error state of short to VBAT error ///// - ucOpenloadCnt: counter of openload error ///// - ucShortToVbatCnt: counter of short to Vbat error ///// - Outputs: ///// - ucOpenloadCnt: counter of openload error ///// - ucShortToVbatCnt: counter of short to Vbat error ///// - ucErrOpenload: error state of openload error ///// - ucErrShortToVBat: error state of short to VBAT error ///// ///// ///// - Preconditions: Target value is ON ///// ///// - Expected test results: ///// - All conditions and assigned values of the DT need to be reached and passed. ///// ////----------------------------------------------------------------------------- //void Mt_CtrlHss_Diag_CheckOpenloadDuringOn_No_Monitoring(void) //{ // //test step // int nStep; // // typedef struct // { // uint16 Cod_Threshold; // uint8 ucChannel; // uint32 ulHssSense; // uint8 ucErrShortToVbat; // uint8 ucOpenloadCnt; // uint8 ucShortToVbatCnt; // } tSetValues_FixData; // // typedef struct // { // uint8 ucOpenloadCnt; // uint8 ucShortToVbatCnt; // uint8 ucErrShortToVbat; // uint8 ucErrOpenload; // }tCheckValues_FixData; // // typedef struct // { // tSetValues_FixData SetValues; // tCheckValues_FixData CheckValues; // } tUtCtrlHss_TestSteps_FixData; // // static const tUtCtrlHss_TestSteps_FixData aTestSteps[] = // { // Intputs || Outputs // // Cod_Threshold, ucChannel, ulHssSense, ucErrShortToVbat, ucOpenloadCnt, ucShortToVbatCnt; || ucOpenloadCnt, ucShortToVbatCnt, ucErrShortToVbat, ucErrOpenload // /* 0 */{ { 24, 0, 20, ERR_NO, 0, 0 }, { 1, 0, ERR_NO, ERR_SNA } }, // /* 1 */{ { 24, 0, 20, ERR_NO, 10, 0 }, {10, 0, ERR_NO, ERR_YES } }, // /* 2 */{ { 0, 1, 20, ERR_YES, 0, 10 }, { 0, 10, ERR_YES, ERR_SNA } }, // /* 4 */{ { 0, 1, 10, ERR_NO, 9, 0 }, { 9, 0, ERR_NO, ERR_SNA } }, // }; // // const int nNrSteps = sizeof(aTestSteps) / sizeof(tUtCtrlHss_TestSteps_FixData); // // Mt_Initialisation(); // // for (nStep = 0; nStep < nNrSteps; nStep++) // { // uint8 i; // // // Step1: set the static variable CtrlHss_sErrState // CtrlHss_aOpenLoadThreshold[aTestSteps[nStep].SetValues.ucChannel] = aTestSteps[nStep].SetValues.Cod_Threshold; // i = aTestSteps[nStep].SetValues.ucChannel; // CtrlHss_sErrState.tulHssSense[i] = aTestSteps[nStep].SetValues.ulHssSense; // CtrlHss_sErrState.ucErrShortToVbat[i] = aTestSteps[nStep].SetValues.ucErrShortToVbat; // CtrlHss_sErrState.ucCntShortToVbat[i] = aTestSteps[nStep].SetValues.ucShortToVbatCnt; // CtrlHss_sErrState.ucCntOpenLoad[i] = aTestSteps[nStep].SetValues.ucOpenloadCnt; // // // Step2: call function // CtrlHss_Diag_CheckOpenloadDuringOn(i); // // //Step3: check the static variable CtrlHss_sErrState // AL_UNITTEST_CHECK(CtrlHss_sErrState.ucCntOpenLoad[i], aTestSteps[nStep].CheckValues.ucOpenloadCnt, == ); // AL_UNITTEST_CHECK(CtrlHss_sErrState.ucCntShortToVbat[i], aTestSteps[nStep].CheckValues.ucShortToVbatCnt, == ); // AL_UNITTEST_CHECK(CtrlHss_sErrState.ucErrShortToVbat[i], aTestSteps[nStep].CheckValues.ucErrShortToVbat, == ); // AL_UNITTEST_CHECK(CtrlHss_sErrState.ucErrOpenLoad[i], aTestSteps[nStep].CheckValues.ucErrOpenload, == ); // } //} // ////----------------------------------------------------------------------------- ///// \Test Case : Mt_CtrlHss_Diag_CheckShort2VbatDuringOff_No_Monitoring ///// ///// \Test Case Description ///// - Test subject: ///// ///// - Test Design Technique: DT (Decision Table) ///// The Decision Table asTestCaseData[] is used in this test case. This DT contains all possible values of all inputs ///// which are taken into account by the algorithm of the FUT, as well as the expected values of all outputs which are ///// set by the FUT. Every DT-entry represents a different Test Case interaction. ///// - DT-Info: ///// - Inputs: ///// - Cod_Threshold: threshold of short to VBAT detection ///// - ucChannel: channel of the Hss-outputs ///// - ulHssSense: measured ADC value of HssSense ///// - ucShort2VBatCnt: counter of short to VBAT error ///// - Outputs: ///// - ucShort2VBatCnt: counter of short to GND error ///// - ucErrShortToVbat: error state of short to VBAT error ///// ///// ///// - Preconditions: Target value is ON ///// ///// - Expected test results: ///// - All conditions and assigned values of the DT need to be reached and passed. ///// ////----------------------------------------------------------------------------- //void Mt_CtrlHss_Diag_CheckShort2VbatDuringOff_No_Monitoring(void) //{ // //test step // int nStep; // // typedef struct // { // uint16 Cod_Threshold; // uint8 ucChannel; // uint32 ulHssSense; // uint8 ucShort2VbatCnt; // } tSetValues_FixData; // // typedef struct // { // uint8 ucShort2VbatCnt; // uint8 ucErrShortToVbat; // }tCheckValues_FixData; // // typedef struct // { // tSetValues_FixData SetValues; // tCheckValues_FixData CheckValues; // } tUtCtrlHss_TestSteps_FixData; // // static const tUtCtrlHss_TestSteps_FixData aTestSteps[] = // { // Intputs || Outputs // // Cod_Threshold, ucChannel, ulHssSense, ucShort2VbatCnt ; || ucShort2VbatCnt ucErrShortToVbat // /* 0 */{ { 2000, 0, 5000, 2 }, { 3, ERR_SNA } }, // /* 1 */{ { 2000, 1, 200, 5 }, { 4, ERR_SNA } }, // /* 2 */{ { 2000, 0, 5000, 10 }, {10, ERR_YES } }, // /* 2 */{ { 0, 0, 5000, 0 }, { 0, ERR_SNA } }, // }; // // const int nNrSteps = sizeof(aTestSteps) / sizeof(tUtCtrlHss_TestSteps_FixData); // // Mt_Initialisation(); // // for (nStep = 0; nStep < nNrSteps; nStep++) // { // uint8 i; // // // Step1: set the static variable CtrlHss_sErrState // CtrlHss_aShort2VbatThreshold[aTestSteps[nStep].SetValues.ucChannel] = aTestSteps[nStep].SetValues.Cod_Threshold; // i = aTestSteps[nStep].SetValues.ucChannel; // CtrlHss_sErrState.tulHssSense[i] = aTestSteps[nStep].SetValues.ulHssSense; // CtrlHss_sErrState.ucCntShortToVbat[i] = aTestSteps[nStep].SetValues.ucShort2VbatCnt; // // // Step2: call function // CtrlHss_Diag_CheckShort2VbatDuringOff(i); // // //Step3: check the static variable CtrlHss_sErrState // AL_UNITTEST_CHECK(CtrlHss_sErrState.ucCntShortToVbat[i], aTestSteps[nStep].CheckValues.ucShort2VbatCnt, == ); // AL_UNITTEST_CHECK(CtrlHss_sErrState.ucErrShortToVbat[i], aTestSteps[nStep].CheckValues.ucErrShortToVbat, == ); // } //} // //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlHss_Diag_CheckShort2VbatDuringOff /// /// \Test Case Description /// - Test subject: /// /// - Test Design Technique: DT (Decision Table) /// The Decision Table asTestCaseData[] is used in this test case. This DT contains all possible values of all inputs /// which are taken into account by the algorithm of the FUT, as well as the expected values of all outputs which are /// set by the FUT. Every DT-entry represents a different Test Case interaction. /// - DT-Info: /// - Inputs: /// - ucChannel: channel of the Hss-outputs /// - SwitchStatus: status of error /// - ucShort2VBatCnt: counter of short to VBAT error /// - Outputs: /// - ucShort2VBatCnt: counter of short to GND error /// - ucErrShortToVbat: error state of short to VBAT error /// /// /// - Preconditions: Target value is ON /// /// - Expected test results: /// - All conditions and assigned values of the DT need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_CtrlHss_Diag_CheckShort2VbatDuringOff(void) { //test step int nStep; typedef struct { uint8 ucChannel; tieError SwitchStatus; uint8 ucShort2VbatCnt; } tSetValues_FixData; typedef struct { uint8 ucShort2VbatCnt; uint8 ucErrShortToVbat; }tCheckValues_FixData; typedef struct { tSetValues_FixData SetValues; tCheckValues_FixData CheckValues; } tUtCtrlHss_TestSteps_FixData; static const tUtCtrlHss_TestSteps_FixData aTestSteps[] = { // Intputs || Outputs // ucChannel, SwitchStatus, ucShort2VbatCnt ; || ucShort2VbatCnt ucErrShortToVbat /* 0 */{ { 0, ERR_YES, 2 },{ 3, ERR_SNA } }, /* 1 */{ { 0, ERR_NO, 5 },{ 4, ERR_SNA } }, /* 2 */{ { 0, ERR_YES, 60 },{60, ERR_YES } }, /* 3 */{ { 1, ERR_NO, 0 },{ 0, ERR_NO } }, /* 4 */{ { 2, ERR_YES, 59 },{60, ERR_SNA } }, /* 5 */{ { 2, ERR_YES, 60 },{60, ERR_YES } }, /* 6 */{ { 2, ERR_NO, 60 },{59, ERR_YES } }, /* 7 */{ { 2, ERR_NO, 1 },{ 0, ERR_YES } }, /* 8 */{ { 2, ERR_NO, 0 },{ 0, ERR_NO } }, }; const int nNrSteps = sizeof(aTestSteps) / sizeof(tUtCtrlHss_TestSteps_FixData); Mt_Initialisation(); for (nStep = 0; nStep < nNrSteps; nStep++) { uint8 i; // Step1: set the static variable CtrlHss_sErrState i = aTestSteps[nStep].SetValues.ucChannel; CtrlHss_aSwitchStatus[i].eShortVBAT = aTestSteps[nStep].SetValues.SwitchStatus; CtrlHss_sErrState.ucCntShortToVbat[i] = aTestSteps[nStep].SetValues.ucShort2VbatCnt; // Step2: call function CtrlHss_Diag_CheckShort2VbatDuringOff(i); //Step3: check the static variable CtrlHss_sErrState AL_UNITTEST_CHECK(CtrlHss_sErrState.ucCntShortToVbat[i], aTestSteps[nStep].CheckValues.ucShort2VbatCnt, == ); AL_UNITTEST_CHECK(CtrlHss_sErrState.ucErrShortToVbat[i], aTestSteps[nStep].CheckValues.ucErrShortToVbat, == ); } } //----------------------------------------------------------------------------- /// \Test Case : Mt_rpCtrlHss10ms /// /// \Test Case Description /// - Test subject: /// Check the rpCtrlHss10ms() with the expected values. /// /// - Test Design Technique: DT (Decision Table) /// The Decision Table asTestCaseData[] is used in this test case. This DT contains all possible values of all inputs /// which are taken into account by the algorithm of the FUT, as well as the expected values of all outputs which are /// set by the FUT. Every DT-entry represents a different Test Case interaction. /// - DT-Info: /// - Inputs: /// - boEftCrcStatus: State of EftCrcStatus /// - aboHssTarget[]: Array for the Hss target value /// - tDiagHssMode[]: Array for Diagnose control mode /// - tDiagHssOutput[]: Array for Target vaule in diagnose control mode /// - tVoltState[]: Array for voltage state 0:boSwitchOn, 1:boRemainOn, 2: boDiagEnabled /// - Outputs: /// - ucStatSupport[]: Array for state support /// - ucStateOn[]: Array for Hss actual state /// - aboCddSwiTarget[]: Array for the Hss Target /// /// - Preconditions: none /// /// - Expected test results: /// - All conditions and assigned values of the DT need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_rpCtrlHss10ms(void) { // test step int nStep; typedef struct { boolean boEftCrcStatus; boolean aboHssTarget[3]; uint8 aucHwState[3]; uint8 tDiagHssMode[3]; uint8 tDiagHssOutput[3]; uint8 tVoltState[3]; } tSetValues_FixData; typedef struct { uint8 ucStatSupport[3]; uint8 ucStatOn[3]; boolean aboCddSwiTarget[3]; }tCheckValues_FixData; typedef struct { tSetValues_FixData SetValues; tCheckValues_FixData CheckValues; } tUtCtrlHss_TestSteps_FixData; static const tUtCtrlHss_TestSteps_FixData aTestSteps[] = { // Intputs || Outputs // boEftCrcStatus, aboHssTarget, aucHwState, tDiagHssMode , tDiagHssOutput tVoltState ; || ucStatSupport, ucStatOn, aboCddSwiTarget /* 0 */{ { tieStatus_Valid, { TRUE, TRUE, TRUE },{ HSS_SUPPORT, HSS_SUPPORT, HSS_SUPPORT }, { 0, 0, 0 },{ FALSE, FALSE, FALSE},{ 1, 1, 1 } },{ { SUPPORT_YES, SUPPORT_YES, SUPPORT_YES },{ HSS_ON, HSS_ON, HSS_ON },{ TRUE, TRUE, TRUE } } }, /* 1 */{ { tieStatus_Valid, { TRUE, FALSE, TRUE },{ HSS_SUPPORT, HSS_SUPPORT, HSS_SUPPORT }, { 0, 0, 0 },{ TRUE, FALSE, TRUE },{ 1, 1, 1 } },{ { SUPPORT_YES, SUPPORT_YES, SUPPORT_YES },{ HSS_ON, HSS_OFF, HSS_ON },{ TRUE, FALSE, TRUE } } }, /* 2 */{ { tieStatus_Invalid,{ TRUE, FALSE, TRUE },{ HSS_SUPPORT, HSS_SUPPORT, HSS_SUPPORT }, { 0, 0, 0 },{ TRUE, FALSE, TRUE },{ 1, 1, 1 } },{ { SUPPORT_UNKNOWN, SUPPORT_UNKNOWN, SUPPORT_UNKNOWN },{ HSS_DISABLED, HSS_DISABLED, HSS_DISABLED },{ FALSE, FALSE, FALSE } } }, /* 3 */{ { tieStatus_Valid, { FALSE, FALSE, TRUE },{ HSS_SUPPORT, HSS_SUPPORT, HSS_SUPPORT }, { 1, 0, 0 },{ TRUE, FALSE, TRUE },{ 1, 1, 0 } },{ { SUPPORT_YES, SUPPORT_YES, SUPPORT_YES },{ HSS_ON, HSS_OFF, HSS_ON },{ TRUE, FALSE, TRUE } } }, /* 4 */{ { tieStatus_Valid, { FALSE, FALSE, FALSE },{ HSS_SUPPORT, HSS_NOSUPPORT, HSS_SUPPORT }, { 1, 0, 1 },{ TRUE, FALSE, TRUE },{ 0, 0, 1 } },{ { SUPPORT_YES, SUPPORT_NO, SUPPORT_YES },{ HSS_OFF, HSS_DISABLED, HSS_ON },{ FALSE, FALSE, TRUE } } }, // /* 5 */{ { tieStatus_Valid, { 1u, 2u, 0u },{ FALSE, FALSE, FALSE },{ 1, 0, 1 },{ TRUE, FALSE, TRUE },{ 0, 1, 1 } },{ { SUPPORT_YES, SUPPORT_YES, SUPPORT_NO },{ HSS_OFF, HSS_OFF, HSS_DISABLED },{ FALSE, FALSE, FALSE } } }, }; const int nNrSteps = sizeof(aTestSteps) / sizeof(tUtCtrlHss_TestSteps_FixData); Mt_Initialisation(); for (nStep = 0; nStep < nNrSteps; nStep++) { // initialze the static variables Mt_Initialisation(); //Step1: simulate RTE ports of EftCrcStatus, Hss outputs availbilty, AppMTarget values with set values in test steps //CtrlHss_sState.boEftCrcStatus = aTestSteps[nStep].SetValues.boEftCrcStatus; Rte_GucppaseCddEftCrcStatus0_sVal_ctadCddEft = aTestSteps[nStep].SetValues.boEftCrcStatus; Rte_GstppareCPMFanRequest_sSetting_ctasCtrlHss.aeSetting[0] = aTestSteps[nStep].SetValues.aboHssTarget[0]; Rte_GstppareCPMFanRequest_sSetting_ctasCtrlHss.aeSetting[1] = aTestSteps[nStep].SetValues.aboHssTarget[1]; Rte_GstppareCPMFanRequest_sSetting_ctasCtrlHss.aeSetting[2] = aTestSteps[nStep].SetValues.aboHssTarget[2]; riCtrlHssInit(); Rte_GstppareSysMonSwiStatus_sAllSwitchStatus_ctasCtrlHss.asSwitchStatus[0].eHwState = aTestSteps[nStep].SetValues.aucHwState[0]; Rte_GstppareSysMonSwiStatus_sAllSwitchStatus_ctasCtrlHss.asSwitchStatus[1].eHwState = aTestSteps[nStep].SetValues.aucHwState[1]; Rte_GstppareSysMonSwiStatus_sAllSwitchStatus_ctasCtrlHss.asSwitchStatus[2].eHwState = aTestSteps[nStep].SetValues.aucHwState[2]; CtrlHss_sDiagControl.teMode[0] = aTestSteps[nStep].SetValues.tDiagHssMode[0]; CtrlHss_sDiagControl.teMode[1] = aTestSteps[nStep].SetValues.tDiagHssMode[1]; CtrlHss_sDiagControl.teMode[2] = aTestSteps[nStep].SetValues.tDiagHssMode[2]; CtrlHss_sDiagControl.ucHssOutput[0] = aTestSteps[nStep].SetValues.tDiagHssOutput[0]; CtrlHss_sDiagControl.ucHssOutput[1] = aTestSteps[nStep].SetValues.tDiagHssOutput[1]; CtrlHss_sDiagControl.ucHssOutput[2] = aTestSteps[nStep].SetValues.tDiagHssOutput[2]; Rte_GstppaseSysVoltStatus_sSysVoltStatus_ctasSysVolt.boFanSwitchOn = aTestSteps[nStep].SetValues.tVoltState[0]; Rte_GstppaseSysVoltStatus_sSysVoltStatus_ctasSysVolt.boFanRemainOn = aTestSteps[nStep].SetValues.tVoltState[1]; Rte_GstppaseSysVoltStatus_sSysVoltStatus_ctasSysVolt.boErrorDiagEnabled = aTestSteps[nStep].SetValues.tVoltState[2]; //Step2: call the function rpCtrlHss10ms rpCtrlHss10ms(); //Step3: check RTE ports of Hss actual AL_UNITTEST_CHECK(Rte_GaappaseCtrlHssStatusError0_sVal_ctasCtrlHss[0].eStatSupported, aTestSteps[nStep].CheckValues.ucStatSupport[0], == ); AL_UNITTEST_CHECK(Rte_GaappaseCtrlHssStatusError0_sVal_ctasCtrlHss[1].eStatSupported, aTestSteps[nStep].CheckValues.ucStatSupport[1], == ); AL_UNITTEST_CHECK(Rte_GaappaseCtrlHssStatusError0_sVal_ctasCtrlHss[2].eStatSupported, aTestSteps[nStep].CheckValues.ucStatSupport[2], == ); AL_UNITTEST_CHECK(Rte_GaappaseCtrlHssStatusError0_sVal_ctasCtrlHss[0].eStatOn, aTestSteps[nStep].CheckValues.ucStatOn[0], == ); AL_UNITTEST_CHECK(Rte_GaappaseCtrlHssStatusError0_sVal_ctasCtrlHss[1].eStatOn, aTestSteps[nStep].CheckValues.ucStatOn[1], == ); AL_UNITTEST_CHECK(Rte_GaappaseCtrlHssStatusError0_sVal_ctasCtrlHss[2].eStatOn, aTestSteps[nStep].CheckValues.ucStatOn[2], == ); AL_UNITTEST_CHECK(CtrlHss_aboCddSwiTarget[0], aTestSteps[nStep].CheckValues.aboCddSwiTarget[0], == ); AL_UNITTEST_CHECK(CtrlHss_aboCddSwiTarget[1], aTestSteps[nStep].CheckValues.aboCddSwiTarget[1], == ); AL_UNITTEST_CHECK(CtrlHss_aboCddSwiTarget[2], aTestSteps[nStep].CheckValues.aboCddSwiTarget[2], == ); } } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlHss10ms_DiagDisabled /// /// \Test Case Description /// - Test subject: /// Check the CtrlHss_Cycle10ms() with the expected values. /// /// - Test Design Technique: DT (Decision Table) /// The Decision Table asTestCaseData[] is used in this test case. This DT contains all possible values of all inputs /// which are taken into account by the algorithm of the FUT, as well as the expected values of all outputs which are /// set by the FUT. Every DT-entry represents a different Test Case interaction. /// - DT-Info: /// - Inputs: /// - aboHssTarget[]: Array for the Hss target value /// - boDiagEnabled: Voltage State for error detection /// - ucErrShortToGND[]: Array for state of short to GND error /// - ucErrShortToVbat[]: Array for state of short to Vbat error /// - ucErrOpenload[]: Array for state of openload error /// - Outputs: /// - ucStateOn[]: Array for Hss actual state /// - boHssDioPort[]: Array for the Hss Dio Ports /// - ucErrShortToGND[]: Array for state of short to GND error /// - ucErrShortToVbat[]: Array for state of short to Vbat error /// - ucErrOpenload[]: Array for state of openload error /// /// - Preconditions: EftCrcStatus is valid. All Hss is avaiable. /// /// - Expected test results: /// - All conditions and assigned values of the DT need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_CtrlHss10ms_DiagDisabled(void) { // test step int nStep; typedef struct { boolean aboHssTarget[3]; boolean boDiagEnabled; boolean boHssShort2GNDDetected; uint8 ucErrShortToGnd[3]; uint8 ucErrShortToVbat[3]; uint8 ucErrOpenload[3]; } tSetValues_FixData; typedef struct { uint8 ucStatOn[3]; uint8 ucErrShortToGnd[3]; uint8 ucErrShortToVbat[3]; uint8 ucErrOpenload[3]; }tCheckValues_FixData; typedef struct { tSetValues_FixData SetValues; tCheckValues_FixData CheckValues; } tUtCtrlHss_TestSteps_FixData; static const tUtCtrlHss_TestSteps_FixData aTestSteps[] = { // Intputs || Outputs // aboHssTarget, boDiagEnabled ,boHssShort2GNDDetected, ucErrShortToGnd , ucErrShortToVbat, ucErrOpenload ; || ucStatOn, ucErrShortToGnd , ucErrShortToVbat, ucErrOpenload /* 1 */{ { { TRUE, FALSE, TRUE }, 1, FALSE, { ERR_NO, ERR_NO, ERR_NO },{ ERR_NO, ERR_NO, ERR_NO },{ ERR_NO, ERR_NO, ERR_NO } },{ { HSS_ON, HSS_OFF, HSS_ON },{ ERR_NO, ERR_SNA, ERR_NO },{ ERR_NO, ERR_NO, ERR_NO },{ ERR_NO, ERR_SNA, ERR_NO } } }, /* 2 */{ { { TRUE, FALSE, TRUE }, 1, FALSE, { ERR_NO, ERR_NO, ERR_NO },{ ERR_NO , ERR_YES, ERR_NO },{ ERR_NO, ERR_NO, ERR_NO } },{ { HSS_ON, HSS_OFF, HSS_ON },{ ERR_NO, ERR_SNA, ERR_NO },{ ERR_NO, ERR_YES, ERR_NO },{ ERR_NO, ERR_SNA, ERR_NO } } }, /* 3 */{ { { TRUE, FALSE, TRUE }, 0, FALSE, { ERR_NO, ERR_NO, ERR_NO },{ ERR_YES, ERR_NO, ERR_NO },{ ERR_NO, ERR_NO, ERR_NO } },{ { HSS_ON, HSS_OFF, HSS_ON },{ ERR_SNA, ERR_SNA, ERR_SNA },{ ERR_SNA, ERR_SNA, ERR_SNA },{ ERR_SNA, ERR_SNA, ERR_SNA } } }, /* 4 */{ { {FALSE, TRUE, TRUE }, 1, FALSE, {ERR_SNA, ERR_NO, ERR_YES },{ ERR_YES, ERR_NO, ERR_NO },{ERR_SNA, ERR_YES, ERR_NO } },{ {HSS_OFF, HSS_ON, HSS_ON },{ ERR_SNA, ERR_NO, ERR_YES },{ ERR_YES, ERR_NO, ERR_NO },{ ERR_SNA, ERR_YES, ERR_NO } } }, /* 5 */{ { {FALSE, TRUE, TRUE }, 1, TRUE, {ERR_SNA, ERR_SNA, ERR_YES },{ ERR_NO, ERR_NO, ERR_NO },{ERR_SNA, ERR_YES, ERR_NO } },{ {HSS_OFF, HSS_OFF, HSS_ON },{ ERR_SNA, ERR_YES, ERR_YES },{ ERR_NO, ERR_NO, ERR_NO },{ ERR_SNA, ERR_YES, ERR_NO } } }, }; const int nNrSteps = sizeof(aTestSteps) / sizeof(tUtCtrlHss_TestSteps_FixData); for (nStep = 0; nStep < nNrSteps; nStep++) { // initialze the static variables Mt_Initialisation(); //Step1: simulate RTE ports of EftCrcStatus, Hss outputs availbilty, AppMTarget values with set values in test steps //(void)Rte_Write_ctaaCodM_ppCodMEftCrcStatus0_sVal(tieStatus_Valid); Rte_GucppaseCddEftCrcStatus0_sVal_ctadCddEft = tieStatus_Valid; Rte_GstppareCPMFanRequest_sSetting_ctasCtrlHss.aeSetting[0] = aTestSteps[nStep].SetValues.aboHssTarget[0]; Rte_GstppareCPMFanRequest_sSetting_ctasCtrlHss.aeSetting[1] = aTestSteps[nStep].SetValues.aboHssTarget[1]; Rte_GstppareCPMFanRequest_sSetting_ctasCtrlHss.aeSetting[2] = aTestSteps[nStep].SetValues.aboHssTarget[2]; Mt_CtrlHss_ucEFT_ECUVARCFG_HSS[0] = 1u; Mt_CtrlHss_ucEFT_ECUVARCFG_HSS[1] = 2u; Mt_CtrlHss_ucEFT_ECUVARCFG_HSS[2] = 3u; riCtrlHssInit(); Rte_GstppaseSysVoltStatus_sSysVoltStatus_ctasSysVolt.boFanSwitchOn = TRUE; Rte_GstppaseSysVoltStatus_sSysVoltStatus_ctasSysVolt.boFanRemainOn = TRUE; Rte_GstppaseSysVoltStatus_sSysVoltStatus_ctasSysVolt.boErrorDiagEnabled = aTestSteps[nStep].SetValues.boDiagEnabled; CtrlHss_sErrState.ucErrShortToGnd[0] = aTestSteps[nStep].SetValues.ucErrShortToGnd[0]; CtrlHss_sErrState.ucErrShortToGnd[1] = aTestSteps[nStep].SetValues.ucErrShortToGnd[1]; CtrlHss_sErrState.ucErrShortToGnd[2] = aTestSteps[nStep].SetValues.ucErrShortToGnd[2]; CtrlHss_sErrState.ucErrShortToVbat[0] = aTestSteps[nStep].SetValues.ucErrShortToVbat[0]; CtrlHss_sErrState.ucErrShortToVbat[1] = aTestSteps[nStep].SetValues.ucErrShortToVbat[1]; CtrlHss_sErrState.ucErrShortToVbat[2] = aTestSteps[nStep].SetValues.ucErrShortToVbat[2]; CtrlHss_sErrState.ucErrOpenLoad[0] = aTestSteps[nStep].SetValues.ucErrOpenload[0]; CtrlHss_sErrState.ucErrOpenLoad[1] = aTestSteps[nStep].SetValues.ucErrOpenload[1]; CtrlHss_sErrState.ucErrOpenLoad[2] = aTestSteps[nStep].SetValues.ucErrOpenload[2]; CtrlHss_sState.aboHssShort2GNDDetected[1] = aTestSteps[nStep].SetValues.boHssShort2GNDDetected; //Step2: call the function CtrlHss_Cycle10ms rpCtrlHss10ms(); //Step3: check RTE ports of Hss actual AL_UNITTEST_CHECK(Rte_GaappaseCtrlHssStatusError0_sVal_ctasCtrlHss[0].eStatOn, aTestSteps[nStep].CheckValues.ucStatOn[0], == ); AL_UNITTEST_CHECK(Rte_GaappaseCtrlHssStatusError0_sVal_ctasCtrlHss[1].eStatOn, aTestSteps[nStep].CheckValues.ucStatOn[1], == ); AL_UNITTEST_CHECK(Rte_GaappaseCtrlHssStatusError0_sVal_ctasCtrlHss[2].eStatOn, aTestSteps[nStep].CheckValues.ucStatOn[2], == ); AL_UNITTEST_CHECK(Rte_GaappaseCtrlHssStatusError0_sVal_ctasCtrlHss[0].eErrShortToGnd, aTestSteps[nStep].CheckValues.ucErrShortToGnd[0], == ); AL_UNITTEST_CHECK(Rte_GaappaseCtrlHssStatusError0_sVal_ctasCtrlHss[1].eErrShortToGnd, aTestSteps[nStep].CheckValues.ucErrShortToGnd[1], == ); AL_UNITTEST_CHECK(Rte_GaappaseCtrlHssStatusError0_sVal_ctasCtrlHss[2].eErrShortToGnd, aTestSteps[nStep].CheckValues.ucErrShortToGnd[2], == ); AL_UNITTEST_CHECK(Rte_GaappaseCtrlHssStatusError0_sVal_ctasCtrlHss[0].eErrShortToVBat, aTestSteps[nStep].CheckValues.ucErrShortToVbat[0], == ); AL_UNITTEST_CHECK(Rte_GaappaseCtrlHssStatusError0_sVal_ctasCtrlHss[1].eErrShortToVBat, aTestSteps[nStep].CheckValues.ucErrShortToVbat[1], == ); AL_UNITTEST_CHECK(Rte_GaappaseCtrlHssStatusError0_sVal_ctasCtrlHss[2].eErrShortToVBat, aTestSteps[nStep].CheckValues.ucErrShortToVbat[2], == ); AL_UNITTEST_CHECK(Rte_GaappaseCtrlHssStatusError0_sVal_ctasCtrlHss[0].eErrOpenLoad, aTestSteps[nStep].CheckValues.ucErrOpenload[0], == ); AL_UNITTEST_CHECK(Rte_GaappaseCtrlHssStatusError0_sVal_ctasCtrlHss[1].eErrOpenLoad, aTestSteps[nStep].CheckValues.ucErrOpenload[1], == ); AL_UNITTEST_CHECK(Rte_GaappaseCtrlHssStatusError0_sVal_ctasCtrlHss[2].eErrOpenLoad, aTestSteps[nStep].CheckValues.ucErrOpenload[2], == ); } } ////----------------------------------------------------------------------------- ///// \Test Case : Mt_CtrlHss10ms_CalculateCurrent ///// ///// \Test Case Description ///// - Test subject: ///// Check the CtrlHss_Cycle10ms() with the expected values. ///// ///// - Test Design Technique: DT (Decision Table) ///// The Decision Table asTestCaseData[] is used in this test case. This DT contains all possible values of all inputs ///// which are taken into account by the algorithm of the FUT, as well as the expected values of all outputs which are ///// set by the FUT. Every DT-entry represents a different Test Case interaction. ///// - DT-Info: ///// - Inputs: ///// - aulHssSense[3]: HssSense Value from IoHwAbUser ///// - Outputs: ///// - aulRteHssSense[3]: HssSense Value on RTE port ///// ///// - Preconditions: EftCrcStatus is valid. All Hss is avaiable. ///// ///// - Expected test results: ///// - All conditions and assigned values of the DT need to be reached and passed. ///// ////----------------------------------------------------------------------------- //void Mt_CtrlHss10ms_CalculateCurrent(void) //{ // // test step // int nStep; // // typedef struct // { // uint32 aulHssSense[3]; // } tSetValues_FixData; // // typedef struct // { // uint32 aulRteHssSense[3]; // }tCheckValues_FixData; // // typedef struct // { // tSetValues_FixData SetValues; // tCheckValues_FixData CheckValues; // } tUtCtrlHss_TestSteps_FixData; // // static const tUtCtrlHss_TestSteps_FixData aTestSteps[] = // { // Intputs || Outputs // // ulHssSense ; || aulRteHssSense // /* 0 */{ { { 200, 3500 , 500 } },{ { 162, 2838 , 810 } } }, // }; // // const int nNrSteps = sizeof(aTestSteps) / sizeof(tUtCtrlHss_TestSteps_FixData); // // for (nStep = 0; nStep < nNrSteps; nStep++) // { // // initialze the static variables // Mt_Initialisation(); // // //Step1: Rte_GaappIoHwAbUserHssSense0_ulActual_ctaaCtrlHss[] with set values in test steps // Rte_GaappIoHwAbUserHssSense0_ulActual_ctaaCtrlHss[0] = aTestSteps[nStep].SetValues.aulHssSense[0]; // Rte_GaappIoHwAbUserHssSense0_ulActual_ctaaCtrlHss[1] = aTestSteps[nStep].SetValues.aulHssSense[1]; // Rte_GaappIoHwAbUserHssSense0_ulActual_ctaaCtrlHss[2] = aTestSteps[nStep].SetValues.aulHssSense[2]; // // // Step2: call function // CtrlHss_Cycle10ms(); // // // Step3: check static Variables // // AL_UNITTEST_CHECK(Rte_GaappCtrlHssStatusError0_sVal_ctaaCtrlHss[0].unStatCurrent, aTestSteps[nStep].CheckValues.aulRteHssSense[0], == ); // AL_UNITTEST_CHECK(Rte_GaappCtrlHssStatusError0_sVal_ctaaCtrlHss[1].unStatCurrent, aTestSteps[nStep].CheckValues.aulRteHssSense[1], == ); // AL_UNITTEST_CHECK(Rte_GaappCtrlHssStatusError0_sVal_ctaaCtrlHss[2].unStatCurrent, aTestSteps[nStep].CheckValues.aulRteHssSense[2], == ); // } //} // //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlHss_OperateOutputWithVoltState /// /// \Test Case Description /// - Test subject: /// /// - Test Design Technique: DT (Decision Table) /// The Decision Table asTestCaseData[] is used in this test case. This DT contains all possible values of all inputs /// which are taken into account by the algorithm of the FUT, as well as the expected values of all outputs which are /// set by the FUT. Every DT-entry represents a different Test Case interaction. /// - DT-Info: /// - Inputs: /// - ucIndex: channel of the Hss-output, 1: HSS1, 2:HSS2, 3:HSS3 /// - ucPrevHssState: the previous state of HSS actual state /// - ucHssTarget: the state of HSS target /// - ucErrStateShort2GND:the error state of short to GND /// - boSwitchOn: the voltage state of Switch ON /// - boRemainOn: the voltage state of Remain ON /// - Outputs: /// - boSwiTarget: the state of Target on SysMon/CddSwi /// - ucHssActualState: the actual state of HSS /// /// - Preconditions: None /// /// - Expected test results: /// - All conditions and assigned values of the DT need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_CtrlHss_OperateOutputWithVoltState(void) { //test step int nStep; typedef struct { uint8 ucIndex; uint8 ucPrevHssState; uint8 ucHssTarget; uint8 ucErrStateShort2GND; boolean boSwitchOn; boolean boRemainOn; } tSetValues_FixData; typedef struct { boolean boSwiTarget; boolean boHssActualState; }tCheckValues_FixData; typedef struct { tSetValues_FixData SetValues; tCheckValues_FixData CheckValues; } tUtCtrlHss_TestSteps_FixData; static const tUtCtrlHss_TestSteps_FixData aTestSteps[] = { // Intputs || Outputs // ucIndex, ucPrevHssState, ucHssTarget, ucErrStateShort2GND, boSwitchOn, boRemainOn || boSwiTarget, boHssActualState /* 0 */{ { 0, 0, 1, ERR_NO, TRUE, TRUE },{ TRUE, TRUE } }, /* 1 */{ { 0, 1, 1, ERR_NO, FALSE, TRUE },{ TRUE, TRUE } }, /* 2 */{ { 0, 1, 1, ERR_NO, FALSE, FALSE },{ FALSE, FALSE} }, /* 3 */{ { 0, 0, 1, ERR_NO, FALSE, TRUE },{ FALSE, FALSE} }, /* 4 */{ { 0, 0, 1, ERR_NO, TRUE, TRUE },{ TRUE, TRUE } }, /* 5 */{ { 0, 0, 0, ERR_NO, TRUE, TRUE },{ FALSE, FALSE} }, /* 6 */{ { 0, 1, 0, ERR_NO, TRUE, TRUE },{ FALSE, FALSE} }, /* 7 */{ { 1, 0, 1, ERR_YES, TRUE, TRUE },{ TRUE, TRUE } }, /* 8 */{ { 1, 0, 1, ERR_NO, TRUE, TRUE },{ TRUE, TRUE } }, /* 9 */{ { 1, 1, 0, ERR_NO, TRUE, TRUE },{ FALSE, FALSE } }, /*10 */{ { 1, 0, 0, ERR_NO, TRUE, TRUE },{ FALSE, FALSE } }, }; const int nNrSteps = sizeof(aTestSteps) / sizeof(tUtCtrlHss_TestSteps_FixData); Mt_Initialisation(); for (nStep = 0; nStep < nNrSteps; nStep++) { uint8 ucSetIndex, ucCheckIndex; // Step1: set the channel ucSetIndex = aTestSteps[nStep].SetValues.ucIndex; CtrlHss_sState.aboHssPreviousState[ucSetIndex] = aTestSteps[nStep].SetValues.ucPrevHssState; CtrlHss_sState.aboHssTargetState[ucSetIndex] = aTestSteps[nStep].SetValues.ucHssTarget; //CtrlHss_aucErrorStates[ucSetIndex][ErrorType_ShortToGnd]= aTestSteps[nStep].SetValues.ucErrStateShort2GND; CtrlHss_sVoltState.boSwitchOn[ucSetIndex] = aTestSteps[nStep].SetValues.boSwitchOn; CtrlHss_sVoltState.boRemainOn[ucSetIndex] = aTestSteps[nStep].SetValues.boRemainOn; CtrlHss_sState.aboHssSwitchOnDelay[ucSetIndex] = FALSE; // Step2: call function CtrlHss_OperateOutputWithVoltState(ucSetIndex); //Step3: check the static variable CtrlHss_aboCddSwiTarget, CtrlHss_sState.aboHssActualState AL_UNITTEST_CHECK(CtrlHss_aboCddSwiTarget[ucSetIndex], aTestSteps[nStep].CheckValues.boSwiTarget, == ); AL_UNITTEST_CHECK(CtrlHss_sState.aboHssActualState[ucSetIndex], aTestSteps[nStep].CheckValues.boHssActualState, == ); } } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlHss_OperateOutputWithVoltState_Short2GNDError /// /// \Test Case Description /// - Test subject: /// /// - Test Design Technique: DT (Decision Table) /// The Decision Table asTestCaseData[] is used in this test case. This DT contains all possible values of all inputs /// which are taken into account by the algorithm of the FUT, as well as the expected values of all outputs which are /// set by the FUT. Every DT-entry represents a different Test Case interaction. /// - DT-Info: /// - Inputs: /// - ucIndex: channel of the Hss-output, 1: HSS1, 2:HSS2, 3:HSS3 /// - boPrevTargetState: the previous target state of HSS /// - boHssPreviousState: the previous actual state of HSS /// - ucHssTarget: the state of HSS target /// - ucErrStateShort2GND:the error state of short to GND /// - ucDelayErrorDetectionTimer: timer for error detction delay /// - boHssShort2GNDDetected: the state of short to GND error detection /// - boHssNewRequest: flag for a new request /// - Outputs: /// - ucDelayErrorDetectionTimer: timer for error detction delay /// - boHssShort2GNDDetected: the state of short to GND error detection /// - boHssNewRequest: flag for a new request /// - ucIoHwAbUserTarget: the state of Target on IoHwAbUser /// - ucHssActualState: the actual state of HSS /// /// - Preconditions: None /// /// - Expected test results: /// - All conditions and assigned values of the DT need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_CtrlHss_OperateOutputWithVoltState_Short2GNDError(void) { //test step int nStep; typedef struct { uint8 ucIndex; boolean boPrevTargetState; boolean boHssPreviousState; uint8 ucHssTarget; uint8 ucErrStateShort2GND; uint8 ucDelayErrorDetectionTimer; boolean boHssShort2GNDDetected; boolean boHssNewRequest; } tSetValues_FixData; typedef struct { uint8 ucDelayErrorDetectionTimer; boolean boHssShort2GNDDetected; boolean boHssNewRequest; boolean boCddSwiTarget; boolean boHssActualState; }tCheckValues_FixData; typedef struct { tSetValues_FixData SetValues; tCheckValues_FixData CheckValues; } tUtCtrlHss_TestSteps_FixData; static const tUtCtrlHss_TestSteps_FixData aTestSteps[] = { // Intputs || Outputs // ucIndex, boPrevTargetState, boHssPreviousState, ucHssTarget, ucErrStateShort2GND, ucDelayErrorDetectionTimer, boHssShort2GNDDetected, boHssNewRequest || ucDelayErrorDetectionTimer, boHssShort2GNDDetected, boHssNewRequest, boCddSwiTarget, boHssActualState ///--------------------------------------------------------- Case: No Error --> Short to GND Error was detected--------------------------------------------------------------------------------------------------------------------------------------------------------- /* 0 */{ { 0, 0, 0, 0, ERR_NO, 0, FALSE, FALSE },{ 0, FALSE, FALSE, FALSE , FALSE} }, /* 1 */{ { 0, 0, 0, 1, ERR_NO, 0, FALSE, FALSE },{ 0, FALSE, FALSE, TRUE , TRUE} }, /* 2 */{ { 0, 1, 1, 1, ERR_NO, 2, FALSE, FALSE },{ 1, FALSE, FALSE, TRUE , TRUE} }, /* 3 */{ { 0, 1, 1, 1, ERR_NO, 1, FALSE, FALSE },{ 0, FALSE, FALSE, TRUE , TRUE} }, /* 4 */{ { 0, 1, 1, 1, ERR_YES, 0, FALSE, FALSE },{ 0, TRUE, FALSE, FALSE , FALSE} }, ///--------------------------------------------------------- Case: Short to GND Error was detected --> No Error ------------------------------------------------------------------------------------------------------------------------------------------------------ /* 5 */{ { 0, 0, 0, 0, ERR_SNA, 0, FALSE, FALSE },{ 0, FALSE, FALSE, FALSE , FALSE} }, /* 6 */{ { 0, 0, 0, 1, ERR_SNA, 0, FALSE, FALSE },{ 0, FALSE, FALSE, TRUE , TRUE} }, /* 7 */{ { 0, 1, 1, 1, ERR_YES, 0, FALSE, FALSE },{ 0, TRUE, FALSE, FALSE , FALSE} }, /* 8 */{ { 0, 1, 1, 1, ERR_SNA, 0, TRUE, FALSE },{ 0, TRUE, FALSE, FALSE , FALSE} }, /* 9 */{ { 0, 1, 0, 1, ERR_SNA, 0, TRUE, FALSE },{ 0, TRUE, FALSE, FALSE , FALSE} }, /*10 */{ { 0, 0, 0, 1, ERR_SNA, 0, TRUE, FALSE },{ 0, FALSE, FALSE, TRUE , TRUE} }, ///--------------------------------------------------------- Case: Short to GND Error was detected --> Error is still there ------------------------------------------------------------------------------------------------------------------------------------------ /*11 */{ { 0, 1, 1, 1, ERR_YES, 0, TRUE, FALSE },{ 0, TRUE, FALSE, FALSE , FALSE} }, // /*12 */{ { 0, 1, 1, 0, ERR_SNA, 0, TRUE, FALSE },{ 0, TRUE, FALSE, FALSE , FALSE} }, // /*13 */{ { 0, 1, 1, 1, ERR_YES, 0, TRUE, 0 },{ 1, TRUE, 0, TRUE , TRUE} }, // /*13 */{ { 0, 1, 1, ERR_YES, 1, TRUE, 0 },{ 0, TRUE, 59, TRUE , TRUE} }, // /*14 */{ { 0, 1, 1, ERR_YES, 0, TRUE, 1 },{ 0, FALSE, 0, FALSE , FALSE} }, }; const int nNrSteps = sizeof(aTestSteps) / sizeof(tUtCtrlHss_TestSteps_FixData); Mt_Initialisation(); for (nStep = 0; nStep < nNrSteps; nStep++) { uint8 ucSetIndex = 0u; uint8 ucCheckIndex = 0u; CtrlHss_sState.aboHssSwitchOnDelay[ucSetIndex] = FALSE; CtrlHss_sState.aboHssStateChangedDiagDisabled[ucSetIndex] = FALSE; CtrlHss_sVoltState.boSwitchOn[ucSetIndex] = TRUE; CtrlHss_sVoltState.boRemainOn[ucSetIndex] = TRUE; // Step1: set the channel ucSetIndex = aTestSteps[nStep].SetValues.ucIndex; CtrlHss_sState.aboHssPreviousState[ucSetIndex] = aTestSteps[nStep].SetValues.boHssPreviousState; CtrlHss_sState.aboPreTargestState[ucSetIndex] = aTestSteps[nStep].SetValues.boPrevTargetState; CtrlHss_sState.aboHssTargetState[ucSetIndex] = aTestSteps[nStep].SetValues.ucHssTarget; CtrlHss_sErrState.ucErrShortToGnd[ucSetIndex] = aTestSteps[nStep].SetValues.ucErrStateShort2GND; CtrlHss_ucDelayErrorDetectionTimer[ucSetIndex] = aTestSteps[nStep].SetValues.ucDelayErrorDetectionTimer; CtrlHss_sState.aboHssShort2GNDDetected[ucSetIndex] = aTestSteps[nStep].SetValues.boHssShort2GNDDetected; CtrlHss_sState.aboHssNewRequest[ucSetIndex] = aTestSteps[nStep].SetValues.boHssNewRequest; // Step2: call function CtrlHss_OperateOutputWithVoltState(ucSetIndex); //Step3: check the static variable CtrlHss_aboCddSwiTarget, CtrlHss_sState.aboHssActualState AL_UNITTEST_CHECK(CtrlHss_aboCddSwiTarget[ucSetIndex], aTestSteps[nStep].CheckValues.boCddSwiTarget, == ); AL_UNITTEST_CHECK(CtrlHss_sState.aboHssActualState[ucSetIndex], aTestSteps[nStep].CheckValues.boHssActualState, == ); AL_UNITTEST_CHECK(CtrlHss_sState.aboHssShort2GNDDetected[ucSetIndex], aTestSteps[nStep].CheckValues.boHssShort2GNDDetected, == ); AL_UNITTEST_CHECK(CtrlHss_sState.aboHssNewRequest[ucSetIndex], aTestSteps[nStep].CheckValues.boHssNewRequest, == ); } } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlHss_SwitchONtoOFF_DiagnoseDelay /// /// \Test Case Description /// - Test subject: /// /// - Test Design Technique: DT (Decision Table) /// The Decision Table asTestCaseData[] is used in this test case. This DT contains all possible values of all inputs /// which are taken into account by the algorithm of the FUT, as well as the expected values of all outputs which are /// set by the FUT. Every DT-entry represents a different Test Case interaction. /// - DT-Info: /// - Inputs: /// - ucIndex: channel of the Hss-output, 1: HSS1, 2:HSS2, 3:HSS3 /// - ucPrevHssState: the previous state of HSS actual state /// - ucHssTarget: the state of HSS target /// - ucCycle: the cycle numbers of the call /// - Outputs: /// - boDiagDisabled: the state of diagnose disabled: TRUE: Disabled, FALSE: Enabled /// - ucDelayTimer: the value of the CtrlHss_ucDelayErrorDetectionTimer /// /// - Preconditions: None /// /// - Expected test results: /// - All conditions and assigned values of the DT need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_CtrlHss_SwitchONtoOFF_DiagnoseDelay(void) { //test step int nStep; typedef struct { uint8 ucIndex; uint8 ucPrevHssState; uint8 ucHssTarget; uint8 ucCycle; } tSetValues_FixData; typedef struct { boolean boDiagDisabled; uint8 ucDelayTimer; }tCheckValues_FixData; typedef struct { tSetValues_FixData SetValues; tCheckValues_FixData CheckValues; } tUtCtrlHss_TestSteps_FixData; static const tUtCtrlHss_TestSteps_FixData aTestSteps[] = { // Intputs || Outputs // ucIndex, ucPrevHssState, ucHssTarget, ucCycle || boDiagDisabled, ucDelayTimer /* 0 */{ { 0, 0, 1, 1 },{ TRUE, 50 } }, /* 1 */{ { 0, 1, 1, 1 },{ TRUE, 49 } }, /* 2 */{ { 0, 1, 0, 1 },{ TRUE, 100 } }, /* 3 */{ { 0, 0, 0, 50 },{ TRUE, 50 } }, /* 4 */{ { 0, 0, 0, 50 },{ FALSE, 0 } }, /* 5 */{ { 0, 0, 0, 1 },{ FALSE, 0 } }, }; const int nNrSteps = sizeof(aTestSteps) / sizeof(tUtCtrlHss_TestSteps_FixData); Mt_Initialisation(); for (nStep = 0; nStep < nNrSteps; nStep++) { uint8 ucSetIndex, ucCheckIndex; // Step1: set the channel ucSetIndex = aTestSteps[nStep].SetValues.ucIndex; CtrlHss_sState.aboHssPreviousState[ucSetIndex] = aTestSteps[nStep].SetValues.ucPrevHssState; CtrlHss_sState.aboHssTargetState[ucSetIndex] = aTestSteps[nStep].SetValues.ucHssTarget; // Step2: call function for (uint8 i = 0; i < aTestSteps[nStep].SetValues.ucCycle; i++) { CtrlHss_OperateOutputWithVoltState(ucSetIndex); } //Step3: check the static variable: CtrlHss_sState.aboHssON2OFFDiagDisabled. CtrlHss_ucDelayErrorDetectionTimer AL_UNITTEST_CHECK(CtrlHss_sState.aboHssStateChangedDiagDisabled[ucSetIndex], aTestSteps[nStep].CheckValues.boDiagDisabled, == ); AL_UNITTEST_CHECK(CtrlHss_ucDelayErrorDetectionTimer[ucSetIndex], aTestSteps[nStep].CheckValues.ucDelayTimer, == ); } } //----------------------------------------------------------------------------- /// \Test Case : Mt_roCtrlHssExtTakeoverSwitchHssOutputChannel0Start /// /// \Test Case Description /// - Test subject: /// /// - Test Design Technique: DT (Decision Table) /// The Decision Table asTestCaseData[] is used in this test case. This DT contains all possible values of all inputs /// which are taken into account by the algorithm of the FUT, as well as the expected values of all outputs which are /// set by the FUT. Every DT-entry represents a different Test Case interaction. /// - DT-Info: /// - Inputs: /// - ucIndex: channel of the Hss-output, 1: HSS1, 2:HSS2, 3:HSS3 /// - ucOutput: 0: switch off, 1: switch on /// - Outputs: /// - ucIndex: channel of the Hss-output, 0: HSS1, 1:HSS2, 2:HSS3 /// - ucDiagMode: state of external over 0: eDiagCtrl_CtrlHss_Disabled, 1: eDiagCtrl_CtrlHss_Enabled on /// - ucDiagOutput: output of external over 0: switch off, 1: switch on /// /// - Preconditions: None /// /// - Expected test results: /// - All conditions and assigned values of the DT need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_roCtrlHssExtTakeoverSwitchHssOutputChannel0Start(void) { //test step int nStep; typedef struct { uint8 ucIndex; uint8 ucOutput; } tSetValues_FixData; typedef struct { uint8 ucIndex; uint8 ucDiagMode; uint8 ucDiagOutput; }tCheckValues_FixData; typedef struct { tSetValues_FixData SetValues; tCheckValues_FixData CheckValues; } tUtCtrlHss_TestSteps_FixData; static const tUtCtrlHss_TestSteps_FixData aTestSteps[] = { // Intputs || Outputs // ucIndex, ucOutput || ucIndex, ucDiagMode, ucDiagOutput /* 0 */{ { 2, 0 },{ 1, 1, 0 } }, /* 1 */{ { 1, 1 },{ 0, 1, 1 } }, /* 2 */{ { 3, 1 },{ 2, 1, 1 } }, /* 3 */{ { 0, 0 },{ 0, 1, 0 } }, }; const int nNrSteps = sizeof(aTestSteps) / sizeof(tUtCtrlHss_TestSteps_FixData); Mt_Initialisation(); for (nStep = 0; nStep < nNrSteps; nStep++) { uint8 ucSetIndex, ucCheckIndex; // Step1: set the channel ucSetIndex = aTestSteps[nStep].SetValues.ucIndex; // Step2: call function roCtrlHssExtTakeoverSwitchHssOutputChannel0Start(ucSetIndex, aTestSteps[nStep].SetValues.ucOutput); //Step3: check the static variable CtrlHss_sDiagControl ucCheckIndex = aTestSteps[nStep].CheckValues.ucIndex; AL_UNITTEST_CHECK(CtrlHss_sDiagControl.teMode[ucCheckIndex], aTestSteps[nStep].CheckValues.ucDiagMode, == ); AL_UNITTEST_CHECK(CtrlHss_sDiagControl.ucHssOutput[ucCheckIndex], aTestSteps[nStep].CheckValues.ucDiagOutput, == ); } roCtrlHssExtTakeoverSwitchHssOutputChannel0Start(4, 0); //CtrlHss_ExtTakeoverSwitchHssOutputChannel0Start(4, 0); } //----------------------------------------------------------------------------- /// \Test Case : Mt_roCtrlHssExtTakeoverSwitchHssOutputChannel0Stop /// /// \Test Case Description /// - Test subject: /// /// - Test Design Technique: DT (Decision Table) /// The Decision Table asTestCaseData[] is used in this test case. This DT contains all possible values of all inputs /// which are taken into account by the algorithm of the FUT, as well as the expected values of all outputs which are /// set by the FUT. Every DT-entry represents a different Test Case interaction. /// - DT-Info: /// - Inputs: /// - ucIndex: channel of the Hss-output, 1: HSS1, 2:HSS2, 3:HSS3 /// - ucDiagMode: state of external over 0: eDiagCtrl_CtrlHss_Disabled, 1: eDiagCtrl_CtrlHss_Enabled on /// - ucDiagOutput: output of external over 0: switch off, 1: switch on /// - Outputs: /// - ucDiagMode: state of external over 0: eDiagCtrl_CtrlHss_Disabled, 1: eDiagCtrl_CtrlHss_Enabled on /// /// - Preconditions: none /// /// - Expected test results: /// - All conditions and assigned values of the DT need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_roCtrlHss_ExtTakeoverSwitchHssOutputChannel0Stop(void) { //test step int nStep; typedef struct { uint8 ucIndex; uint8 ucDiagMode; uint8 ucDiagOutput; } tSetValues_FixData; typedef struct { uint8 ucIndex; uint8 ucDiagMode; }tCheckValues_FixData; typedef struct { tSetValues_FixData SetValues; tCheckValues_FixData CheckValues; } tUtCtrlHss_TestSteps_FixData; static const tUtCtrlHss_TestSteps_FixData aTestSteps[] = { // Intputs || Outputs // ucIndex, ucDiagMode, ucDiagOutput || ucIndex, ucDiagMode /* 0 */{ { 2, 1, 0 },{ 1, 0 } }, /* 1 */{ { 1, 1, 1 },{ 0, 0 } }, /* 2 */{ { 3, 1, 1 },{ 2, 0 } }, /* 3 */{ { 0, 1, 1 },{ 0, 0 } } }; const int nNrSteps = sizeof(aTestSteps) / sizeof(tUtCtrlHss_TestSteps_FixData); Mt_Initialisation(); for (nStep = 0; nStep < nNrSteps; nStep++) { uint8 ucSetIndex, ucCheckIndex; // Step1: set the channel, set the static variable CtrlHss_sDiagControl ucSetIndex = aTestSteps[nStep].SetValues.ucIndex; CtrlHss_sDiagControl.teMode[ucSetIndex - 1] = aTestSteps[nStep].SetValues.ucDiagMode; CtrlHss_sDiagControl.ucHssOutput[ucSetIndex - 1] = aTestSteps[nStep].SetValues.ucDiagOutput; // Step2: call function roCtrlHssExtTakeoverSwitchHssOutputChannel0Stop(ucSetIndex); //Step3: check the static variable CtrlHss_sDiagControl ucCheckIndex = aTestSteps[nStep].CheckValues.ucIndex; AL_UNITTEST_CHECK(CtrlHss_sDiagControl.teMode[ucCheckIndex], aTestSteps[nStep].CheckValues.ucDiagMode, == ); } roCtrlHssExtTakeoverSwitchHssOutputChannel0Stop(4); //CtrlHss_ExtTakeoverSwitchHssOutputChannel0Stop(4); } //----------------------------------------------------------------------------- /// \Test Case : Mt_roCtrlHssGetOnTime /// /// \Test Case Description /// - Test subject: /// Call the function with channel number /// Get the statistic of on time /// /// - Test Design Technique: ET (Exploratory Testing) /// /// - Preconditions: none /// /// - Expected test results: /// - All conditions and assigned values in the step3 need to be reached and passed. /// //----------------------------------------------------------------------------- /* void Mt_roCtrlHssGetOnTime(void) { tiu32TimeDiff_us ulOntime_HSS1; tiu32TimeDiff_us ulOntime_HSS2; tiu32TimeDiff_us ulOntime_HSS3; // Step1: set the static variable CtrlHss_sState.aboHssActualState CtrlHss_sState.aulHssStatisticOnTime[0] = 25000; CtrlHss_sState.aulHssStatisticOnTime[1] = 35000; CtrlHss_sState.aulHssStatisticOnTime[2] = 405000; // Step2: call function roCtrlHssGetOnTime(0, &ulOntime_HSS1); roCtrlHssGetOnTime(1, &ulOntime_HSS2); roCtrlHssGetOnTime(2, &ulOntime_HSS3); roCtrlHssGetOnTime(4, &ulOntime_HSS3); // invalid channel roCtrlHssGetOnTime(0, NULL_PTR); // NULL PTR // Step3: check the static variable CtrlHss_sState, CtrlHss_aboIoHwAbUserTarget AL_UNITTEST_CHECK(ulOntime_HSS1, 25000, == ); AL_UNITTEST_CHECK(ulOntime_HSS2, 35000, == ); AL_UNITTEST_CHECK(ulOntime_HSS3, 405000, == ); } */ //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlHss_SwitchOutput /// /// \Test Case Description /// - Test subject: /// Call the function with channel number and target state /// Check if the static variable is set correctly . /// /// - Test Design Technique: ET (Exploratory Testing) /// /// - Preconditions: none /// /// - Expected test results: /// - All conditions and assigned values in the step3 need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_CtrlHss_SwitchOutput(void) { uint8 i; // Initialize the static variables for unit tests. Mt_Initialisation(); // Step1: set the static variable CtrlHss_sState.aboHssActualState CtrlHss_sState.aboHssActualState[0] = 0; CtrlHss_sState.aboHssActualState[1] = 1; CtrlHss_sState.aboHssActualState[2] = 1; // Step2: call function CtrlHss_SwitchOutput(0, TRUE); CtrlHss_SwitchOutput(1, FALSE); CtrlHss_SwitchOutput(2, TRUE); // Step3: check the static variable CtrlHss_sState, CtrlHss_aboCddSwiTarget AL_UNITTEST_CHECK(CtrlHss_sState.aboHssPreviousState[0], 0, == ); AL_UNITTEST_CHECK(CtrlHss_aboCddSwiTarget[0], TRUE, == ); AL_UNITTEST_CHECK(CtrlHss_sState.aboHssActualState[0], TRUE, == ); AL_UNITTEST_CHECK(CtrlHss_sState.aboHssPreviousState[1], 1, == ); AL_UNITTEST_CHECK(CtrlHss_aboCddSwiTarget[1], FALSE, == ); AL_UNITTEST_CHECK(CtrlHss_sState.aboHssActualState[1], FALSE, == ); AL_UNITTEST_CHECK(CtrlHss_sState.aboHssPreviousState[2], TRUE, == ); AL_UNITTEST_CHECK(CtrlHss_aboCddSwiTarget[2], TRUE, == ); AL_UNITTEST_CHECK(CtrlHss_sState.aboHssActualState[2], TRUE, == ); } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlHss_RestartMlcSupply /// /// \Test Case Description /// - Test subject: /// Call the function with channel number and target state /// Check if the static variable is set correctly . /// /// - Test Design Technique: ET (Exploratory Testing) /// /// - Preconditions: none /// /// - Expected test results: /// - All conditions and assigned values in the step3 need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_CtrlHss_RestartMlcSupply(void) { CtrlHss_boMlcSupplyRestart = FALSE; roCtrlHssRestartMlcSupply(); AL_UNITTEST_CHECK(CtrlHss_boMlcSupplyRestart, TRUE, == ); } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlHss_CheckDelaySwitchOnTimer /// /// \Test Case Description /// - Test subject: /// /// - Test Design Technique: DT (Decision Table) /// The Decision Table asTestCaseData[] is used in this test case. This DT contains all possible values of all inputs /// which are taken into account by the algorithm of the FUT, as well as the expected values of all outputs which are /// set by the FUT. Every DT-entry represents a different Test Case interaction. /// - DT-Info: /// - Inputs: /// - ucIndex: channel of the Hss-output, 1: HSS1, 2:HSS2, 3:HSS3 /// - ucDelayTimer: Timer for Delay /// - ucCycle: The number of Cycles for calling the function /// - Outputs: /// - boSwitchOnDelay: status of switch on delay /// /// - Preconditions: none /// /// - Expected test results: /// - All conditions and assigned values of the DT need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_CtrlHss_CheckDelaySwitchOnTimer(void) { //test step int nStep; typedef struct { uint8 ucIndex; uint16 unDelayTimer; uint8 ucCycle; } tSetValues_FixData; typedef struct { boolean boSwitchOnDelay; }tCheckValues_FixData; typedef struct { tSetValues_FixData SetValues; tCheckValues_FixData CheckValues; } tUtCtrlHss_TestSteps_FixData; static const tUtCtrlHss_TestSteps_FixData aTestSteps[] = { // Intputs || Outputs // ucIndex, ucDelayTimer, ucCycle || boSwitchOnDelay /* 0 */{ { 0, 20, 10 }, { TRUE } }, /* 1 */{ { 1, 2, 2 }, { FALSE } }, /* 2 */{ { 2, 30, 29 }, { TRUE } }, }; const int nNrSteps = sizeof(aTestSteps) / sizeof(tUtCtrlHss_TestSteps_FixData); Mt_Initialisation(); for (nStep = 0; nStep < nNrSteps; nStep++) { uint8 ucSetIndex; // Step1: set tCtrlHss_ucFaultResetTimer ucSetIndex = aTestSteps[nStep].SetValues.ucIndex; CtrlHss_unDelaySwitchOnTimer[ucSetIndex] = aTestSteps[nStep].SetValues.unDelayTimer; CtrlHss_sState.aboHssSwitchOnDelay[ucSetIndex] = TRUE; // Step2: call function for (uint8 i = 0; i < aTestSteps[nStep].SetValues.ucCycle; i++) { CtrlHss_CheckDelaySwitchOnTimer(ucSetIndex); } //Step3: check the static variable CtrlHss_sDiagControl AL_UNITTEST_CHECK(CtrlHss_sState.aboHssSwitchOnDelay[ucSetIndex], aTestSteps[nStep].CheckValues.boSwitchOnDelay, == ); } } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlHss_DTCHandling /// /// \Test Case Description /// - Test subject: /// /// - Test Design Technique: DT (Decision Table) /// The Decision Table asTestCaseData[] is used in this test case. This DT contains all possible values of all inputs /// which are taken into account by the algorithm of the FUT, as well as the expected values of all outputs which are /// set by the FUT. Every DT-entry represents a different Test Case interaction. /// - DT-Info: /// - Inputs: /// - aucStatusError_HSS1: Error States of short to GND, short to VBAT and Openload /// - aucStatusError_HSS2: Error States of short to GND, short to VBAT and Openload /// - aucStatusError_HSS3: Error States of short to GND, short to VBAT and Openload /// - Outputs: /// - Dtc805a01_Status: State of DTC Dtc805a01 /// - Dtc805a02_Status: State of DTC Dtc805a02 /// - Dtc805a03_Status: State of DTC Dtc805a01 /// - Dtc8059f3_Status: State of DTC Dtc8059f3 /// /// - Preconditions: Target value is ON /// /// - Expected test results: /// - All conditions and assigned values of the DT need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_CtrlHss_DTCHandling(void) { //Dummy function CtrlHss_DTCHandling(); ////test step //int nStep; //typedef struct //{ // uint8 aucStatusError_HSS1[3]; // uint8 aucStatusError_HSS2[3]; // uint8 aucStatusError_HSS3[3]; //} tSetValues_FixData; //typedef struct //{ // Dem_EventStatusType Dtc805a01_Status; // DTC: HIGHSIDESWITCH_KURZSCHLUSS_NACH_KL31 // Dem_EventStatusType Dtc805a02_Status; // DTC: HIGHSIDESWITCH_OPENLOAD // Dem_EventStatusType Dtc805a03_Status; // DTC: SCHLEPPTROCKNER_DEFEKT // Dem_EventStatusType Dtc8059f3_Status; // DTC: LUEFTER_KURZSCHLUSS_NACH_KL31 //}tCheckValues_FixData; //typedef struct //{ // tSetValues_FixData SetValues; // tCheckValues_FixData CheckValues; //} tUtCtrlHss_TestSteps_FixData; //static const tUtCtrlHss_TestSteps_FixData aTestSteps[] = //{ // Intputs || Outputs // // aucStatusError ; || Dtc805a01_Status , Dtc805a02_Status, Dtc805a03_Status, Dtc8059f3_Status // /* 0 */{ { { ERR_NO, ERR_NO, ERR_NO }, { ERR_NO, ERR_NO, ERR_NO }, { ERR_NO, ERR_NO, ERR_NO } }, { DEM_EVENT_STATUS_PASSED, DEM_EVENT_STATUS_PASSED, DEM_EVENT_STATUS_PASSED, DEM_EVENT_STATUS_PASSED } }, // /* 1 */{ { { ERR_YES, ERR_NO, ERR_NO }, { ERR_NO, ERR_NO, ERR_NO }, { ERR_NO, ERR_NO, ERR_NO } } ,{ DEM_EVENT_STATUS_FAILED, DEM_EVENT_STATUS_PASSED, DEM_EVENT_STATUS_PASSED, DEM_EVENT_STATUS_FAILED } }, // /* 2 */{ { { ERR_NO, ERR_NO, ERR_NO }, { ERR_NO, ERR_NO, ERR_NO }, { ERR_NO, ERR_NO, ERR_YES } } ,{ DEM_EVENT_STATUS_PASSED, DEM_EVENT_STATUS_FAILED, DEM_EVENT_STATUS_FAILED, DEM_EVENT_STATUS_PASSED } }, // /* 3 */{ { { ERR_NO, ERR_NO, ERR_NO }, { ERR_NO, ERR_YES, ERR_NO }, { ERR_NO, ERR_NO, ERR_NO } } ,{ DEM_EVENT_STATUS_PASSED, DEM_EVENT_STATUS_PASSED, DEM_EVENT_STATUS_PASSED, DEM_EVENT_STATUS_PASSED } }, // /* 4 */{ { { ERR_NO, ERR_NO, ERR_NO }, { ERR_NO, ERR_NO, ERR_YES }, { ERR_NO, ERR_NO, ERR_YES } } ,{ DEM_EVENT_STATUS_PASSED, DEM_EVENT_STATUS_FAILED, DEM_EVENT_STATUS_FAILED, DEM_EVENT_STATUS_PASSED } }, // /* 5 */{ { { ERR_YES, ERR_NO, ERR_NO }, { ERR_YES, ERR_NO, ERR_NO }, { ERR_NO, ERR_NO, ERR_NO } } ,{ DEM_EVENT_STATUS_FAILED, DEM_EVENT_STATUS_PASSED, DEM_EVENT_STATUS_PASSED, DEM_EVENT_STATUS_FAILED } }, // /* 6 */{ { { ERR_NO, ERR_NO,ERR_YES }, { ERR_NO, ERR_NO, ERR_YES }, { ERR_NO, ERR_NO, ERR_NO } } ,{ DEM_EVENT_STATUS_PASSED, DEM_EVENT_STATUS_FAILED, DEM_EVENT_STATUS_PASSED, DEM_EVENT_STATUS_PASSED } }, //}; //const int nNrSteps = sizeof(aTestSteps) / sizeof(tUtCtrlHss_TestSteps_FixData); //Mt_Initialisation(); //for (nStep = 0; nStep < nNrSteps; nStep++) //{ // // Step1: set the static variable CtrlHss_aucErrorStates // CtrlHss_aucErrorStates[HSS1][ErrorType_ShortToGnd] = aTestSteps[nStep].SetValues.aucStatusError_HSS1[ErrorType_ShortToGnd]; // CtrlHss_aucErrorStates[HSS1][ErrorType_ShortToVbat] = aTestSteps[nStep].SetValues.aucStatusError_HSS1[ErrorType_ShortToVbat]; // CtrlHss_aucErrorStates[HSS1][ErrorType_OpenLoad] = aTestSteps[nStep].SetValues.aucStatusError_HSS1[ErrorType_OpenLoad]; // CtrlHss_aucErrorStates[HSS2][ErrorType_ShortToGnd] = aTestSteps[nStep].SetValues.aucStatusError_HSS2[ErrorType_ShortToGnd]; // CtrlHss_aucErrorStates[HSS2][ErrorType_ShortToVbat] = aTestSteps[nStep].SetValues.aucStatusError_HSS2[ErrorType_ShortToVbat]; // CtrlHss_aucErrorStates[HSS2][ErrorType_OpenLoad] = aTestSteps[nStep].SetValues.aucStatusError_HSS2[ErrorType_OpenLoad]; // CtrlHss_aucErrorStates[HSS3][ErrorType_ShortToGnd] = aTestSteps[nStep].SetValues.aucStatusError_HSS3[ErrorType_ShortToGnd]; // CtrlHss_aucErrorStates[HSS3][ErrorType_ShortToVbat] = aTestSteps[nStep].SetValues.aucStatusError_HSS3[ErrorType_ShortToVbat]; // CtrlHss_aucErrorStates[HSS3][ErrorType_OpenLoad] = aTestSteps[nStep].SetValues.aucStatusError_HSS3[ErrorType_OpenLoad]; // // Step2: call function // CtrlHss_DTCHandling(); // //Step3: check the static variable CtrlHss_sErrState // AL_UNITTEST_CHECK(Mt_Dtc805a01_EventStatus, aTestSteps[nStep].CheckValues.Dtc805a01_Status, == ); // AL_UNITTEST_CHECK(Mt_Dtc805a02_EventStatus, aTestSteps[nStep].CheckValues.Dtc805a02_Status, == ); // AL_UNITTEST_CHECK(Mt_Dtc805a03_EventStatus, aTestSteps[nStep].CheckValues.Dtc805a03_Status, == ); // AL_UNITTEST_CHECK(Mt_Dtc8059f3_EventStatus, aTestSteps[nStep].CheckValues.Dtc8059f3_Status, == ); //} } // ////----------------------------------------------------------------------------- ///// \Test Case : Mt_CtrlHss_Diag_SetCodingStatus ///// ///// \Test Case Description ///// - Test subject: ///// ///// - Test Design Technique: DT (Decision Table) ///// The Decision Table asTestCaseData[] is used in this test case. This DT contains all possible values of all inputs ///// which are taken into account by the algorithm of the FUT, as well as the expected values of all outputs which are ///// set by the FUT. Every DT-entry represents a different Test Case interaction. ///// - DT-Info: ///// - Inputs: ///// - boCodingStatus: Coding Status from RTE Port ///// - boIsCodingDataValid: Coding Data Status ///// - Outputs: ///// - boIsCodingDataValid_new: new Coding Data Status ///// ///// - Preconditions: none ///// ///// - Expected test results: ///// - All conditions and assigned values of the DT need to be reached and passed. ///// ////----------------------------------------------------------------------------- // void Mt_CtrlHss_Diag_SetCodingStatus(void) //{ // //test step // int nStep; // // typedef struct // { // boolean boCodingStatus; // boolean boIsCodingDataValid; // } tSetValues_FixData; // // typedef struct // { // boolean boIsCodingDataValid_new; // }tCheckValues_FixData; // // typedef struct // { // tSetValues_FixData SetValues; // tCheckValues_FixData CheckValues; // } tUtCtrlHss_TestSteps_FixData; // // static const tUtCtrlHss_TestSteps_FixData aTestSteps[] = // { // Intputs || Outputs // // boCodingStatus, boIsCodingDataValid || boIsCodingDataValid_new // /* 0 */{ { FALSE, FALSE } ,{ FALSE } }, // /* 1 */{ { TRUE, FALSE } ,{ TRUE } }, // /* 3 */{ { TRUE, TRUE } ,{ TRUE } }, // }; // // const int nNrSteps = sizeof(aTestSteps) / sizeof(tUtCtrlHss_TestSteps_FixData); // // Mt_Initialisation(); // // for (nStep = 0; nStep < nNrSteps; nStep++) // { // // Step1: set CtrlHss_Diag_boIsCodingDataValid // CtrlHss_Diag_boIsCodingDataValid = aTestSteps[nStep].SetValues.boIsCodingDataValid; // // // Step2: call function // CtrlHss_Diag_SetCodingStatus(aTestSteps[nStep].SetValues.boCodingStatus); // // //Step3: check the static variable CtrlHss_sDiagControl // AL_UNITTEST_CHECK(CtrlHss_Diag_boIsCodingDataValid, aTestSteps[nStep].CheckValues.boIsCodingDataValid_new, == ); // } //} // ////----------------------------------------------------------------------------- ///// \Test Case : Mt_CtrlHss_Diag_DataInit ///// ///// \Test Case Description ///// - Test subject: ///// ///// - Test Design Technique: DT (Decision Table) ///// The Decision Table asTestCaseData[] is used in this test case. This DT contains all possible values of all inputs ///// which are taken into account by the algorithm of the FUT, as well as the expected values of all outputs which are ///// set by the FUT. Every DT-entry represents a different Test Case interaction. ///// - DT-Info: ///// - Inputs: ///// - ShortToGND_Threshold: Threshold of short to GND ///// - ShortToVBAT_Threshold: Threshold of short to VBAT ///// - OpenLoad_Threshold: Threshold of openload ///// - debounce: debounce time ///// - Outputs: ///// - ShortToGND_Threshold: Threshold of short to GND ///// - ShortToVBAT_Threshold: Threshold of short to VBAT ///// - OpenLoad_Threshold: Threshold of openload ///// - debounce: debounce time ///// ///// - Preconditions: none ///// ///// - Expected test results: ///// - All conditions and assigned values of the DT need to be reached and passed. ///// ////----------------------------------------------------------------------------- // void Mt_CtrlHss_Diag_DataInit(void) //{ // //test step // int nStep; // // typedef struct // { // uint16 ShortToGND_Threshold[3]; // uint16 ShortToVBAT_Threshold[3]; // uint16 OpenLoad_Threshold[3]; // uint8 debounce; // boolean HwVar; // } tSetValues_FixData; // // typedef struct // { // uint16 ShortToGND_Threshold[3]; // uint16 ShortToVBAT_Threshold[3]; // uint16 OpenLoad_Threshold[3]; // uint8 debounce[3]; // }tCheckValues_FixData; // // typedef struct // { // tSetValues_FixData SetValues; // tCheckValues_FixData CheckValues; // } tUtCtrlHss_TestSteps_FixData; // // static const tUtCtrlHss_TestSteps_FixData aTestSteps[] = // { // Intputs || Outputs // // ShortToGND_Threshold, ShortToVBAT_Threshold, OpenLoad_Threshold, debounce , HwVar || ShortToGND_Threshold, ShortToVBAT_Threshold, OpenLoad_Threshold, debounce // /* 0 */{ { { 1390, 2740, 3330 },{ 1340, 1340, 1340 },{ 24, 24, 24 }, 0, FALSE } ,{ { 1390, 2740, 3330 },{ 1340, 1340, 1340 },{ 24, 24, 24 }, { 10, 10 , 10} } }, // /* 1 */{ { { 1390, 2740, 3330 },{ 1340, 1340, 1340 },{ 24, 24, 24 }, 0, TRUE } ,{ { 1390, 2740, 3330 },{ 1340, 1340, 1340 },{ 24, 24, 24 }, { 10, 10 , 10} } }, // /* 2 */{ { { 0, 1000, 4},{ 1230, 2000, 0 },{ 0, 24, 40 }, 60, FALSE } ,{ { 0, 1000, 4 },{ 1230, 2000, 0 },{ 0, 24, 40 }, { 20, 20 , 20} } }, // /* 3 */{ { { 900, 1000, 4},{ 0, 2000, 1200 },{ 16, 24, 0 }, 60, FALSE } ,{ { 900, 1000, 4 },{ 0, 2000, 1200 },{ 16, 24, 0 }, { 20, 20 , 20} } }, // /* 4 */{ { { 1200, 1000, 100},{ 0, 2000, 1200 },{ 16, 24, 0 }, 60, FALSE } ,{ { 1200, 1000, 100 },{ 0, 2000, 1200 },{ 16, 24, 0 }, { 20, 20 , 20} } }, // // }; // // // const int nNrSteps = sizeof(aTestSteps) / sizeof(tUtCtrlHss_TestSteps_FixData); // // // for (nStep = 0; nStep < nNrSteps; nStep++) // { // Mt_Initialisation(); // // // Step1: set Thresholds in coding data // Mt_HSS1_OPEN_LOAD_THRESHOLD = aTestSteps[nStep].SetValues.OpenLoad_Threshold[0]; // Mt_HSS2_OPEN_LOAD_THRESHOLD = aTestSteps[nStep].SetValues.OpenLoad_Threshold[1]; // Mt_HSS3_OPEN_LOAD_THRESHOLD = aTestSteps[nStep].SetValues.OpenLoad_Threshold[2]; // Mt_HSS1_SHORT_TO_GND_THRESHOLD = aTestSteps[nStep].SetValues.ShortToGND_Threshold[0]; // Mt_HSS2_SHORT_TO_GND_THRESHOLD = aTestSteps[nStep].SetValues.ShortToGND_Threshold[1]; // Mt_HSS3_SHORT_TO_GND_THRESHOLD = aTestSteps[nStep].SetValues.ShortToGND_Threshold[2]; // Mt_HSS1_SHORT_TO_UBAT_THRESHOLD = aTestSteps[nStep].SetValues.ShortToVBAT_Threshold[0]; // Mt_HSS2_SHORT_TO_UBAT_THRESHOLD = aTestSteps[nStep].SetValues.ShortToVBAT_Threshold[1]; // Mt_HSS3_SHORT_TO_UBAT_THRESHOLD = aTestSteps[nStep].SetValues.ShortToVBAT_Threshold[2]; // Mt_HSS_DIAG_DEBOUNCE = aTestSteps[nStep].SetValues.debounce; // // // Step2: call function // CtrlHss_Diag_SetHwVariant(aTestSteps[nStep].SetValues.HwVar); // CtrlHss_Diag_DataInit(); // // //Step3: check the static variable CtrlHss_aOpenLoadThreshold, CtrlHss_aShort2VbatThreshold, CtrlHss_aShort2GndThreshold // AL_UNITTEST_CHECK(CtrlHss_aOpenLoadThreshold[0], aTestSteps[nStep].CheckValues.OpenLoad_Threshold[0], == ); // AL_UNITTEST_CHECK(CtrlHss_aOpenLoadThreshold[1], aTestSteps[nStep].CheckValues.OpenLoad_Threshold[1], == ); // AL_UNITTEST_CHECK(CtrlHss_aOpenLoadThreshold[2], aTestSteps[nStep].CheckValues.OpenLoad_Threshold[2], == ); // AL_UNITTEST_CHECK(CtrlHss_aShort2VbatThreshold[0], aTestSteps[nStep].CheckValues.ShortToVBAT_Threshold[0], == ); // AL_UNITTEST_CHECK(CtrlHss_aShort2VbatThreshold[1], aTestSteps[nStep].CheckValues.ShortToVBAT_Threshold[1], == ); // AL_UNITTEST_CHECK(CtrlHss_aShort2VbatThreshold[2], aTestSteps[nStep].CheckValues.ShortToVBAT_Threshold[2], == ); // AL_UNITTEST_CHECK(CtrlHss_aShort2GndThreshold[0], aTestSteps[nStep].CheckValues.ShortToGND_Threshold[0], == ); // AL_UNITTEST_CHECK(CtrlHss_aShort2GndThreshold[1], aTestSteps[nStep].CheckValues.ShortToGND_Threshold[1], == ); // AL_UNITTEST_CHECK(CtrlHss_aShort2GndThreshold[2], aTestSteps[nStep].CheckValues.ShortToGND_Threshold[2], == ); // AL_UNITTEST_CHECK(CtrlHss_aErrorDebounce[0], aTestSteps[nStep].CheckValues.debounce[0], == ); // AL_UNITTEST_CHECK(CtrlHss_aErrorDebounce[1], aTestSteps[nStep].CheckValues.debounce[1], == ); // AL_UNITTEST_CHECK(CtrlHss_aErrorDebounce[2], aTestSteps[nStep].CheckValues.debounce[2], == ); // } //} //----------------------------------------------------------------------------- /// \Test Case : Mt_rdCtrlHssDeInit /// /// \Test Case Description /// - Test subject: /// Call the RTE runnable riCtrlHssDeInit(). /// No requirement for this release /// /// - Test Design Technique: ET (Exploratory Testing) /// /// - Preconditions: none /// /// - Expected test results: /// - No requirement for this release /// //----------------------------------------------------------------------------- void Mt_rdCtrlHssDeInit(void) { // Step1: // Step2: call function rdCtrlHssDeInit(); CtrlHss_DeInit(); // Step3: } void ALUnitTest_AddTests(void) { ALUnitTest_AddFunction("Mt_riCtrlHssInit_1", Mt_riCtrlHssInit_1); //ALUnitTest_AddFunction("Mt_riCtrlHssInit_2", Mt_riCtrlHssInit_2); ALUnitTest_AddFunction("Mt_riCtrlHssInit_3", Mt_riCtrlHssInit_3); ALUnitTest_AddFunction("Mt_CtrlHss_ReadRTEPorts", Mt_CtrlHss_ReadRTEPorts); ALUnitTest_AddFunction("Mt_CtrlHss_CheckExternalTakeover", Mt_CtrlHss_CheckExternalTakeover); ALUnitTest_AddFunction("Mt_CtrlHss_Diag_CheckAllErrors", Mt_CtrlHss_Diag_CheckAllErrors); ALUnitTest_AddFunction("Mt_CtrlHss_Diag_CheckShort2GndDuringOn", Mt_CtrlHss_Diag_CheckShort2GndDuringOn); ALUnitTest_AddFunction("Mt_CtrlHss_Diag_CheckOpenloadDuringOn", Mt_CtrlHss_Diag_CheckOpenloadDuringOn); ALUnitTest_AddFunction("Mt_CtrlHss_Diag_CheckShort2VbatDuringOff", Mt_CtrlHss_Diag_CheckShort2VbatDuringOff); ALUnitTest_AddFunction("Mt_CtrlHss_Diag_CheckShort2GndDuringOn_No_Monitoring", Mt_CtrlHss_Diag_CheckShort2GndDuringOn_No_Monitoring); //ALUnitTest_AddFunction("Mt_CtrlHss_Diag_CheckOpenloadDuringOn_No_Monitoring", Mt_CtrlHss_Diag_CheckOpenloadDuringOn_No_Monitoring); //ALUnitTest_AddFunction("Mt_CtrlHss_Diag_CheckShort2VbatDuringOff_No_Monitoring", Mt_CtrlHss_Diag_CheckShort2VbatDuringOff_No_Monitoring); ALUnitTest_AddFunction("Mt_rpCtrlHss10ms", Mt_rpCtrlHss10ms); ALUnitTest_AddFunction("Mt_CtrlHss10ms_DiagDisabled", Mt_CtrlHss10ms_DiagDisabled); //ALUnitTest_AddFunction("Mt_CtrlHss10ms_CalculateCurrent", Mt_CtrlHss10ms_CalculateCurrent); ALUnitTest_AddFunction("Mt_roCtrlHssExtTakeoverSwitchHssOutputChannel0Start", Mt_roCtrlHssExtTakeoverSwitchHssOutputChannel0Start); ALUnitTest_AddFunction("Mt_roCtrlHss_ExtTakeoverSwitchHssOutputChannel0Stop", Mt_roCtrlHss_ExtTakeoverSwitchHssOutputChannel0Stop); //ALUnitTest_AddFunction("Mt_roCtrlHssGetOnTime", Mt_roCtrlHssGetOnTime); ALUnitTest_AddFunction("Mt_CtrlHss_OperateOutputWithVoltState", Mt_CtrlHss_OperateOutputWithVoltState); ALUnitTest_AddFunction("Mt_CtrlHss_OperateOutputWithVoltState_Short2GNDError", Mt_CtrlHss_OperateOutputWithVoltState_Short2GNDError); ALUnitTest_AddFunction("Mt_CtrlHss_SwitchONtoOFF_DiagnoseDelay", Mt_CtrlHss_SwitchONtoOFF_DiagnoseDelay); ALUnitTest_AddFunction("Mt_CtrlHss_SwitchOutput", Mt_CtrlHss_SwitchOutput); ALUnitTest_AddFunction("Mt_CtrlHss_CheckDelaySwitchOnTimer", Mt_CtrlHss_CheckDelaySwitchOnTimer); ALUnitTest_AddFunction("Mt_CtrlHss_DTCHandling", Mt_CtrlHss_DTCHandling); //ALUnitTest_AddFunction("Mt_CtrlHss_Diag_SetCodingStatus", Mt_CtrlHss_Diag_SetCodingStatus); //ALUnitTest_AddFunction("Mt_CtrlHss_Diag_DataInit", Mt_CtrlHss_Diag_DataInit); ALUnitTest_AddFunction("Mt_CtrlHss_RestartMlcSupply", Mt_CtrlHss_RestartMlcSupply); ALUnitTest_AddFunction("Mt_rdCtrlHssDeInit", Mt_rdCtrlHssDeInit); }