[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:       Richard Hipp <drh () sqlite ! org>
Date:       2011-09-24 12:10:53
Message-ID: CALwJ=Mw4Ei+5BTGJQGsZ9zJtwcDBccRWYG0LFJ=OtEr1Yg=KeQ () mail ! gmail ! com
[Download RAW message or body]

On Sat, Sep 24, 2011 at 7:49 AM, Sami Liedes <sliedes@cc.hut.fi> wrote:

>
> The example is a four-input AND gate with short-circuit logic (_ =
> don't care/not evaluated). This would be a sufficient set of tests:
>
> expression = (A && B && C && D)
>
> #    A  B  C  D  Result
> 1    1  1  1  1  1
> 2    0  _  _  _  0
> 3    1  0  _  _  0
> 4    1  1  0  _  0
> 5    1  1  1  0  0
>

The SQLite test suite does this full set of tests.


>
> Am I correct that your approach would consider these two test cases
> sufficient?
>
> #    A  B  C  D  Result
> 1    1  1  1  1  1
> 2    0  0  0  0  0
>
> Right?
>

No.  Your second example does not provide 100% branch coverage.  The
compiler will code the decision something like this:

     if( !A ) goto false;
     if( !B ) goto false;
     if( !C ) goto false;
     if( !D ) goto false;
     expression = 1;
     goto end;
  false:
     expression = 0;
  end:

We verify in SQLite that each of the 4 branch operations in the pseudocode
above is evaluated at least once in each direction.  That means we need 5
test cases: (0,x,x,x), (1,0,x,x), (1,1,0,x), (1,1,1,0), and (1,1,1,1).


>
> But with these test cases, assuming short-circuit, only condition A
> has been shown to "independently affect the expression's outcome". The
> NASA document correctly points out that even with short-circuit you
> need to show that each of the conditions really matters in some case
> if you want MC/DC coverage.
>

I have not read the NASA document yet (I just pulled it up and I've not run
across it before) but it looks like they are arguing my point.  I'll read it
today and let you know.


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



-- 
D. Richard Hipp
drh@sqlite.org
_______________________________________________
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