When a value cannot be entered in the test case because the register variable is declared as a macro
#define IN_IG_ON (int8_t)(PORTDbits.RD0)
#define IN_INTER_LOCK_SNSR (int8_t)(PORTDbits.RD2)
#define IN_DIFF_LOCK_SNSR_2ND (int8_t)(PORTDbits.RD3)
#define IN_DIFF_LOCK_SNSR_3RD (int8_t)(PORTDbits.RD12)
if((IN_IG_ON == OFF) && (getHazardSwitch() == OFF) && (getBrakeSwitch() == OFF))
{
}
In the code above, the return value of the getHazardSwitch() or getBrakeSwitch() function can be changed using a stub, but the value of IN_IG_ON is declared as a macro, so the value cannot be controlled in the test case.
In this case, the customer needs to modify the code so that the use of register variables can be bundled into a function and treated as a stub.
Need more help with this?
Don’t hesitate to contact us here.