1

I've been doing a little bit of reviewing the different code coverage testing used on embedded systems. In particular, I'm looking at the MC/DC. From what I understand, one of the objectives is to make sure that each logical clause in a statement should affect the outcome of the statement.

Two questions:

  1. What is gained by independently verifying that each clause has an effect on the outcome?
  2. Why would (A||B) && (A||!C) not be able to achieve 100% MC/DC, while A||(B&&!C) will achieve 100% MC/DC even if they have the exact same functionality?

1 Answer 1

2

To answer your questions

  1. You want as little of code as possible and as less complex code as possible. Having unreachable conditions lengthens your code and makes your code unnecessarily complex.

  2. (A||B) && (A||!C) won't achieve 100% because it requires A to be checked twice for no reason. In the condition where A is false and B is true, A's truthiness will be checked for a second time in the (A||!C) expression for no reason in this formulation whereas in the formula A||(B&&!C) has A's truthiness being checked only once.

Sign up to request clarification or add additional context in comments.

2 Comments

So the main target of the MC/DC is to reduce complexity?
The goal of MC/DC is to test every possible outcome with as little complexity as possible.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.