//***************************************************************************** // (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 CddSwi /// /// \author /// mailTo: //----------------------------------------------------------------------------- #include "Mt_CddSwi/Test.h" #include "CddSwi/Api/CddSwi.h" #include "CddSwi/Bts72220/Api/CddBts72220.h" #include "CddSwi/Bts72220/Cfg/CddBts72220_Cfg.h" #include "CddSwi/Bts72220/Cfg/CddBts72220_MemMap.h" #include "CddSwi/Bts72220/Cfg/CddBts72220_Router.h" #include "CddSwi/Bts72220/Gen/CddBts72220_Types.h" #include "CddSwi/Cfg/CddSwi_Cfg.h" #include "CddSwi/Cfg/CddSwi_MemMap.h" #include "CddSwi/Cfg/CddSwi_Router.h" uint8 Mt_CddEft_CrcValid; Std_ReturnType Mt_CddSwi_ReturnValue = E_OK; Std_ReturnType Mt_Transmit_ReturnValue; uint16 Mt_ADC_Get_Value[18]; tRomPara_CodingArea applicationCodingData; tisCodingStatus Mt_CodingDataStatus; tisAllSwitchTarget Mt_TgtVal; tisAllSwitchStatus Mt_Status; extern uint16 usPreTgtVal[8]; extern boolean CddBts72220_boSleep; extern tisCddBts72220_States CddBts72220_States[CFG_CDDBTS72220_DRIVER_CNT][CFG_BTS72220_OUTPUTS_CNT]; extern uint16 CddBts72220_aOpenLoadThreshold[CFG_CDDBTS72220_DRIVER_CNT][CFG_BTS72220_OUTPUTS_CNT]; extern boolean CddBts72220_boCodMDataValid; extern tisEftStatus CddBts72220_boEftValid; extern uint8 CddBts72220_ClearLatchDelay[CFG_CDDBTS72220_DRIVER_CNT][CFG_BTS72220_OUTPUTS_CNT]; extern uint8 BTS72220_senseChannel_HSS[CFG_CDDBTS72220_DRIVER_CNT]; extern uint8 BTS72220_Pre_senseChannel_HSS[CFG_CDDBTS72220_DRIVER_CNT]; extern uint16 BTS72220_Sample_Complete[CFG_CDDBTS72220_DRIVER_CNT][CFG_BTS72220_OUTPUTS_CNT]; extern uint8 CddBts72220_WRNDIAG[CFG_CDDBTS72220_DRIVER_CNT]; extern uint8 CddBts72220_ERRDIAG[CFG_CDDBTS72220_DRIVER_CNT]; extern uint8 CddBts72220_STDDIAG[CFG_CDDBTS72220_DRIVER_CNT][CFG_BTS72220_OUTPUTS_CNT]; extern boolean CddBts72220_boClear_Latch[CFG_CDDBTS72220_DRIVER_CNT][CFG_BTS72220_OUTPUTS_CNT]; extern uint8 ClearParallelLatchCnt; uint8 CddEft_DataValid(void); Std_ReturnType IoHwAb_ADC_Get(uint8 index, uint16* data); Std_ReturnType IoHwAb_PWM_Set_DutyAndCyc(uint8 index, uint16 duty, uint32 cyc); Std_ReturnType IoHwAb_PWM_Control_Set(uint8 index, boolean data); Std_ReturnType Spi_SyncTransmit(const Spi_SequenceType Sequence); Std_ReturnType Spi_SetupEB(const Spi_ChannelType Channel, const Spi_DataBufferType* const SrcDataBufferPtr, const Spi_DataBufferType* const DesDataBufferPtr, const Spi_NumberOfDataType Length); FUNC(Std_ReturnType, RTE_CODE) Rte_Write_ctadCddSwi_PpaseCddSwiSwiStatus_sAllSwitchStatus(P2CONST(tisAllSwitchStatus, AUTOMATIC, RTE_CTADCDDSWI_APPL_DATA) data); FUNC(Std_ReturnType, RTE_CODE) Rte_Read_ctadCddSwi_PpareCodMCodingStatus_sCodingStatus(P2VAR(tisCodingStatus, AUTOMATIC, RTE_CTADCDDSWI_APPL_VAR) data); FUNC(Std_ReturnType, RTE_CODE) Rte_Read_ctadCddSwi_PpareCtrlSwiSwiTarget_sAllSwitchTarget(P2VAR(tisAllSwitchTarget, AUTOMATIC, RTE_CTADCDDSWI_APPL_VAR) data); uint8 CddEft_DataValid(void) { return Mt_CddEft_CrcValid; } Std_ReturnType IoHwAb_ADC_Get(uint8 index, uint16* data) { *data = Mt_ADC_Get_Value[index]; return Mt_CddSwi_ReturnValue; } Std_ReturnType IoHwAb_PWM_Set_DutyAndCyc(uint8 index, uint16 duty, uint32 cyc) { return Mt_CddSwi_ReturnValue; } Std_ReturnType IoHwAb_PWM_Control_Set(uint8 index, boolean data) { return Mt_CddSwi_ReturnValue; } Std_ReturnType Spi_SyncTransmit(const Spi_SequenceType Sequence) { return Mt_Transmit_ReturnValue; } Std_ReturnType Spi_SetupEB(const Spi_ChannelType Channel,const Spi_DataBufferType* const SrcDataBufferPtr,const Spi_DataBufferType* const DesDataBufferPtr,const Spi_NumberOfDataType Length) { return Mt_CddSwi_ReturnValue; } FUNC(Std_ReturnType, RTE_CODE) Rte_Write_ctadCddSwi_PpaseCddSwiSwiStatus_sAllSwitchStatus(P2CONST(tisAllSwitchStatus, AUTOMATIC, RTE_CTADCDDSWI_APPL_DATA) data) { Mt_Status = *data; return Mt_CddSwi_ReturnValue; } FUNC(Std_ReturnType, RTE_CODE) Rte_Read_ctadCddSwi_PpareCodMCodingStatus_sCodingStatus(P2VAR(tisCodingStatus, AUTOMATIC, RTE_CTADCDDSWI_APPL_VAR) data) { *data = Mt_CodingDataStatus; return Mt_CddSwi_ReturnValue; } FUNC(Std_ReturnType, RTE_CODE) Rte_Read_ctadCddSwi_PpareCtrlSwiSwiTarget_sAllSwitchTarget(P2VAR(tisAllSwitchTarget, AUTOMATIC, RTE_CTADCDDSWI_APPL_VAR) data) { *data = Mt_TgtVal; return Mt_CddSwi_ReturnValue; } //----------------------------------------------------------------------------- /// \Test Case : Mt_Rte_riCddSwiInit /// /// \Test Case Description /// - Test subject: /// /// /// - Test Design Technique: ET (Exploratory Testing) /// /// - Preconditions: /// /// - Expected test results: /// - All conditions and assigned values need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_Rte_riCddSwiInit(void) { //Step 1) Set pre - conditions for (uint8 i = 0; i < CFG_SWI_OUTPUTS_CNT; i++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT usPreTgtVal[i] = 1u; //Step 3) Call the FUT Rte_riCddSwiInit(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(usPreTgtVal[i], 0u, == ); } } //----------------------------------------------------------------------------- /// \Test Case : Mt_CddSwi_GetCodMDataStatus /// /// \Test Case Description /// - Test subject: /// /// /// - Test Design Technique: ET (Exploratory Testing) /// /// - Preconditions: /// /// - Expected test results: /// - All conditions and assigned values need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_CddSwi_GetCodMDataStatus(void) { //Step 1) Set pre - conditions boolean Mt_IsCodingValid; //Step 2) Assign all input values to the corresponding input variables identified in the FUT Mt_CodingDataStatus.eCodingStatus = 0u; //Step 3) Call the FUT Mt_IsCodingValid = CddSwi_GetCodMDataStatus(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(Mt_IsCodingValid, TRUE, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT Mt_CodingDataStatus.eCodingStatus = 1u; //Step 3) Call the FUT Mt_IsCodingValid = CddSwi_GetCodMDataStatus(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(Mt_IsCodingValid, FALSE, == ); } //----------------------------------------------------------------------------- /// \Test Case : Mt_Rte_rpCddSwi10ms /// /// \Test Case Description /// - Test subject: /// /// /// - Test Design Technique: ET (Exploratory Testing) /// /// - Preconditions: /// /// - Expected test results: /// - All conditions and assigned values need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_Rte_rpCddSwi10ms(void) { //Step 1) Set pre - conditions for (uint8 i = 0; i < CFG_SWI_OUTPUTS_CNT; i++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CddBts72220_boSleep = FALSE; usPreTgtVal[i] = 0u; Mt_TgtVal.aunTgtVal[i] = 1u; //Step 3) Call the FUT Rte_rpCddSwi10ms(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(usPreTgtVal[i], 1u, == ); } for (uint8 i = 0; i < CFG_SWI_OUTPUTS_CNT; i++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CddBts72220_boSleep = TRUE; usPreTgtVal[i] = 1u; //Step 3) Call the FUT Rte_rpCddSwi10ms(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(usPreTgtVal[i], 0u, == ); } } //----------------------------------------------------------------------------- /// \Test Case : Mt_RterdCddSwiDeInit /// /// \Test Case Description /// - Test subject: /// /// /// - Test Design Technique: ET (Exploratory Testing) /// /// - Preconditions: /// /// - Expected test results: /// - All conditions and assigned values need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_RterdCddSwiDeInit(void) { //Step 1) Set pre - conditions for (uint8 i = 0; i < CFG_SWI_OUTPUTS_CNT; i++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT usPreTgtVal[i] = 1u; //Step 3) Call the FUT RterdCddSwiDeInit(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(usPreTgtVal[i], 0u, == ); } } //----------------------------------------------------------------------------- /// \Test Case : Mt_CddSwi_SetSleep_mode /// /// \Test Case Description /// - Test subject: /// /// /// - Test Design Technique: ET (Exploratory Testing) /// /// - Preconditions: /// /// - Expected test results: /// - All conditions and assigned values need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_CddSwi_SetSleep_mode(void) { //Step 1) Set pre - conditions //Step 2) Assign all input values to the corresponding input variables identified in the FUT //Step 3) Call the FUT CddSwi_SetSleep_mode(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value } //----------------------------------------------------------------------------- /// \Test Case : Mt_CddBts72220_Init /// /// \Test Case Description /// - Test subject: /// /// /// - Test Design Technique: ET (Exploratory Testing) /// /// - Preconditions: /// /// - Expected test results: /// - All conditions and assigned values need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_CddBts72220_Init(void) { //Step 1) Set pre - conditions uint32 ulChipIdx = 0u; uint8 i = 0u; for (ulChipIdx = 0u; ulChipIdx < 2; ulChipIdx++) { for (i = 0u; i < CFG_BTS72220_OUTPUTS_CNT; i++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT Mt_CddEft_CrcValid = SIG_VALID; EftData.Eft_EcuVarCfg.Val.Hss_Chip[ulChipIdx].sCh[i].ucMount = 0u; //Step 3) Call the FUT CddBts72220_Init(ulChipIdx); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CddBts72220_States[ulChipIdx][i].eHwState, HSS_NOSUPPORT, == ); } } for (ulChipIdx = 0u; ulChipIdx < 2; ulChipIdx++) { for (i = 0u; i < CFG_BTS72220_OUTPUTS_CNT; i++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT Mt_CddEft_CrcValid = SIG_VALID; EftData.Eft_EcuVarCfg.Val.Hss_Chip[ulChipIdx].sCh[i].ucMount = 1u; //Step 3) Call the FUT CddBts72220_Init(ulChipIdx); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CddBts72220_States[ulChipIdx][i].eHwState, HSS_SUPPORT, == ); } } for (ulChipIdx = 0u; ulChipIdx < 2; ulChipIdx++) { for (i = 0u; i < CFG_BTS72220_OUTPUTS_CNT; i++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT Mt_CddEft_CrcValid = SIG_INVALID; Mt_CodingDataStatus.eCodingStatus = 0u; applicationCodingData.System.HSSSupportChannel.HSS_SPT_Ch[i] = 0u; applicationCodingData.System.HSSSupportChannel.HSS_SPT_Ch[i+4] = 0u; //Step 3) Call the FUT CddBts72220_Init(ulChipIdx); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CddBts72220_States[ulChipIdx][i].eHwState, HSS_NOSUPPORT, == ); AL_UNITTEST_CHECK(CddBts72220_States[ulChipIdx][i].eHwState, HSS_NOSUPPORT, == ); } } for (ulChipIdx = 0u; ulChipIdx < 2; ulChipIdx++) { for (i = 0u; i < CFG_BTS72220_OUTPUTS_CNT; i++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT Mt_CddEft_CrcValid = SIG_INVALID; Mt_CodingDataStatus.eCodingStatus = 0u; applicationCodingData.System.HSSSupportChannel.HSS_SPT_Ch[i] = 1u; applicationCodingData.System.HSSSupportChannel.HSS_SPT_Ch[i+4] = 1u; //Step 3) Call the FUT CddBts72220_Init(ulChipIdx); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CddBts72220_States[ulChipIdx][i].eHwState, HSS_SUPPORT, == ); AL_UNITTEST_CHECK(CddBts72220_States[ulChipIdx][i].eHwState, HSS_SUPPORT, == ); } } for (ulChipIdx = 0u; ulChipIdx < 2; ulChipIdx++) { for (i = 0u; i < CFG_BTS72220_OUTPUTS_CNT; i++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT Mt_CddEft_CrcValid = SIG_INVALID; Mt_CodingDataStatus.eCodingStatus = 1u; //Step 3) Call the FUT CddBts72220_Init(ulChipIdx); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CddBts72220_States[ulChipIdx][i].eHwState, HSS_NOEFT, == ); } } } //----------------------------------------------------------------------------- /// \Test Case : Mt_CddBts72220_GetCodingData /// /// \Test Case Description /// - Test subject: /// /// /// - Test Design Technique: ET (Exploratory Testing) /// /// - Preconditions: /// /// - Expected test results: /// - All conditions and assigned values need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_CddBts72220_GetCodingData(void) { //Step 1) Set pre - conditions //Step 2) Assign all input values to the corresponding input variables identified in the FUT applicationCodingData.System.HSSErrDetection.HSS_Open_Load_Value_mA = 1u; applicationCodingData.System.HSSErrDetection.HSS_Open_Load_Value_mA = 1u; applicationCodingData.System.HSSErrDetection.HSS_Open_Load_Value_mA = 1u; applicationCodingData.System.HSSErrDetection.HSS_Open_Load_Value_mA = 1u; applicationCodingData.System.HSSErrDetection.HSS_Open_Load_Value_mA = 1u; applicationCodingData.System.HSSErrDetection.HSS_Open_Load_Value_mA = 1u; applicationCodingData.System.HSSErrDetection.HSS_Open_Load_Value_mA = 1u; applicationCodingData.System.HSSErrDetection.HSS_Open_Load_Value_mA = 1u; //Step 3) Call the FUT CddBts72220_GetCodingData(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CddBts72220_aOpenLoadThreshold[0][0], 1u, == ); AL_UNITTEST_CHECK(CddBts72220_aOpenLoadThreshold[0][1], 1u, == ); AL_UNITTEST_CHECK(CddBts72220_aOpenLoadThreshold[0][2], 1u, == ); AL_UNITTEST_CHECK(CddBts72220_aOpenLoadThreshold[0][3], 1u, == ); AL_UNITTEST_CHECK(CddBts72220_aOpenLoadThreshold[1][0], 1u, == ); AL_UNITTEST_CHECK(CddBts72220_aOpenLoadThreshold[1][1], 1u, == ); AL_UNITTEST_CHECK(CddBts72220_aOpenLoadThreshold[1][2], 1u, == ); AL_UNITTEST_CHECK(CddBts72220_aOpenLoadThreshold[1][3], 1u, == ); } //----------------------------------------------------------------------------- /// \Test Case : Mt_CddBts72220_Cycle10ms /// /// \Test Case Description /// - Test subject: /// /// /// - Test Design Technique: ET (Exploratory Testing) /// /// - Preconditions: /// /// - Expected test results: /// - All conditions and assigned values need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_CddBts72220_Cycle10ms(void) { //Step 1) Set pre - conditions //Step 2) Assign all input values to the corresponding input variables identified in the FUT CddBts72220_boEftValid.eEftStatus = SIG_VALID; Mt_CodingDataStatus.eCodingStatus = 0u; CddBts72220_boCodMDataValid = FALSE; //Step 3) Call the FUT CddBts72220_Cycle10ms(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CddBts72220_boCodMDataValid, TRUE, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT CddBts72220_boEftValid.eEftStatus = SIG_INVALID; Mt_CodingDataStatus.eCodingStatus = 0u; CddBts72220_boCodMDataValid = FALSE; //Step 3) Call the FUT CddBts72220_Cycle10ms(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CddBts72220_boCodMDataValid, FALSE, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT CddBts72220_boEftValid.eEftStatus = SIG_VALID; Mt_CodingDataStatus.eCodingStatus = 1u; CddBts72220_boCodMDataValid = TRUE; //Step 3) Call the FUT CddBts72220_Cycle10ms(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CddBts72220_boCodMDataValid, FALSE, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT CddBts72220_boEftValid.eEftStatus = SIG_INVALID; Mt_CodingDataStatus.eCodingStatus = 1u; CddBts72220_boCodMDataValid = TRUE; //Step 3) Call the FUT CddBts72220_Cycle10ms(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CddBts72220_boCodMDataValid, FALSE, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT CddBts72220_boEftValid.eEftStatus = SIG_INVALID; Mt_CodingDataStatus.eCodingStatus = 0u; CddBts72220_boCodMDataValid = TRUE; //Step 3) Call the FUT CddBts72220_Cycle10ms(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CddBts72220_boCodMDataValid, TRUE, == ); } //----------------------------------------------------------------------------- /// \Test Case : Mt_CddBts72220_CheckDelayLatchClearTimer /// /// \Test Case Description /// - Test subject: /// /// /// - Test Design Technique: ET (Exploratory Testing) /// /// - Preconditions: /// /// - Expected test results: /// - All conditions and assigned values need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_CddBts72220_CheckDelayLatchClearTimer(void) { //Step 1) Set pre - conditions uint8 i; uint8 j; for (i = 0u; i < CFG_CDDBTS72220_DRIVER_CNT; i++) { for (j = 0u; j < CFG_BTS72220_OUTPUTS_CNT; j++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CddBts72220_States[i][j].tErrShort2GND = ERR_NO; //Step 3) Call the FUT CddBts72220_CheckDelayLatchClearTimer(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CddBts72220_ClearLatchDelay[i][j], TIM_RESET, == ); } } for (i = 0u; i < CFG_CDDBTS72220_DRIVER_CNT; i++) { for (j = 0u; j < CFG_BTS72220_OUTPUTS_CNT; j++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CddBts72220_States[i][j].tErrShort2GND = ERR_YES; CddBts72220_ClearLatchDelay[i][j] = 0u; //Step 3) Call the FUT CddBts72220_CheckDelayLatchClearTimer(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CddBts72220_ClearLatchDelay[i][j], 1u, == ); } } for (i = 0u; i < CFG_CDDBTS72220_DRIVER_CNT; i++) { for (j = 0u; j < CFG_BTS72220_OUTPUTS_CNT; j++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CddBts72220_States[i][j].tErrShort2GND = ERR_YES; CddBts72220_ClearLatchDelay[i][j] = 4u; //Step 3) Call the FUT CddBts72220_CheckDelayLatchClearTimer(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CddBts72220_ClearLatchDelay[i][j], 5u, == ); } } for (i = 0u; i < CFG_CDDBTS72220_DRIVER_CNT; i++) { for (j = 0u; j < CFG_BTS72220_OUTPUTS_CNT; j++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CddBts72220_States[i][j].tErrShort2GND = ERR_YES; CddBts72220_ClearLatchDelay[i][j] = 6u; //Step 3) Call the FUT CddBts72220_CheckDelayLatchClearTimer(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CddBts72220_ClearLatchDelay[i][j], 5u, == ); } } } //----------------------------------------------------------------------------- /// \Test Case : Mt_CddBts72220_SetTgt /// /// \Test Case Description /// - Test subject: /// /// /// - Test Design Technique: ET (Exploratory Testing) /// /// - Preconditions: /// /// - Expected test results: /// - All conditions and assigned values need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_CddBts72220_SetTgt(void) { //Step 1) Set pre - conditions uint32 ulChipIdx; uint32 ulOutIdx; uint16 unTgtVal = 0u; for (ulChipIdx = 0u; ulChipIdx < 2u; ulChipIdx++) { for (ulOutIdx = 0u; ulOutIdx < 4u; ulOutIdx++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CddBts72220_States[ulChipIdx][ulOutIdx].eHwState = HSS_NOSUPPORT; unTgtVal = 1u; //Step 3) Call the FUT CddBts72220_SetTgt(ulChipIdx, ulOutIdx, unTgtVal); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CddBts72220_States[ulChipIdx][ulOutIdx].unTgtVal, 0u, == ); } } for (ulChipIdx = 0u; ulChipIdx < 2u; ulChipIdx++) { for (ulOutIdx = 0u; ulOutIdx < 4u; ulOutIdx++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CddBts72220_States[ulChipIdx][ulOutIdx].eHwState = HSS_SUPPORT; unTgtVal = 1u; //Step 3) Call the FUT CddBts72220_SetTgt(ulChipIdx, ulOutIdx, unTgtVal); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CddBts72220_States[ulChipIdx][ulOutIdx].unTgtVal,1u,==); } } for (ulChipIdx = 0u; ulChipIdx < 2u; ulChipIdx++) { for (ulOutIdx = 0u; ulOutIdx < 4u; ulOutIdx++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CddBts72220_States[ulChipIdx][ulOutIdx].eHwState = HSS_SUPPORT; unTgtVal = 32769u; //Step 3) Call the FUT CddBts72220_SetTgt(ulChipIdx, ulOutIdx, unTgtVal); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CddBts72220_States[ulChipIdx][ulOutIdx].unTgtVal, 32769u, == ); } } } //----------------------------------------------------------------------------- /// \Test Case : Mt_CddBts72220_GetState /// /// \Test Case Description /// - Test subject: /// /// /// - Test Design Technique: ET (Exploratory Testing) /// /// - Preconditions: /// /// - Expected test results: /// - All conditions and assigned values need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_CddBts72220_GetState(void) { //Step 1) Set pre - conditions uint32 ulChipIdx; uint32 ulOutIdx; tisCddDrvStatus Mt_Bts72220_State[2][4]; for (ulChipIdx = 0u; ulChipIdx < 2u; ulChipIdx++) { for (ulOutIdx = 0u; ulOutIdx < 4u; ulOutIdx++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CddBts72220_States[ulChipIdx][ulOutIdx].eHwState = 4u; //Step 3) Call the FUT Mt_Bts72220_State[ulChipIdx][ulOutIdx] = CddBts72220_GetState(ulChipIdx, ulOutIdx); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(Mt_Bts72220_State[ulChipIdx][ulOutIdx].eHwState, HSS_SNA, == ); } } for (ulChipIdx = 0u; ulChipIdx < 2u; ulChipIdx++) { for (ulOutIdx = 0u; ulOutIdx < 4u; ulOutIdx++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CddBts72220_States[ulChipIdx][ulOutIdx].eHwState = HSS_NOSUPPORT; //Step 3) Call the FUT Mt_Bts72220_State[ulChipIdx][ulOutIdx] = CddBts72220_GetState(ulChipIdx, ulOutIdx); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(Mt_Bts72220_State[ulChipIdx][ulOutIdx].eHwState, HSS_NOSUPPORT, == ); } } for (ulChipIdx = 0u; ulChipIdx < 2u; ulChipIdx++) { for (ulOutIdx = 0u; ulOutIdx < 4u; ulOutIdx++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CddBts72220_States[ulChipIdx][ulOutIdx].eHwState = HSS_NOEFT; //Step 3) Call the FUT Mt_Bts72220_State[ulChipIdx][ulOutIdx] = CddBts72220_GetState(ulChipIdx, ulOutIdx); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(Mt_Bts72220_State[ulChipIdx][ulOutIdx].eHwState, HSS_NOEFT, == ); } } for (ulChipIdx = 0u; ulChipIdx < 2u; ulChipIdx++) { for (ulOutIdx = 0u; ulOutIdx < 4u; ulOutIdx++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CddBts72220_States[ulChipIdx][ulOutIdx].eHwState = HSS_SUPPORT; CddBts72220_boSleep = TRUE; //Step 3) Call the FUT Mt_Bts72220_State[ulChipIdx][ulOutIdx] = CddBts72220_GetState(ulChipIdx, ulOutIdx); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(Mt_Bts72220_State[ulChipIdx][ulOutIdx].eHwState, HSS_SUPPORT, == ); AL_UNITTEST_CHECK(Mt_Bts72220_State[ulChipIdx][ulOutIdx].unActVal, 0u, == ); AL_UNITTEST_CHECK(Mt_Bts72220_State[ulChipIdx][ulOutIdx].eOpenLoad, ERR_SNA, == ); AL_UNITTEST_CHECK(Mt_Bts72220_State[ulChipIdx][ulOutIdx].eShortGND, ERR_SNA, == ); AL_UNITTEST_CHECK(Mt_Bts72220_State[ulChipIdx][ulOutIdx].eShortVBAT, ERR_SNA, == ); AL_UNITTEST_CHECK(Mt_Bts72220_State[ulChipIdx][ulOutIdx].unActCurrent, 0u, == ); AL_UNITTEST_CHECK(Mt_Bts72220_State[ulChipIdx][ulOutIdx].unErr_ValidFlag, ERR_ENABLED, == ); } } for (ulChipIdx = 0u; ulChipIdx < 2u; ulChipIdx++) { for (ulOutIdx = 0u; ulOutIdx < 4u; ulOutIdx++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CddBts72220_States[ulChipIdx][ulOutIdx].eHwState = HSS_SUPPORT; CddBts72220_boSleep = FALSE; CddBts72220_States[ulChipIdx][ulOutIdx].unActVal = 1u; CddBts72220_States[ulChipIdx][ulOutIdx].tErrOpenload = ERR_NO; CddBts72220_States[ulChipIdx][ulOutIdx].tErrShort2GND = ERR_NO; CddBts72220_States[ulChipIdx][ulOutIdx].tErrShort2VBAT = ERR_NO; CddBts72220_States[ulChipIdx][ulOutIdx].unCurrent =1u; CddBts72220_States[ulChipIdx][ulOutIdx].unErr_ValidFlag = ERR_DISABLE; //Step 3) Call the FUT Mt_Bts72220_State[ulChipIdx][ulOutIdx] = CddBts72220_GetState(ulChipIdx, ulOutIdx); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(Mt_Bts72220_State[ulChipIdx][ulOutIdx].eHwState, HSS_SUPPORT, == ); AL_UNITTEST_CHECK(Mt_Bts72220_State[ulChipIdx][ulOutIdx].unActVal, 1u, == ); AL_UNITTEST_CHECK(Mt_Bts72220_State[ulChipIdx][ulOutIdx].eOpenLoad, ERR_NO, == ); AL_UNITTEST_CHECK(Mt_Bts72220_State[ulChipIdx][ulOutIdx].eShortGND, ERR_NO, == ); AL_UNITTEST_CHECK(Mt_Bts72220_State[ulChipIdx][ulOutIdx].eShortVBAT, ERR_NO, == ); AL_UNITTEST_CHECK(Mt_Bts72220_State[ulChipIdx][ulOutIdx].unActCurrent, 1u, == ); AL_UNITTEST_CHECK(Mt_Bts72220_State[ulChipIdx][ulOutIdx].unErr_ValidFlag, ERR_DISABLE, == ); } } } //----------------------------------------------------------------------------- /// \Test Case : Mt_CddBts72220_ADC_Sample /// /// \Test Case Description /// - Test subject: /// /// /// - Test Design Technique: ET (Exploratory Testing) /// /// - Preconditions: /// /// - Expected test results: /// - All conditions and assigned values need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_CddBts72220_ADC_Sample(void) { //Step 1) Set pre - conditions uint8 i; Mt_ADC_Get_Value[12] = 0u; Mt_ADC_Get_Value[13] = 0u; for (i = 0; i < CFG_CDDBTS72220_DRIVER_CNT; i++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT BTS72220_senseChannel_HSS[i] = 4u; //Step 3) Call the FUT CddBts72220_ADC_Sample(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value } for (i = 0; i < CFG_CDDBTS72220_DRIVER_CNT; i++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT BTS72220_senseChannel_HSS[i] = 3u; CddBts72220_States[i][3].eHwState = HSS_NOSUPPORT; //Step 3) Call the FUT CddBts72220_ADC_Sample(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value } for (i = 0; i < CFG_CDDBTS72220_DRIVER_CNT; i++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT BTS72220_senseChannel_HSS[i] = 3u; CddBts72220_States[i][3].eHwState = HSS_SUPPORT; Mt_ADC_Get_Value[12] = 1; Mt_ADC_Get_Value[13] = 2; //Step 3) Call the FUT CddBts72220_ADC_Sample(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value if (i == 0) { AL_UNITTEST_CHECK(CddBts72220_States[i][3].unDiagVal, 1, == ); AL_UNITTEST_CHECK(CddBts72220_States[i][3].unCurrent, (1 * 3694 / 1000), == ); } else { AL_UNITTEST_CHECK(CddBts72220_States[i][3].unDiagVal, 2, == ); AL_UNITTEST_CHECK(CddBts72220_States[i][3].unCurrent, (2 * 3694 / 1000), == ); } AL_UNITTEST_CHECK(BTS72220_Sample_Complete[i][3], ADC_COMPLETE, == ); } } //----------------------------------------------------------------------------- /// \Test Case : Mt_CddBts72220_Diag_CheckAllErrors /// /// \Test Case Description /// - Test subject: /// /// /// - Test Design Technique: ET (Exploratory Testing) /// /// - Preconditions: /// /// - Expected test results: /// - All conditions and assigned values need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_CddBts72220_Diag_CheckAllErrors(void) { //Step 1) Set pre - conditions uint8 i; uint8 j; for (i = 0; i < CFG_CDDBTS72220_DRIVER_CNT; i++) { for (j = 0; j < CFG_BTS72220_OUTPUTS_CNT; j++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CddBts72220_States[i][j].eHwState = HSS_NOSUPPORT; BTS72220_Sample_Complete[i][j] = ADC_UNACCOMPLISHED; CddBts72220_States[i][j].unErr_ValidFlag = ERR_DISABLE; //Step 3) Call the FUT CddBts72220_Diag_CheckAllErrors(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(BTS72220_Sample_Complete[i][j], ADC_UNACCOMPLISHED, == ); AL_UNITTEST_CHECK(CddBts72220_States[i][j].unErr_ValidFlag, ERR_DISABLE, == ); } } for (i = 0; i < CFG_CDDBTS72220_DRIVER_CNT; i++) { for (j = 0; j < CFG_BTS72220_OUTPUTS_CNT; j++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CddBts72220_States[i][j].eHwState = HSS_SUPPORT; BTS72220_Sample_Complete[i][j] = ADC_UNACCOMPLISHED; CddBts72220_States[i][j].unErr_ValidFlag = ERR_DISABLE; //Step 3) Call the FUT CddBts72220_Diag_CheckAllErrors(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(BTS72220_Sample_Complete[i][j], ADC_UNACCOMPLISHED, == ); AL_UNITTEST_CHECK(CddBts72220_States[i][j].unErr_ValidFlag, ERR_DISABLE, == ); } } for (i = 0; i < CFG_CDDBTS72220_DRIVER_CNT; i++) { for (j = 0; j < CFG_BTS72220_OUTPUTS_CNT; j++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CddBts72220_States[i][j].eHwState = HSS_SUPPORT; BTS72220_Sample_Complete[i][j] = ADC_COMPLETE; CddBts72220_States[i][j].unErr_ValidFlag = ERR_DISABLE; //Step 3) Call the FUT CddBts72220_Diag_CheckAllErrors(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(BTS72220_Sample_Complete[i][j], ADC_UNACCOMPLISHED, == ); AL_UNITTEST_CHECK(CddBts72220_States[i][j].unErr_ValidFlag, ERR_ENABLED, == ); } } } //----------------------------------------------------------------------------- /// \Test Case : Mt_CddBts72220_CheckOpenload /// /// \Test Case Description /// - Test subject: /// /// /// - Test Design Technique: ET (Exploratory Testing) /// /// - Preconditions: /// /// - Expected test results: /// - All conditions and assigned values need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_CddBts72220_CheckOpenload(void) { //Step 1) Set pre - conditions uint32 ulChipIdx; uint32 ulChIdx; for (ulChipIdx = 0u; ulChipIdx < 2u; ulChipIdx++) { for (ulChIdx = 0u; ulChIdx < 4u; ulChIdx++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CddBts72220_aOpenLoadThreshold[ulChipIdx][ulChIdx] = 0u; //Step 3) Call the FUT CddBts72220_CheckOpenload(ulChipIdx, ulChIdx); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CddBts72220_States[ulChipIdx][ulChIdx].tErrOpenload, ERR_DISABLED, == ); } } for (ulChipIdx = 0u; ulChipIdx < 2u; ulChipIdx++) { for (ulChIdx = 0u; ulChIdx < 4u; ulChIdx++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CddBts72220_aOpenLoadThreshold[ulChipIdx][ulChIdx] = 100u; CddBts72220_States[ulChipIdx][ulChIdx].unTgtVal = 0u; //Step 3) Call the FUT CddBts72220_CheckOpenload(ulChipIdx, ulChIdx); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CddBts72220_States[ulChipIdx][ulChIdx].tErrOpenload, ERR_SNA, == ); } } for (ulChipIdx = 0u; ulChipIdx < 2u; ulChipIdx++) { for (ulChIdx = 0u; ulChIdx < 4u; ulChIdx++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CddBts72220_aOpenLoadThreshold[ulChipIdx][ulChIdx] = 100u; CddBts72220_States[ulChipIdx][ulChIdx].unTgtVal = 32768u; CddBts72220_WRNDIAG[ulChipIdx] = 0xFF; CddBts72220_STDDIAG[ulChipIdx][ulChIdx] = 0xFF; //Step 3) Call the FUT CddBts72220_CheckOpenload(ulChipIdx, ulChIdx); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CddBts72220_States[ulChipIdx][ulChIdx].tErrOpenload, ERR_NO, == ); AL_UNITTEST_CHECK(CddBts72220_States[ulChipIdx][ulChIdx].tErrShort2VBAT, ERR_NO, == ); } } for (ulChipIdx = 0u; ulChipIdx < 2u; ulChipIdx++) { for (ulChIdx = 0u; ulChIdx < 4u; ulChIdx++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CddBts72220_aOpenLoadThreshold[ulChipIdx][ulChIdx] = 100u; CddBts72220_States[ulChipIdx][ulChIdx].unTgtVal = 32768u; CddBts72220_WRNDIAG[ulChipIdx] = 0x00; CddBts72220_STDDIAG[ulChipIdx][ulChIdx] = 0x00; CddBts72220_States[ulChipIdx][ulChIdx].unCurrent = 100u; //Step 3) Call the FUT CddBts72220_CheckOpenload(ulChipIdx, ulChIdx); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CddBts72220_States[ulChipIdx][ulChIdx].tErrOpenload, ERR_NO, == ); AL_UNITTEST_CHECK(CddBts72220_States[ulChipIdx][ulChIdx].tErrShort2VBAT, ERR_NO, == ); } } for (ulChipIdx = 0u; ulChipIdx < 2u; ulChipIdx++) { for (ulChIdx = 0u; ulChIdx < 4u; ulChIdx++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CddBts72220_aOpenLoadThreshold[ulChipIdx][ulChIdx] = 100u; CddBts72220_States[ulChipIdx][ulChIdx].unTgtVal = 32768u; CddBts72220_WRNDIAG[ulChipIdx] = 0x00; CddBts72220_STDDIAG[ulChipIdx][ulChIdx] = 0x00; CddBts72220_States[ulChipIdx][ulChIdx].unCurrent = 50u; CddBts72220_States[ulChipIdx][ulChIdx].tErrShort2VBAT = ERR_YES; //Step 3) Call the FUT CddBts72220_CheckOpenload(ulChipIdx, ulChIdx); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CddBts72220_States[ulChipIdx][ulChIdx].tErrOpenload, ERR_NO, == ); AL_UNITTEST_CHECK(CddBts72220_States[ulChipIdx][ulChIdx].tErrShort2VBAT, ERR_YES, == ); } } for (ulChipIdx = 0u; ulChipIdx < 2u; ulChipIdx++) { for (ulChIdx = 0u; ulChIdx < 4u; ulChIdx++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CddBts72220_aOpenLoadThreshold[ulChipIdx][ulChIdx] = 100u; CddBts72220_States[ulChipIdx][ulChIdx].unTgtVal = 32768u; CddBts72220_WRNDIAG[ulChipIdx] = 0x00; CddBts72220_STDDIAG[ulChipIdx][ulChIdx] = 0x00; CddBts72220_States[ulChipIdx][ulChIdx].unCurrent = 50u; CddBts72220_States[ulChipIdx][ulChIdx].tErrShort2VBAT = ERR_NO; //Step 3) Call the FUT CddBts72220_CheckOpenload(ulChipIdx, ulChIdx); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CddBts72220_States[ulChipIdx][ulChIdx].tErrOpenload, ERR_YES, == ); AL_UNITTEST_CHECK(CddBts72220_States[ulChipIdx][ulChIdx].tErrShort2VBAT, ERR_NO, == ); } } } //----------------------------------------------------------------------------- /// \Test Case : Mt_CddBts72220_CheckShort2GND /// /// \Test Case Description /// - Test subject: /// /// /// - Test Design Technique: ET (Exploratory Testing) /// /// - Preconditions: /// /// - Expected test results: /// - All conditions and assigned values need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_CddBts72220_CheckShort2GND(void) { //Step 1) Set pre - conditions uint32 ulChipIdx; uint32 ulChIdx; for (ulChipIdx = 0u; ulChipIdx < 2u; ulChipIdx++) { for (ulChIdx = 0u; ulChIdx < 4u; ulChIdx++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CddBts72220_ERRDIAG[ulChipIdx] = 0x00; //Step 3) Call the FUT CddBts72220_CheckShort2GND(ulChipIdx, ulChIdx); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CddBts72220_States[ulChipIdx][ulChIdx].tErrShort2GND, ERR_NO, == ); } } for (ulChipIdx = 0u; ulChipIdx < 2u; ulChipIdx++) { for (ulChIdx = 0u; ulChIdx < 4u; ulChIdx++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CddBts72220_ERRDIAG[ulChipIdx] = 0xFF; //Step 3) Call the FUT CddBts72220_CheckShort2GND(ulChipIdx, ulChIdx); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CddBts72220_States[ulChipIdx][ulChIdx].tErrShort2GND, ERR_YES, == ); } } } //----------------------------------------------------------------------------- /// \Test Case : Mt_CddBts72220_CheckShort2VBAT /// /// \Test Case Description /// - Test subject: /// /// /// - Test Design Technique: ET (Exploratory Testing) /// /// - Preconditions: /// /// - Expected test results: /// - All conditions and assigned values need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_CddBts72220_CheckShort2VBAT(void) { //Step 1) Set pre - conditions uint32 ulChipIdx; uint32 ulChIdx; for (ulChipIdx = 0u; ulChipIdx < 2u; ulChipIdx++) { for (ulChIdx = 0u; ulChIdx < 4u; ulChIdx++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CddBts72220_States[ulChipIdx][ulChIdx].unTgtVal = 32768u; //Step 3) Call the FUT CddBts72220_CheckShort2VBAT(ulChipIdx, ulChIdx); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value } } for (ulChipIdx = 0u; ulChipIdx < 2u; ulChipIdx++) { for (ulChIdx = 0u; ulChIdx < 4u; ulChIdx++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CddBts72220_States[ulChipIdx][ulChIdx].unTgtVal = 0u; CddBts72220_WRNDIAG[ulChipIdx] = 0x00; CddBts72220_STDDIAG[ulChipIdx][ulChIdx] = 0x00; //Step 3) Call the FUT CddBts72220_CheckShort2VBAT(ulChipIdx, ulChIdx); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CddBts72220_States[ulChipIdx][ulChIdx].tErrShort2VBAT, ERR_YES, == ); } } for (ulChipIdx = 0u; ulChipIdx < 2u; ulChipIdx++) { for (ulChIdx = 0u; ulChIdx < 4u; ulChIdx++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CddBts72220_States[ulChipIdx][ulChIdx].unTgtVal = 0u; CddBts72220_WRNDIAG[ulChipIdx] = 0xFF; CddBts72220_STDDIAG[ulChipIdx][ulChIdx] = 0xFF; //Step 3) Call the FUT CddBts72220_CheckShort2VBAT(ulChipIdx, ulChIdx); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CddBts72220_States[ulChipIdx][ulChIdx].tErrShort2VBAT, ERR_NO, == ); } } } //----------------------------------------------------------------------------- /// \Test Case : Mt_CddBts72220_ChSwitch_Transmit /// /// \Test Case Description /// - Test subject: /// /// /// - Test Design Technique: ET (Exploratory Testing) /// /// - Preconditions: /// /// - Expected test results: /// - All conditions and assigned values need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_CddBts72220_ChSwitch_Transmit(void) { //Step 1) Set pre - conditions //Step 2) Assign all input values to the corresponding input variables identified in the FUT Mt_Transmit_ReturnValue = E_NOT_OK; BTS72220_senseChannel_HSS[0] = 0u; BTS72220_senseChannel_HSS[1] = 0u; BTS72220_Pre_senseChannel_HSS[0] = 1u; BTS72220_Pre_senseChannel_HSS[1] = 1u; //Step 3) Call the FUT CddBts72220_ChSwitch_Transmit(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(BTS72220_senseChannel_HSS[0], 1u, == ); AL_UNITTEST_CHECK(BTS72220_senseChannel_HSS[1], 1u, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT Mt_Transmit_ReturnValue = E_OK; BTS72220_senseChannel_HSS[0] = 0u; BTS72220_senseChannel_HSS[1] = 0u; BTS72220_Pre_senseChannel_HSS[0] = 1u; BTS72220_Pre_senseChannel_HSS[1] = 1u; //Step 3) Call the FUT CddBts72220_ChSwitch_Transmit(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(BTS72220_senseChannel_HSS[0], 0u, == ); AL_UNITTEST_CHECK(BTS72220_senseChannel_HSS[1], 0u, == ); } //----------------------------------------------------------------------------- /// \Test Case : Mt_CddBts72220_ChClear_Transmit /// /// \Test Case Description /// - Test subject: /// /// /// - Test Design Technique: ET (Exploratory Testing) /// /// - Preconditions: /// /// - Expected test results: /// - All conditions and assigned values need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_CddBts72220_ChClear_Transmit(void) { //Step 1) Set pre - conditions //Step 2) Assign all input values to the corresponding input variables identified in the FUT BTS72220_senseChannel_HSS[0] = 3u; BTS72220_senseChannel_HSS[1] = 3u; CddBts72220_boClear_Latch[0][BTS72220_senseChannel_HSS[0]] = TRUE; CddBts72220_ClearLatchDelay[0][BTS72220_senseChannel_HSS[0]] = 5u; CddBts72220_boClear_Latch[1][BTS72220_senseChannel_HSS[1]] = TRUE; CddBts72220_ClearLatchDelay[1][BTS72220_senseChannel_HSS[1]] = 5u; ClearParallelLatchCnt = 0u; //Step 3) Call the FUT CddBts72220_ChClear_Transmit(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CddBts72220_boClear_Latch[0][BTS72220_senseChannel_HSS[0]], FALSE, == ); AL_UNITTEST_CHECK(CddBts72220_ClearLatchDelay[0][BTS72220_senseChannel_HSS[0]], TIM_RESET, == ); AL_UNITTEST_CHECK(CddBts72220_boClear_Latch[1][BTS72220_senseChannel_HSS[1]], FALSE, == ); AL_UNITTEST_CHECK(CddBts72220_ClearLatchDelay[1][BTS72220_senseChannel_HSS[1]], TIM_RESET, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT BTS72220_senseChannel_HSS[0] = 1u; BTS72220_senseChannel_HSS[1] = 1u; CddBts72220_boClear_Latch[0][BTS72220_senseChannel_HSS[0]] = TRUE; CddBts72220_ClearLatchDelay[0][BTS72220_senseChannel_HSS[0]] = 5u; CddBts72220_boClear_Latch[1][BTS72220_senseChannel_HSS[1]] = TRUE; CddBts72220_ClearLatchDelay[1][BTS72220_senseChannel_HSS[1]] = 5u; ClearParallelLatchCnt = 2u; //Step 3) Call the FUT CddBts72220_ChClear_Transmit(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CddBts72220_boClear_Latch[0][BTS72220_senseChannel_HSS[0]], FALSE, == ); AL_UNITTEST_CHECK(CddBts72220_ClearLatchDelay[0][BTS72220_senseChannel_HSS[0]], TIM_RESET, == ); AL_UNITTEST_CHECK(CddBts72220_boClear_Latch[1][BTS72220_senseChannel_HSS[1]], FALSE, == ); AL_UNITTEST_CHECK(CddBts72220_ClearLatchDelay[1][BTS72220_senseChannel_HSS[1]], TIM_RESET, == ); } //----------------------------------------------------------------------------- /// \Test Case : Mt_CddBts72220_New_request /// /// \Test Case Description /// - Test subject: /// /// /// - Test Design Technique: ET (Exploratory Testing) /// /// - Preconditions: /// /// - Expected test results: /// - All conditions and assigned values need to be reached and passed. /// //----------------------------------------------------------------------------- void Mt_CddBts72220_New_request(void) { //Step 1) Set pre - conditions uint8 ulChnIdx; uint8 ulOutIdx; uint8 ucNew_request; //Step 2) Assign all input values to the corresponding input variables identified in the FUT ulChnIdx = 0u; ulOutIdx = 0u; ucNew_request = CDDSWI_UNLATCHCMD; //Step 3) Call the FUT CddBts72220_New_request(ulChnIdx, ulOutIdx, ucNew_request); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CddBts72220_boClear_Latch[ulChnIdx][ulOutIdx], TRUE, == ); AL_UNITTEST_CHECK(CddBts72220_States[ulChnIdx][ulOutIdx].unErr_ValidFlag, ERR_DISABLE, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT ulChnIdx = 0u; ulOutIdx = 0u; ucNew_request = CDDSWI_TURN_ON; //Step 3) Call the FUT CddBts72220_New_request(ulChnIdx, ulOutIdx, ucNew_request); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CddBts72220_States[ulChnIdx][ulOutIdx].unErr_ValidFlag, ERR_DISABLE, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT ulChnIdx = 0u; ulOutIdx = 0u; ucNew_request = CDDSWI_TURN_OFF; //Step 3) Call the FUT CddBts72220_New_request(ulChnIdx, ulOutIdx, ucNew_request); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CddBts72220_States[ulChnIdx][ulOutIdx].unErr_ValidFlag, ERR_DISABLE, == ); } void ALUnitTest_AddTests(void) { ALUnitTest_AddFunction("Mt_Rte_riCddSwiInit", Mt_Rte_riCddSwiInit); ALUnitTest_AddFunction("Mt_CddSwi_GetCodMDataStatus", Mt_CddSwi_GetCodMDataStatus); ALUnitTest_AddFunction("Mt_Rte_rpCddSwi10ms", Mt_Rte_rpCddSwi10ms); ALUnitTest_AddFunction("Mt_RterdCddSwiDeInit", Mt_RterdCddSwiDeInit); ALUnitTest_AddFunction("Mt_CddSwi_SetSleep_mode", Mt_CddSwi_SetSleep_mode); ALUnitTest_AddFunction("Mt_CddBts72220_Init", Mt_CddBts72220_Init); ALUnitTest_AddFunction("Mt_CddBts72220_GetCodingData", Mt_CddBts72220_GetCodingData); ALUnitTest_AddFunction("Mt_CddBts72220_Cycle10ms", Mt_CddBts72220_Cycle10ms); ALUnitTest_AddFunction("Mt_CddBts72220_CheckDelayLatchClearTimer", Mt_CddBts72220_CheckDelayLatchClearTimer); ALUnitTest_AddFunction("Mt_CddBts72220_SetTgt", Mt_CddBts72220_SetTgt); ALUnitTest_AddFunction("Mt_CddBts72220_GetState", Mt_CddBts72220_GetState); ALUnitTest_AddFunction("Mt_CddBts72220_ADC_Sample", Mt_CddBts72220_ADC_Sample); ALUnitTest_AddFunction("Mt_CddBts72220_Diag_CheckAllErrors", Mt_CddBts72220_Diag_CheckAllErrors); ALUnitTest_AddFunction("Mt_CddBts72220_CheckOpenload", Mt_CddBts72220_CheckOpenload); ALUnitTest_AddFunction("Mt_CddBts72220_CheckShort2GND", Mt_CddBts72220_CheckShort2GND); ALUnitTest_AddFunction("Mt_CddBts72220_CheckShort2VBAT", Mt_CddBts72220_CheckShort2VBAT); ALUnitTest_AddFunction("Mt_CddBts72220_ChSwitch_Transmit", Mt_CddBts72220_ChSwitch_Transmit); ALUnitTest_AddFunction("Mt_CddBts72220_ChClear_Transmit", Mt_CddBts72220_ChClear_Transmit); ALUnitTest_AddFunction("Mt_CddBts72220_New_request", Mt_CddBts72220_New_request); }