public void TestValues( int a, int b, ref int x )
{
if (a > 0) && (b > 0)
x = 1;
if (a < 0) && (b < 0)
x = -1;
}
Generate test cases for the code based on MC/DC coverage
criteria
Please find below test cases for code provided. Don't forget to give a Like.
MC/DC coverage for the first if loop:
a>0 | b>0 | Decision |
True(a=10) | True(b=5) | X=1(True) |
False(a=-1) | True(b=10) | Exits if loop(False)-No solution |
False(a=-10) | False(b=-10) | Exits if loop(False)-No solution |
True(a=5) | False(b=-1) | Exits if loop(False)-No solution |
MC/DC coverage for the second if loop:
a<0 | b<0 | Decision |
True(a=-1) | True(b=-3) | X=-1(True) |
False(b=10) | False(b=9) | Exits if loop-No solution |
True(b=-7) | False(b=19) | Exits if loop - No solution |
False(b=-20) | True(b=-5) | Exits if loop - No solution |
Thank you.
Get Answers For Free
Most questions answered within 1 hours.