My piece of code which I am doing unit testing on is something like this:
if(((State !=TCPIP_IPADDR_STATE_ASSIGNED)&& (State !=TCPIP_IPADDR_STATE_ONHOLD) && (State !=TCPIP_IPADDR_STATE_UNASSIGNED)) ||(SoConId==DOIP_INVALID_16))
{
}
And my unit test case includes following :
`DoIP_LocalIpAddrAssignmentChg(12,0xFF);`
Where DoIP_LocalIpAddrAssignmentChg is the function name in which if is located and 0xFF is for invalid state which is obviously not equal to all 3 : TCPIP_IPADDR_STATE_ASSIGNED, TCPIP_IPADDR_STATE_ONHOLD, TCPIP_IPADDR_STATE_UNASSIGNED. The value of SoConId is 12. The value of DOIP_INVALID_16 = 0xFF.
So when I check my unit test report, its gives this result:
My question is why it's not covering condition for TCPIP_IPADDR_STATE_UNASSIGNED as value for state I am passing is 0xFF which is invalid value.