[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sqlite-users
Subject:    Re: [sqlite] MC/DC coverage explained wrong in the home page?
From:       Sami Liedes <sliedes () cc ! hut ! fi>
Date:       2011-09-24 11:35:42
Message-ID: 20110924113542.GP31808 () sli ! homeunix ! net
[Download RAW message or body]

On Fri, Sep 23, 2011 at 10:26:43PM -0400, Pavel Ivanov wrote:
> >   if (A || 1) ...
> >
> > You can get (e) by giving test cases for A and !A, but most certainly
> > flipping A does not "independently affect the outcome" as required by
> > the plain reading of (f).
> 
> I'm pretty sure that the latest versions of modern compilers will
> optimize the above if statement to the following:
> 
> A;
> // everything inside if
> 
> They won't even check the outcome of A and even won't calculate any
> part of A that has no side effects (and it's known at compile time).
> So in an object file A is not a condition and can hardly be called a
> boolean expression. Does (d), (e) and (f) even apply to it?

That's also entirely beside the point. Using that same argument you
could say you don't need to remove dead code because a clever compiler
does it for you, which is obviously hogwash. Good luck arguing like
that in front of some organization that wants 100% code coverage :)

Dead code is indicative of a bug. Usually programmers write code only
in the expectation that it be run. The same can be said of conditions
in an if statement, and what the compiler does to it doesn't change
that.

MC/DC is just a clever way of saying that you must show that each
condition in an if statement really matters.

	Sami
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic