//***************************************************************************** // (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 CtrlSwi /// /// \author /// mailTo: //----------------------------------------------------------------------------- #include "Mt_CtrlSwi/Test.h" #include #include #include tRomPara_CodingArea applicationCodingData; Std_ReturnType Mt_CtrlSwi_ReturnValue; tisAllSwitchTarget Mt_AllSwitchTarget; tisAllHssStatusError Mt_AllHssStatusError; tisAllSwitchStatus Mt_AllSwitchStatus; tisCodingStatus Mt_CodingStatus; tisEftStatus Mt_EftStatus; tisPLsR_MortiseTenon_type Mt_PLsRtoHss_Req; tislightSts Mt_clamp2ltoHss_Req; extern boolean CtrlSwi_aboCddSwiTarget[CFG_CTRLSWI_HSS_MAX_NO_OF_HSS_CHANNELS]; extern tieHssState CtrlSwi_aboAppMTargetState[CFG_CTRLSWI_HSS_MAX_NO_OF_HSS_CHANNELS]; extern tisSwitchStatus CtrlSwi_aSwitchStatus[CFG_CTRLSWI_HSS_MAX_NO_OF_HSS_CHANNELS]; extern uint8 CtrlSwi_ucNew_request[CFG_CTRLSWI_HSS_MAX_NO_OF_HSS_CHANNELS]; extern tisCtrlSwiState CtrlSwi_sState; extern tisCtrlSwiErrState CtrlSwi_sErrState; extern tisAllHssStatusError CtrlSwi_Diag_ErrorCode; extern tislightSts clamplPreviousReq_sState; extern tisPLsR_MortiseTenon_type PLsRtoHss_Req; extern tislightSts clamp2ltoHss_Req; extern tisCodingStatus eCodMCodingDataStatus; extern tisEftStatus eEftCrcStatus; extern boolean ClearedLatch; extern tisDiagError_Debounce CtrlSwi_aErrorDebounce[CFG_CTRLSWI_HSS_MAX_NO_OF_HSS_CHANNELS]; FUNC(Std_ReturnType, RTE_CODE) Rte_Read_ctasCtrlSwi_PpareCddSwiSwiStatus_sAllSwitchStatus(P2VAR(tisAllSwitchStatus, AUTOMATIC, RTE_CTASCTRLSWI_APPL_VAR) data); FUNC(Std_ReturnType, RTE_CODE) Rte_Write_ctasCtrlSwi_PpaseCtrlSwiSwiTarget_sAllSwitchTarget(P2CONST(tisAllSwitchTarget, AUTOMATIC, RTE_CTASCTRLSWI_APPL_DATA) data); FUNC(Std_ReturnType, RTE_CODE) Rte_Read_ctasCtrlSwi_PpareCodMCodingStatus_sCodingStatus(P2VAR(tisCodingStatus, AUTOMATIC, RTE_CTASCTRLSWI_APPL_VAR) data); FUNC(Std_ReturnType, RTE_CODE) Rte_Write_ctasCtrlSwi_PpaseCtrlSwiStatusError0_sVal(P2CONST(tisAllHssStatusError, AUTOMATIC, RTE_CTASCTRLSWI_APPL_DATA) data); FUNC(Std_ReturnType, RTE_CODE) Rte_Read_ctasCtrlSwi_PpareCddEftEftStatus_sEftStatus(P2VAR(tisEftStatus, AUTOMATIC, RTE_CTASCTRLSWI_APPL_VAR) data); FUNC(Std_ReturnType, RTE_CODE) Rte_Read_ctasCtrlSwi_PparePlsRrequest_sSetting(P2VAR(tisPLsR_MortiseTenon_type, AUTOMATIC, RTE_CTASCTRLSWI_APPL_VAR) data); FUNC(Std_ReturnType, RTE_CODE) Rte_Read_ctasCtrlSwi_PpsreLightStsInfo_Diag_sLightSts(P2VAR(tislightSts, AUTOMATIC, RTE_CTASCTRLSWI_APPL_VAR) data); FUNC(Std_ReturnType, RTE_CODE) Rte_Write_ctasCtrlSwi_PpaseCtrlSwiSwiTarget_sAllSwitchTarget(P2CONST(tisAllSwitchTarget, AUTOMATIC, RTE_CTASCTRLSWI_APPL_DATA) data) { Mt_AllSwitchTarget = *data; return Mt_CtrlSwi_ReturnValue; } FUNC(Std_ReturnType, RTE_CODE) Rte_Write_ctasCtrlSwi_PpaseCtrlSwiStatusError0_sVal(P2CONST(tisAllHssStatusError, AUTOMATIC, RTE_CTASCTRLSWI_APPL_DATA) data) { Mt_AllHssStatusError = *data; return Mt_CtrlSwi_ReturnValue; } FUNC(Std_ReturnType, RTE_CODE) Rte_Read_ctasCtrlSwi_PpareCddSwiSwiStatus_sAllSwitchStatus(P2VAR(tisAllSwitchStatus, AUTOMATIC, RTE_CTASCTRLSWI_APPL_VAR) data) { *data = Mt_AllSwitchStatus; return Mt_CtrlSwi_ReturnValue; } FUNC(Std_ReturnType, RTE_CODE) Rte_Read_ctasCtrlSwi_PpareCodMCodingStatus_sCodingStatus(P2VAR(tisCodingStatus, AUTOMATIC, RTE_CTASCTRLSWI_APPL_VAR) data) { *data = Mt_CodingStatus; return Mt_CtrlSwi_ReturnValue; } FUNC(Std_ReturnType, RTE_CODE) Rte_Read_ctasCtrlSwi_PpareCddEftEftStatus_sEftStatus(P2VAR(tisEftStatus, AUTOMATIC, RTE_CTASCTRLSWI_APPL_VAR) data) { *data = Mt_EftStatus; return Mt_CtrlSwi_ReturnValue; } FUNC(Std_ReturnType, RTE_CODE) Rte_Read_ctasCtrlSwi_PparePlsRrequest_sSetting(P2VAR(tisPLsR_MortiseTenon_type, AUTOMATIC, RTE_CTASCTRLSWI_APPL_VAR) data) { *data = Mt_PLsRtoHss_Req; return Mt_CtrlSwi_ReturnValue; } FUNC(Std_ReturnType, RTE_CODE) Rte_Read_ctasCtrlSwi_PpsreLightStsInfo_Diag_sLightSts(P2VAR(tislightSts, AUTOMATIC, RTE_CTASCTRLSWI_APPL_VAR) data) { *data = Mt_clamp2ltoHss_Req; return Mt_CtrlSwi_ReturnValue; } //----------------------------------------------------------------------------- /// \Test Case : Mt_Rte_riCtrlSwiInit /// /// \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_riCtrlSwiInit(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 Rte_riCtrlSwiInit(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value } //----------------------------------------------------------------------------- /// \Test Case : Mt_Rte_rpCtrlSwi10ms /// /// \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_rpCtrlSwi10ms(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 Rte_rpCtrlSwi10ms(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value } //----------------------------------------------------------------------------- /// \Test Case : Mt_Rte_rdCtrlSwiDeInit /// /// \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_rdCtrlSwiDeInit(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 Rte_rdCtrlSwiDeInit(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlSwi_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_CtrlSwi_Init(void) { //Step 1) Set pre - conditions uint8 i; for (i = 0; i < 8u; i++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT Mt_EftStatus.eEftStatus = SIG_INVALID; Mt_CodingStatus.eCodingStatus = 1u; //Step 3) Call the FUT CtrlSwi_Init(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlSwi_Diag_ErrorCode.asSwi2SysmErrorStatus[i].eStatSupported, SUPPORT_UNKNOWN,==); AL_UNITTEST_CHECK(CtrlSwi_Diag_ErrorCode.asSwi2SysmErrorStatus[i].eStatOn, HSS_DISABLED, == ); } for (i = 0; i < 8u; i++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT Mt_EftStatus.eEftStatus = SIG_VALID; Mt_CodingStatus.eCodingStatus = 0u; applicationCodingData.System.HSSErrDetection.HSS_Open_Load_Debounce_ms = 100u; applicationCodingData.System.HSSErrDetection.HSS_Short_Ubat_Debounce_ms = 100u; //Step 3) Call the FUT CtrlSwi_Init(); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlSwi_aErrorDebounce[i].HSS_Open_Load_Debounce, 100u, == ); AL_UNITTEST_CHECK(CtrlSwi_aErrorDebounce[i].HSS_Short_Vbat_Debounce, 100u, == ); AL_UNITTEST_CHECK(CtrlSwi_sState.aboHssTargetState[i], FALSE, == ); AL_UNITTEST_CHECK(CtrlSwi_sState.aboHssActualState[i], FALSE, == ); AL_UNITTEST_CHECK(CtrlSwi_Diag_ErrorCode.asSwi2SysmErrorStatus[i].eStatOn, HSS_SNA, == ); AL_UNITTEST_CHECK(Mt_AllSwitchTarget.aunTgtVal[i], 0u, == ); AL_UNITTEST_CHECK(Mt_AllSwitchTarget.ucNew_request[i], CTRLSWI_NO_CHANGE, == ); AL_UNITTEST_CHECK(CtrlSwi_Diag_ErrorCode.asSwi2SysmErrorStatus[i].eStatSupported, SUPPORT_YES, == ); } } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlSwi_clamplightreq_judge /// /// \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_CtrlSwi_clamplightreq_judge(void) { //Step 1) Set pre - conditions uint8 ucHssChannel; uint8 ReturnValue; //Step 2) Assign all input values to the corresponding input variables identified in the FUT ucHssChannel = HSS0; clamp2ltoHss_Req.LeftTurnReq_RL = SWI_REQ_ON; clamplPreviousReq_sState.LeftTurnReq_RL = SWI_REQ_OFF; clamp2ltoHss_Req.PosReq_RL = SWI_REQ_ON; clamplPreviousReq_sState.PosReq_RL = SWI_REQ_OFF; clamp2ltoHss_Req.BrakeReq_RL = SWI_REQ_ON; clamplPreviousReq_sState.BrakeReq_RL = SWI_REQ_OFF; //Step 3) Call the FUT ReturnValue = CtrlSwi_clamplightreq_judge(ucHssChannel); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(ReturnValue, TRUE, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT ucHssChannel = HSS0; clamp2ltoHss_Req.LeftTurnReq_RL = SWI_REQ_OFF; clamplPreviousReq_sState.LeftTurnReq_RL = SWI_REQ_ON; clamp2ltoHss_Req.PosReq_RL = SWI_REQ_OFF; clamplPreviousReq_sState.PosReq_RL = SWI_REQ_ON; clamp2ltoHss_Req.BrakeReq_RL = SWI_REQ_OFF; clamplPreviousReq_sState.BrakeReq_RL = SWI_REQ_ON; //Step 3) Call the FUT ReturnValue = CtrlSwi_clamplightreq_judge(ucHssChannel); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(ReturnValue, FALSE, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT ucHssChannel = HSS1; clamp2ltoHss_Req.PosReq_RL = SWI_REQ_ON; clamplPreviousReq_sState.PosReq_RL = SWI_REQ_OFF; //Step 3) Call the FUT ReturnValue = CtrlSwi_clamplightreq_judge(ucHssChannel); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(ReturnValue, TRUE, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT ucHssChannel = HSS1; clamp2ltoHss_Req.PosReq_RL = SWI_REQ_OFF; clamplPreviousReq_sState.PosReq_RL = SWI_REQ_OFF; //Step 3) Call the FUT ReturnValue = CtrlSwi_clamplightreq_judge(ucHssChannel); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(ReturnValue, FALSE, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT ucHssChannel = HSS3; clamp2ltoHss_Req.RightTurnReq_RL = SWI_REQ_ON; clamp2ltoHss_Req.PosReq_RL = SWI_REQ_ON; clamp2ltoHss_Req.BrakeReq_RL = SWI_REQ_ON; clamplPreviousReq_sState.RightTurnReq_RL = SWI_REQ_OFF; clamplPreviousReq_sState.PosReq_RL = SWI_REQ_OFF; clamplPreviousReq_sState.BrakeReq_RL = SWI_REQ_OFF; //Step 3) Call the FUT ReturnValue = CtrlSwi_clamplightreq_judge(ucHssChannel); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(ReturnValue, TRUE, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT ucHssChannel = HSS3; clamp2ltoHss_Req.RightTurnReq_RL = SWI_REQ_OFF; clamp2ltoHss_Req.PosReq_RL = SWI_REQ_OFF; clamp2ltoHss_Req.BrakeReq_RL = SWI_REQ_OFF; clamplPreviousReq_sState.RightTurnReq_RL = SWI_REQ_ON; clamplPreviousReq_sState.PosReq_RL = SWI_REQ_ON; clamplPreviousReq_sState.BrakeReq_RL = SWI_REQ_ON; //Step 3) Call the FUT ReturnValue = CtrlSwi_clamplightreq_judge(ucHssChannel); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(ReturnValue, FALSE, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT ucHssChannel = HSS4; clamp2ltoHss_Req.LeftTurnReq_RL = SWI_REQ_ON; clamp2ltoHss_Req.RightTurnReq_RL = SWI_REQ_ON; clamp2ltoHss_Req.PosReq_RL = SWI_REQ_ON; clamp2ltoHss_Req.BrakeReq_RL = SWI_REQ_ON; clamplPreviousReq_sState.LeftTurnReq_RL = SWI_REQ_OFF; clamplPreviousReq_sState.RightTurnReq_RL = SWI_REQ_OFF; clamplPreviousReq_sState.PosReq_RL = SWI_REQ_OFF; clamplPreviousReq_sState.BrakeReq_RL = SWI_REQ_OFF; //Step 3) Call the FUT ReturnValue = CtrlSwi_clamplightreq_judge(ucHssChannel); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(ReturnValue, TRUE, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT ucHssChannel = HSS4; clamp2ltoHss_Req.LeftTurnReq_RL = SWI_REQ_OFF; clamp2ltoHss_Req.RightTurnReq_RL = SWI_REQ_OFF; clamp2ltoHss_Req.PosReq_RL = SWI_REQ_OFF; clamp2ltoHss_Req.BrakeReq_RL = SWI_REQ_OFF; clamplPreviousReq_sState.LeftTurnReq_RL = SWI_REQ_OFF; clamplPreviousReq_sState.RightTurnReq_RL = SWI_REQ_OFF; clamplPreviousReq_sState.PosReq_RL = SWI_REQ_OFF; clamplPreviousReq_sState.BrakeReq_RL = SWI_REQ_OFF; //Step 3) Call the FUT ReturnValue = CtrlSwi_clamplightreq_judge(ucHssChannel); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(ReturnValue, FALSE, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT ucHssChannel = HSS2; PLsRtoHss_Req.AniReq = 1u; CtrlSwi_sState.aboPreTargestState[ucHssChannel] = SWI_REQ_OFF; //Step 3) Call the FUT ReturnValue = CtrlSwi_clamplightreq_judge(ucHssChannel); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(ReturnValue, TRUE, == ); //Step 2) Assign all input values to the corresponding input variables identified in the FUT ucHssChannel = HSS2; PLsRtoHss_Req.AniReq = 0u; CtrlSwi_sState.aboPreTargestState[ucHssChannel] = SWI_REQ_ON; //Step 3) Call the FUT ReturnValue = CtrlSwi_clamplightreq_judge(ucHssChannel); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(ReturnValue, FALSE, == ); } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlSwi_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_CtrlSwi_Cycle10ms(void) { //Step 1) Set pre - conditions uint8 i; for (i = 0u; i < CFG_CTRLSWI_HSS_MAX_NO_OF_HSS_CHANNELS; i++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT eEftCrcStatus.eEftStatus = SIG_INVALID; Mt_EftStatus.eEftStatus = SIG_INVALID; Mt_CodingStatus.eCodingStatus = 1u; clamplPreviousReq_sState.BrakeReq_RL = 0u; clamplPreviousReq_sState.PosReq_RL = 0u; clamplPreviousReq_sState.LeftTurnReq_RL = 0u; clamplPreviousReq_sState.RightTurnReq_RL = 0u; Mt_clamp2ltoHss_Req.BrakeReq_RL = 1u; Mt_clamp2ltoHss_Req.PosReq_RL = 1u; Mt_clamp2ltoHss_Req.LeftTurnReq_RL = 1u; Mt_clamp2ltoHss_Req.RightTurnReq_RL = 1u; //Step 3) Call the FUT CtrlSwi_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(CtrlSwi_Diag_ErrorCode.asSwi2SysmErrorStatus[i].eStatSupported, SUPPORT_UNKNOWN, == ); AL_UNITTEST_CHECK(CtrlSwi_Diag_ErrorCode.asSwi2SysmErrorStatus[i].eStatOn, HSS_DISABLED, == ); AL_UNITTEST_CHECK(CtrlSwi_Diag_ErrorCode.asSwi2SysmErrorStatus[i].eErrShortToGnd, ERR_DISABLED, == ); AL_UNITTEST_CHECK(CtrlSwi_Diag_ErrorCode.asSwi2SysmErrorStatus[i].eErrShortToVBat, ERR_DISABLED, == ); AL_UNITTEST_CHECK(CtrlSwi_Diag_ErrorCode.asSwi2SysmErrorStatus[i].eErrOpenLoad, ERR_SNA, == ); AL_UNITTEST_CHECK(clamplPreviousReq_sState.BrakeReq_RL, 0u, == ); AL_UNITTEST_CHECK(clamplPreviousReq_sState.PosReq_RL, 0u, == ); AL_UNITTEST_CHECK(clamplPreviousReq_sState.LeftTurnReq_RL, 0u, == ); AL_UNITTEST_CHECK(clamplPreviousReq_sState.RightTurnReq_RL, 0u, == ); } for (i = 0u; i < CFG_CTRLSWI_HSS_MAX_NO_OF_HSS_CHANNELS; i++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT eEftCrcStatus.eEftStatus = SIG_VALID; Mt_EftStatus.eEftStatus = SIG_VALID; Mt_CodingStatus.eCodingStatus = 0u; Mt_AllSwitchStatus.asSwitchStatus[i].eHwState = HSS_NOSUPPORT; clamplPreviousReq_sState.BrakeReq_RL = 0u; clamplPreviousReq_sState.PosReq_RL = 0u; clamplPreviousReq_sState.LeftTurnReq_RL = 0u; clamplPreviousReq_sState.RightTurnReq_RL = 0u; Mt_clamp2ltoHss_Req.BrakeReq_RL = 1u; Mt_clamp2ltoHss_Req.PosReq_RL = 1u; Mt_clamp2ltoHss_Req.LeftTurnReq_RL = 1u; Mt_clamp2ltoHss_Req.RightTurnReq_RL = 1u; //Step 3) Call the FUT CtrlSwi_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(CtrlSwi_Diag_ErrorCode.asSwi2SysmErrorStatus[i].eStatSupported, SUPPORT_NO, == ); AL_UNITTEST_CHECK(CtrlSwi_Diag_ErrorCode.asSwi2SysmErrorStatus[i].eStatOn, HSS_DISABLED, == ); AL_UNITTEST_CHECK(CtrlSwi_Diag_ErrorCode.asSwi2SysmErrorStatus[i].eErrShortToGnd, ERR_DISABLED, == ); AL_UNITTEST_CHECK(CtrlSwi_Diag_ErrorCode.asSwi2SysmErrorStatus[i].eErrShortToVBat, ERR_DISABLED, == ); AL_UNITTEST_CHECK(CtrlSwi_Diag_ErrorCode.asSwi2SysmErrorStatus[i].eErrOpenLoad, ERR_SNA, == ); AL_UNITTEST_CHECK(clamplPreviousReq_sState.BrakeReq_RL, 1u, == ); AL_UNITTEST_CHECK(clamplPreviousReq_sState.PosReq_RL, 1u, == ); AL_UNITTEST_CHECK(clamplPreviousReq_sState.LeftTurnReq_RL, 1u, == ); AL_UNITTEST_CHECK(clamplPreviousReq_sState.RightTurnReq_RL, 1u, == ); } for (i = 0u; i < CFG_CTRLSWI_HSS_MAX_NO_OF_HSS_CHANNELS; i++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT eEftCrcStatus.eEftStatus = SIG_VALID; Mt_EftStatus.eEftStatus = SIG_VALID; Mt_CodingStatus.eCodingStatus = 0u; Mt_AllSwitchStatus.asSwitchStatus[i].eHwState = HSS_SUPPORT; Mt_AllSwitchStatus.asSwitchStatus[i].unActCurrent = 1u; clamplPreviousReq_sState.BrakeReq_RL = 0u; clamplPreviousReq_sState.PosReq_RL = 0u; clamplPreviousReq_sState.LeftTurnReq_RL = 0u; clamplPreviousReq_sState.RightTurnReq_RL = 0u; Mt_clamp2ltoHss_Req.BrakeReq_RL = 1u; Mt_clamp2ltoHss_Req.PosReq_RL = 1u; Mt_clamp2ltoHss_Req.LeftTurnReq_RL = 1u; Mt_clamp2ltoHss_Req.RightTurnReq_RL = 1u; CtrlSwi_sState.aboHssActualState[i] = TRUE; ClearedLatch = TRUE; CtrlSwi_sErrState.ucErrShortToGnd[i] = ERR_NO; CtrlSwi_sErrState.ucErrOpenLoad[i] = ERR_YES; CtrlSwi_sErrState.ucErrShortToVbat[i] = ERR_YES; CtrlSwi_ucNew_request[i] = CTRLSWI_UNLATCHCMD; CtrlSwi_aboCddSwiTarget[i] = TRUE; CtrlSwi_aboAppMTargetState[i] = TRUE; CtrlSwi_sState.aboPreTargestState[i] = FALSE; Mt_AllSwitchStatus.asSwitchStatus[i].eShortGND = ERR_NO; CtrlSwi_sErrState.ucCntShortToGnd[i] = 0u; Mt_PLsRtoHss_Req.AniReq = 1u; Mt_PLsRtoHss_Req.HL_Pwm_MorTe = 0xFF; Mt_PLsRtoHss_Req.RL_Pwm_MorTe = 0xFF; //Step 3) Call the FUT CtrlSwi_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(CtrlSwi_Diag_ErrorCode.asSwi2SysmErrorStatus[i].eStatSupported, SUPPORT_YES, == ); AL_UNITTEST_CHECK(CtrlSwi_Diag_ErrorCode.asSwi2SysmErrorStatus[i].unStatCurrent, 1U, == ); AL_UNITTEST_CHECK(CtrlSwi_Diag_ErrorCode.asSwi2SysmErrorStatus[i].eStatOn, HSS_ON, == ); AL_UNITTEST_CHECK(CtrlSwi_Diag_ErrorCode.asSwi2SysmErrorStatus[i].eErrShortToGnd, ERR_NO, == ); AL_UNITTEST_CHECK(CtrlSwi_Diag_ErrorCode.asSwi2SysmErrorStatus[i].eErrShortToVBat, ERR_YES, == ); AL_UNITTEST_CHECK(CtrlSwi_Diag_ErrorCode.asSwi2SysmErrorStatus[i].eErrOpenLoad, ERR_SNA, == ); AL_UNITTEST_CHECK(clamplPreviousReq_sState.BrakeReq_RL, 1u, == ); AL_UNITTEST_CHECK(clamplPreviousReq_sState.PosReq_RL, 1u, == ); AL_UNITTEST_CHECK(clamplPreviousReq_sState.LeftTurnReq_RL, 1u, == ); AL_UNITTEST_CHECK(clamplPreviousReq_sState.RightTurnReq_RL, 1u, == ); AL_UNITTEST_CHECK(ClearedLatch, TRUE, == ); AL_UNITTEST_CHECK(Mt_AllSwitchTarget.ucNew_request[i], CTRLSWI_NO_CHANGE, == ); if (i == 2) { AL_UNITTEST_CHECK(Mt_AllSwitchTarget.aunTgtVal[2], 32768u, == ); } if (i == 5) { AL_UNITTEST_CHECK(Mt_AllSwitchTarget.aunTgtVal[5], 32768u, == ); } } for (i = 0u; i < CFG_CTRLSWI_HSS_MAX_NO_OF_HSS_CHANNELS; i++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT eEftCrcStatus.eEftStatus = SIG_VALID; Mt_EftStatus.eEftStatus = SIG_VALID; Mt_CodingStatus.eCodingStatus = 0u; Mt_AllSwitchStatus.asSwitchStatus[i].eHwState = HSS_SUPPORT; Mt_PLsRtoHss_Req.AniReq = 0u; Mt_PLsRtoHss_Req.HL_Pwm_MorTe = 0xFF; Mt_PLsRtoHss_Req.RL_Pwm_MorTe = 0xFF; Mt_AllSwitchStatus.asSwitchStatus[i].unActCurrent = 1u; Mt_AllSwitchStatus.asSwitchStatus[i].eShortGND = ERR_NO; CtrlSwi_sState.aboHssActualState[i] = FALSE; ClearedLatch = FALSE; CtrlSwi_sErrState.ucErrShortToGnd[i] = ERR_NO; CtrlSwi_sErrState.ucErrOpenLoad[i] = ERR_YES; CtrlSwi_sErrState.ucErrShortToVbat[i] = ERR_YES; CtrlSwi_ucNew_request[i] = CTRLSWI_UNLATCHCMD; CtrlSwi_aboCddSwiTarget[i] = TRUE; CtrlSwi_sErrState.ucCntShortToGnd[i] = 0u; CtrlSwi_sState.aboHssActualState[i] = TRUE; CtrlSwi_aboAppMTargetState[i] = FALSE; clamplPreviousReq_sState.BrakeReq_RL = 0u; clamplPreviousReq_sState.PosReq_RL = 0u; clamplPreviousReq_sState.LeftTurnReq_RL = 0u; clamplPreviousReq_sState.RightTurnReq_RL = 0u; Mt_clamp2ltoHss_Req.BrakeReq_RL = 1u; Mt_clamp2ltoHss_Req.PosReq_RL = 1u; Mt_clamp2ltoHss_Req.LeftTurnReq_RL = 1u; Mt_clamp2ltoHss_Req.RightTurnReq_RL = 1u; //Step 3) Call the FUT CtrlSwi_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(clamplPreviousReq_sState.BrakeReq_RL, 1u, == ); AL_UNITTEST_CHECK(clamplPreviousReq_sState.PosReq_RL, 1u, == ); AL_UNITTEST_CHECK(clamplPreviousReq_sState.LeftTurnReq_RL, 1u, == ); AL_UNITTEST_CHECK(clamplPreviousReq_sState.RightTurnReq_RL, 1u, == ); AL_UNITTEST_CHECK(ClearedLatch, TRUE, == ); AL_UNITTEST_CHECK(CtrlSwi_Diag_ErrorCode.asSwi2SysmErrorStatus[i].eStatSupported, SUPPORT_YES, == ); AL_UNITTEST_CHECK(Mt_AllSwitchTarget.ucNew_request[i], CTRLSWI_NO_CHANGE, == ); if (i == 2) { AL_UNITTEST_CHECK(Mt_AllSwitchTarget.aunTgtVal[2], 0u, == ); AL_UNITTEST_CHECK(CtrlSwi_Diag_ErrorCode.asSwi2SysmErrorStatus[i].unStatCurrent, 0U, == ); AL_UNITTEST_CHECK(CtrlSwi_Diag_ErrorCode.asSwi2SysmErrorStatus[i].eStatOn, HSS_OFF, == ); AL_UNITTEST_CHECK(CtrlSwi_Diag_ErrorCode.asSwi2SysmErrorStatus[i].eErrShortToGnd, ERR_SNA, == ); AL_UNITTEST_CHECK(CtrlSwi_Diag_ErrorCode.asSwi2SysmErrorStatus[i].eErrShortToVBat, ERR_YES, == ); AL_UNITTEST_CHECK(CtrlSwi_Diag_ErrorCode.asSwi2SysmErrorStatus[i].eErrOpenLoad, ERR_SNA, == ); } else if (i == 5) { AL_UNITTEST_CHECK(Mt_AllSwitchTarget.aunTgtVal[5], 0u, == ); AL_UNITTEST_CHECK(CtrlSwi_Diag_ErrorCode.asSwi2SysmErrorStatus[i].unStatCurrent, 0U, == ); AL_UNITTEST_CHECK(CtrlSwi_Diag_ErrorCode.asSwi2SysmErrorStatus[i].eStatOn, HSS_OFF, == ); AL_UNITTEST_CHECK(CtrlSwi_Diag_ErrorCode.asSwi2SysmErrorStatus[i].eErrShortToGnd, ERR_SNA, == ); AL_UNITTEST_CHECK(CtrlSwi_Diag_ErrorCode.asSwi2SysmErrorStatus[i].eErrShortToVBat, ERR_YES, == ); AL_UNITTEST_CHECK(CtrlSwi_Diag_ErrorCode.asSwi2SysmErrorStatus[i].eErrOpenLoad, ERR_SNA, == ); } else { AL_UNITTEST_CHECK(CtrlSwi_Diag_ErrorCode.asSwi2SysmErrorStatus[i].unStatCurrent, 1U, == ); AL_UNITTEST_CHECK(CtrlSwi_Diag_ErrorCode.asSwi2SysmErrorStatus[i].eStatOn, HSS_ON, == ); AL_UNITTEST_CHECK(CtrlSwi_Diag_ErrorCode.asSwi2SysmErrorStatus[i].eErrShortToGnd, ERR_NO, == ); AL_UNITTEST_CHECK(CtrlSwi_Diag_ErrorCode.asSwi2SysmErrorStatus[i].eErrShortToVBat, ERR_YES, == ); AL_UNITTEST_CHECK(CtrlSwi_Diag_ErrorCode.asSwi2SysmErrorStatus[i].eErrOpenLoad, ERR_SNA, == ); } } } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlSwi_OperateOutputWithVoltState /// /// \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_CtrlSwi_OperateOutputWithVoltState(void) { //Step 1) Set pre - conditions uint8 ucHssChannel; for (ucHssChannel = 0u; ucHssChannel < 8u; ucHssChannel++) { if (ucHssChannel != 6u) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlSwi_sErrState.ucErrShortToGnd[ucHssChannel] = ERR_YES; clamp2ltoHss_Req.LeftTurnReq_RL = SWI_REQ_ON; clamp2ltoHss_Req.RightTurnReq_RL = SWI_REQ_ON; clamp2ltoHss_Req.PosReq_RL = SWI_REQ_ON; clamp2ltoHss_Req.BrakeReq_RL = SWI_REQ_ON; clamplPreviousReq_sState.LeftTurnReq_RL = SWI_REQ_OFF; clamplPreviousReq_sState.RightTurnReq_RL = SWI_REQ_OFF; clamplPreviousReq_sState.PosReq_RL = SWI_REQ_OFF; clamplPreviousReq_sState.BrakeReq_RL = SWI_REQ_OFF; PLsRtoHss_Req.AniReq = 1u; CtrlSwi_sState.aboPreTargestState[ucHssChannel] = SWI_REQ_OFF; //Step 3) Call the FUT CtrlSwi_OperateOutputWithVoltState(ucHssChannel); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlSwi_ucNew_request[ucHssChannel], CTRLSWI_UNLATCHCMD, == ); AL_UNITTEST_CHECK(ClearedLatch, FALSE, == ); } } for (ucHssChannel = 0u; ucHssChannel < 8u; ucHssChannel++) { if (ucHssChannel != 6u) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlSwi_sErrState.ucErrShortToGnd[ucHssChannel] = ERR_NO; ClearedLatch = TRUE; CtrlSwi_sState.aboHssTargetState[ucHssChannel] = FALSE; CtrlSwi_sState.aboHssPreviousState[ucHssChannel] = TRUE; CtrlSwi_ucNew_request[ucHssChannel] = CTRLSWI_UNLATCHCMD; //Step 3) Call the FUT CtrlSwi_OperateOutputWithVoltState(ucHssChannel); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlSwi_ucNew_request[ucHssChannel], CTRLSWI_NO_CHANGE, == ); AL_UNITTEST_CHECK(ClearedLatch, TRUE, == ); AL_UNITTEST_CHECK(CtrlSwi_sState.aboPreTargestState[ucHssChannel], FALSE, == ); } } #if 0 for (ucHssChannel = 0u; ucHssChannel < 8u; ucHssChannel++) { if (ucHssChannel != 6u) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlSwi_sErrState.ucErrShortToGnd[ucHssChannel] = ERR_NO; ClearedLatch = TRUE; CtrlSwi_sState.aboHssTargetState[ucHssChannel] = FALSE; CtrlSwi_sState.aboHssPreviousState[ucHssChannel] = FALSE; CtrlSwi_ucNew_request[ucHssChannel] = CTRLSWI_UNLATCHCMD; //Step 3) Call the FUT CtrlSwi_OperateOutputWithVoltState(ucHssChannel); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlSwi_ucNew_request[ucHssChannel], CTRLSWI_NO_CHANGE, == ); AL_UNITTEST_CHECK(ClearedLatch, TRUE, == ); AL_UNITTEST_CHECK(CtrlSwi_sState.aboPreTargestState[ucHssChannel], FALSE, == ); } } #endif for (ucHssChannel = 0u; ucHssChannel < 8u; ucHssChannel++) { if (ucHssChannel != 6u) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlSwi_sErrState.ucErrShortToGnd[ucHssChannel] = ERR_NO; ClearedLatch = TRUE; CtrlSwi_sState.aboHssTargetState[ucHssChannel] = TRUE; CtrlSwi_sState.aboHssPreviousState[ucHssChannel] = FALSE; CtrlSwi_ucNew_request[ucHssChannel] = CTRLSWI_UNLATCHCMD; //Step 3) Call the FUT CtrlSwi_OperateOutputWithVoltState(ucHssChannel); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlSwi_ucNew_request[ucHssChannel], CTRLSWI_NO_CHANGE, == ); AL_UNITTEST_CHECK(ClearedLatch, TRUE, == ); AL_UNITTEST_CHECK(CtrlSwi_sState.aboPreTargestState[ucHssChannel], TRUE, == ); } } #if 0 for (ucHssChannel = 0u; ucHssChannel < 8u; ucHssChannel++) { if (ucHssChannel != 6u) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlSwi_sErrState.ucErrShortToGnd[ucHssChannel] = ERR_NO; ClearedLatch = TRUE; CtrlSwi_sState.aboHssTargetState[ucHssChannel] = TRUE; CtrlSwi_sState.aboHssPreviousState[ucHssChannel] = TRUE; CtrlSwi_ucNew_request[ucHssChannel] = CTRLSWI_UNLATCHCMD; //Step 3) Call the FUT CtrlSwi_OperateOutputWithVoltState(ucHssChannel); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlSwi_ucNew_request[ucHssChannel], CTRLSWI_NO_CHANGE, == ); AL_UNITTEST_CHECK(ClearedLatch, TRUE, == ); AL_UNITTEST_CHECK(CtrlSwi_sState.aboPreTargestState[ucHssChannel], TRUE, == ); } } #endif } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlSwi_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_CtrlSwi_Diag_CheckAllErrors(void) { //Step 1) Set pre - conditions uint8 ucHssChannel; boolean boActualState; boolean boDiagDelayDisabled; for (ucHssChannel = 0u; ucHssChannel < 8u; ucHssChannel++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT boActualState = FALSE; CtrlSwi_sErrState.ucCntShortToVbat[ucHssChannel] = 1u; CtrlSwi_sErrState.ucCntShortToGnd[ucHssChannel] = 1u; CtrlSwi_sErrState.ucCntOpenLoad[ucHssChannel] = 1u; boDiagDelayDisabled = TRUE; //Step 3) Call the FUT CtrlSwi_Diag_CheckAllErrors(ucHssChannel, boActualState, boDiagDelayDisabled); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlSwi_sErrState.ucCntShortToVbat[ucHssChannel], 0u, == ); AL_UNITTEST_CHECK(CtrlSwi_sErrState.ucCntShortToGnd[ucHssChannel], 0u, == ); AL_UNITTEST_CHECK(CtrlSwi_sErrState.ucCntOpenLoad[ucHssChannel], 0u, == ); } for (ucHssChannel = 0u; ucHssChannel < 8u; ucHssChannel++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlSwi_sErrState.ucCntShortToVbat[ucHssChannel] = 1u; CtrlSwi_sErrState.ucCntShortToGnd[ucHssChannel] = 1u; CtrlSwi_sErrState.ucCntOpenLoad[ucHssChannel] = 1u; CtrlSwi_sErrState.ucErrOpenLoad[ucHssChannel] = ERR_NO; boDiagDelayDisabled = FALSE; boActualState = FALSE; CtrlSwi_aSwitchStatus[ucHssChannel].unErr_ValidFlag = TRUE; //Step 3) Call the FUT CtrlSwi_Diag_CheckAllErrors(ucHssChannel, boActualState, boDiagDelayDisabled); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlSwi_sErrState.ucCntOpenLoad[ucHssChannel], 0u, == ); AL_UNITTEST_CHECK(CtrlSwi_sErrState.ucErrOpenLoad[ucHssChannel], ERR_SNA, == ); } for (ucHssChannel = 0u; ucHssChannel < 8u; ucHssChannel++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT boDiagDelayDisabled = FALSE; boActualState = TRUE; CtrlSwi_aSwitchStatus[ucHssChannel].unErr_ValidFlag = TRUE; CtrlSwi_aSwitchStatus[ucHssChannel].eOpenLoad = ERR_SNA; //Step 3) Call the FUT CtrlSwi_Diag_CheckAllErrors(ucHssChannel, boActualState, boDiagDelayDisabled); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlSwi_sErrState.ucErrOpenLoad[ucHssChannel], ERR_SNA, == ); } } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlSwi_Diag_CheckShort2GndDuringOn /// /// \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_CtrlSwi_Diag_CheckShort2GndDuringOn(void) { //Step 1) Set pre - conditions uint8 ucHssChannel; for (ucHssChannel = 0u; ucHssChannel < 8u; ucHssChannel++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlSwi_aSwitchStatus[ucHssChannel].eShortGND = ERR_SNA; //Step 3) Call the FUT CtrlSwi_Diag_CheckShort2GndDuringOn(ucHssChannel); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlSwi_sErrState.ucErrShortToGnd[ucHssChannel], ERR_SNA, == ); } for (ucHssChannel = 0u; ucHssChannel < 8u; ucHssChannel++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlSwi_aSwitchStatus[ucHssChannel].eShortGND = ERR_NO; CtrlSwi_sErrState.ucCntShortToGnd[ucHssChannel] = 1u; //Step 3) Call the FUT CtrlSwi_Diag_CheckShort2GndDuringOn(ucHssChannel); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlSwi_sErrState.ucCntShortToGnd[ucHssChannel], 0u, == ); } for (ucHssChannel = 0u; ucHssChannel < 8u; ucHssChannel++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlSwi_aSwitchStatus[ucHssChannel].eShortGND = ERR_NO; CtrlSwi_sErrState.ucCntShortToGnd[ucHssChannel] = 0u; //Step 3) Call the FUT CtrlSwi_Diag_CheckShort2GndDuringOn(ucHssChannel); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlSwi_sErrState.ucErrShortToGnd[ucHssChannel], ERR_NO, == ); } for (ucHssChannel = 0u; ucHssChannel < 8u; ucHssChannel++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlSwi_aErrorDebounce[ucHssChannel].HSS_Short_Gnd_Debounce = 1u; CtrlSwi_aSwitchStatus[ucHssChannel].eShortGND = ERR_YES; CtrlSwi_sErrState.ucCntShortToGnd[ucHssChannel] = 0u; //Step 3) Call the FUT CtrlSwi_Diag_CheckShort2GndDuringOn(ucHssChannel); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlSwi_sErrState.ucCntShortToGnd[ucHssChannel], 1u, == ); } for (ucHssChannel = 0u; ucHssChannel < 8u; ucHssChannel++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlSwi_aErrorDebounce[ucHssChannel].HSS_Short_Gnd_Debounce = 1u; CtrlSwi_aSwitchStatus[ucHssChannel].eShortGND = ERR_YES; CtrlSwi_sErrState.ucCntShortToGnd[ucHssChannel] = 2u; //Step 3) Call the FUT CtrlSwi_Diag_CheckShort2GndDuringOn(ucHssChannel); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlSwi_sErrState.ucCntShortToGnd[ucHssChannel], 1u, == ); AL_UNITTEST_CHECK(CtrlSwi_sErrState.ucErrShortToGnd[ucHssChannel], ERR_YES, == ); AL_UNITTEST_CHECK(CtrlSwi_sErrState.ucErrShortToVbat[ucHssChannel], ERR_NO, == ); AL_UNITTEST_CHECK(CtrlSwi_sErrState.ucErrOpenLoad[ucHssChannel], ERR_NO, == ); } } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlSwi_Diag_CheckOpenloadDuringOn /// /// \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_CtrlSwi_Diag_CheckOpenloadDuringOn(void) { //Step 1) Set pre - conditions uint8 ucHssChannel; for (ucHssChannel = 0u; ucHssChannel < 8u; ucHssChannel++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlSwi_aSwitchStatus[ucHssChannel].eOpenLoad = ERR_SNA; //Step 3) Call the FUT CtrlSwi_Diag_CheckOpenloadDuringOn(ucHssChannel); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlSwi_sErrState.ucErrOpenLoad[ucHssChannel], ERR_SNA, == ); } for (ucHssChannel = 0u; ucHssChannel < 8u; ucHssChannel++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlSwi_aSwitchStatus[ucHssChannel].eOpenLoad = ERR_NO; CtrlSwi_sErrState.ucCntOpenLoad[ucHssChannel] = 0u; CtrlSwi_sErrState.ucCntShortToVbat[ucHssChannel] = 0u; //Step 3) Call the FUT CtrlSwi_Diag_CheckOpenloadDuringOn(ucHssChannel); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlSwi_sErrState.ucErrOpenLoad[ucHssChannel], ERR_NO, == ); AL_UNITTEST_CHECK(CtrlSwi_sErrState.ucErrShortToVbat[ucHssChannel], ERR_NO, == ); } for (ucHssChannel = 0u; ucHssChannel < 8u; ucHssChannel++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlSwi_aSwitchStatus[ucHssChannel].eOpenLoad = ERR_NO; CtrlSwi_sErrState.ucCntOpenLoad[ucHssChannel] = 1u; CtrlSwi_sErrState.ucCntShortToVbat[ucHssChannel] = 1u; //Step 3) Call the FUT CtrlSwi_Diag_CheckOpenloadDuringOn(ucHssChannel); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlSwi_sErrState.ucCntOpenLoad[ucHssChannel], 0u, == ); AL_UNITTEST_CHECK(CtrlSwi_sErrState.ucCntShortToVbat[ucHssChannel], 0u, == ); } for (ucHssChannel = 0u; ucHssChannel < 8u; ucHssChannel++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlSwi_aSwitchStatus[ucHssChannel].eOpenLoad = ERR_YES; CtrlSwi_sErrState.ucErrShortToVbat[ucHssChannel] = ERR_YES; //Step 3) Call the FUT CtrlSwi_Diag_CheckOpenloadDuringOn(ucHssChannel); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlSwi_sErrState.ucErrShortToGnd[ucHssChannel], ERR_NO, == ); AL_UNITTEST_CHECK(CtrlSwi_sErrState.ucErrOpenLoad[ucHssChannel], ERR_NO, == ); } for (ucHssChannel = 0u; ucHssChannel < 8u; ucHssChannel++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlSwi_aSwitchStatus[ucHssChannel].eOpenLoad = ERR_YES; CtrlSwi_sErrState.ucErrShortToVbat[ucHssChannel] = ERR_NO; CtrlSwi_sErrState.ucCntOpenLoad[ucHssChannel] = 2u; CtrlSwi_aErrorDebounce[ucHssChannel].HSS_Open_Load_Debounce = 1u; //Step 3) Call the FUT CtrlSwi_Diag_CheckOpenloadDuringOn(ucHssChannel); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlSwi_sErrState.ucCntOpenLoad[ucHssChannel], 1u, == ); AL_UNITTEST_CHECK(CtrlSwi_sErrState.ucErrOpenLoad[ucHssChannel], ERR_YES, == ); AL_UNITTEST_CHECK(CtrlSwi_sErrState.ucErrShortToGnd[ucHssChannel], ERR_NO, == ); } for (ucHssChannel = 0u; ucHssChannel < 8u; ucHssChannel++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlSwi_aSwitchStatus[ucHssChannel].eOpenLoad = ERR_YES; CtrlSwi_sErrState.ucErrShortToVbat[ucHssChannel] = ERR_NO; CtrlSwi_sErrState.ucCntOpenLoad[ucHssChannel] = 1u; CtrlSwi_aErrorDebounce[ucHssChannel].HSS_Open_Load_Debounce = 2u; //Step 3) Call the FUT CtrlSwi_Diag_CheckOpenloadDuringOn(ucHssChannel); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlSwi_sErrState.ucCntOpenLoad[ucHssChannel], 2u, == ); } } //----------------------------------------------------------------------------- /// \Test Case : Mt_CtrlSwi_Diag_CheckShort2VbatDuringOff /// /// \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_CtrlSwi_Diag_CheckShort2VbatDuringOff(void) { //Step 1) Set pre - conditions uint8 ucHssChannel; for (ucHssChannel = 0u; ucHssChannel < 8u; ucHssChannel++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlSwi_aSwitchStatus[ucHssChannel].eShortVBAT = ERR_SNA; //Step 3) Call the FUT CtrlSwi_Diag_CheckShort2VbatDuringOff(ucHssChannel); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlSwi_sErrState.ucErrShortToVbat[ucHssChannel], ERR_SNA, == ); } for (ucHssChannel = 0u; ucHssChannel < 8u; ucHssChannel++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlSwi_aSwitchStatus[ucHssChannel].eShortVBAT = ERR_NO; CtrlSwi_sErrState.ucCntShortToVbat[ucHssChannel] = 0u; //Step 3) Call the FUT CtrlSwi_Diag_CheckShort2VbatDuringOff(ucHssChannel); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlSwi_sErrState.ucErrShortToVbat[ucHssChannel], ERR_NO, == ); } for (ucHssChannel = 0u; ucHssChannel < 8u; ucHssChannel++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlSwi_aSwitchStatus[ucHssChannel].eShortVBAT = ERR_NO; CtrlSwi_sErrState.ucCntShortToVbat[ucHssChannel] = 1u; //Step 3) Call the FUT CtrlSwi_Diag_CheckShort2VbatDuringOff(ucHssChannel); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlSwi_sErrState.ucCntShortToVbat[ucHssChannel], 0u, == ); } for (ucHssChannel = 0u; ucHssChannel < 8u; ucHssChannel++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlSwi_aSwitchStatus[ucHssChannel].eShortVBAT = ERR_YES; CtrlSwi_aErrorDebounce[ucHssChannel].HSS_Short_Vbat_Debounce = 1u; CtrlSwi_sErrState.ucCntShortToVbat[ucHssChannel] = 2u; //Step 3) Call the FUT CtrlSwi_Diag_CheckShort2VbatDuringOff(ucHssChannel); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlSwi_sErrState.ucCntShortToVbat[ucHssChannel], 1u, == ); AL_UNITTEST_CHECK(CtrlSwi_sErrState.ucErrShortToGnd[ucHssChannel], ERR_NO, == ); AL_UNITTEST_CHECK(CtrlSwi_sErrState.ucErrShortToVbat[ucHssChannel], ERR_YES,==); AL_UNITTEST_CHECK(CtrlSwi_sErrState.ucErrOpenLoad[ucHssChannel], ERR_NO,==); } for (ucHssChannel = 0u; ucHssChannel < 8u; ucHssChannel++) { //Step 2) Assign all input values to the corresponding input variables identified in the FUT CtrlSwi_aSwitchStatus[ucHssChannel].eShortVBAT = ERR_YES; CtrlSwi_aErrorDebounce[ucHssChannel].HSS_Short_Vbat_Debounce = 2u; CtrlSwi_sErrState.ucCntShortToVbat[ucHssChannel] = 1u; //Step 3) Call the FUT CtrlSwi_Diag_CheckShort2VbatDuringOff(ucHssChannel); //Step 4) Check that the value of the output variables set/changed by the FUT matchs the corresponding expected output value AL_UNITTEST_CHECK(CtrlSwi_sErrState.ucCntShortToVbat[ucHssChannel], 2u, == ); } } void ALUnitTest_AddTests(void) { ALUnitTest_AddFunction("Mt_Rte_riCtrlSwiInit", Mt_Rte_riCtrlSwiInit); ALUnitTest_AddFunction("Mt_Rte_rpCtrlSwi10ms", Mt_Rte_rpCtrlSwi10ms); ALUnitTest_AddFunction("Mt_Rte_rdCtrlSwiDeInit", Mt_Rte_rdCtrlSwiDeInit); ALUnitTest_AddFunction("Mt_CtrlSwi_Init", Mt_CtrlSwi_Init); ALUnitTest_AddFunction("Mt_CtrlSwi_clamplightreq_judge", Mt_CtrlSwi_clamplightreq_judge); ALUnitTest_AddFunction("Mt_CtrlSwi_Cycle10ms", Mt_CtrlSwi_Cycle10ms); ALUnitTest_AddFunction("Mt_CtrlSwi_OperateOutputWithVoltState", Mt_CtrlSwi_OperateOutputWithVoltState); ALUnitTest_AddFunction("Mt_CtrlSwi_Diag_CheckAllErrors", Mt_CtrlSwi_Diag_CheckAllErrors); ALUnitTest_AddFunction("Mt_CtrlSwi_Diag_CheckShort2GndDuringOn", Mt_CtrlSwi_Diag_CheckShort2GndDuringOn); ALUnitTest_AddFunction("Mt_CtrlSwi_Diag_CheckOpenloadDuringOn", Mt_CtrlSwi_Diag_CheckOpenloadDuringOn); ALUnitTest_AddFunction("Mt_CtrlSwi_Diag_CheckShort2VbatDuringOff", Mt_CtrlSwi_Diag_CheckShort2VbatDuringOff); }