Content deleted Content added
Citation bot (talk | contribs) Alter: template type, pages. Add: isbn, journal, s2cid. Removed parameters. Formatted dashes. Some additions/deletions were actually parameter name changes. Correct ISBN10 to ISBN13. | You can use this bot yourself. Report bugs here. | Suggested by AManWithNoPlan | All pages linked from cached copy of User:AManWithNoPlan/sandbox3 | via #UCB_webform_linked 786/953 |
|||
Line 29:
{{Dubious|date=January 2018}}
Purely syntactic rearrangements of decisions (breaking them into several independently evaluated conditions using temporary variables, the values of which are then used in the decision) which do not change the semantics of a program can lower the difficulty of obtaining complete MC/DC coverage.<ref>{{cite journal | title = The Effect of Program and Model Structure on MC⁄DC Test Adequacy Coverage | last1 = Rajan | first1 = Ajitha | last2 = Heimdahl | first2 = Mats | last3 = Whalen | first3 = Michael | date = March 2003 | url = http://se.inf.ethz.ch/old/teaching/2009-S/0276/slides/fiva.pdf }}</ref> This is because MC/DC is driven by the program syntax. However, this kind of "cheating" can be done to simplify expressions, not simply to avoid MC/DC complexities. For example, assignment of the number of days in a month (excluding leap years) could be achieved by using either a switch statement or by using a table with an enumeration value as an index. The number of tests required based on the source code could be considerably different depending upon the coverage required, although semantically we would want to test both approaches with a minimum number of tests.
Another example which demonstrates "cheating" to achieve higher MC/DC is:<syntaxhighlight lang="c" line="1">
/* Function A */
bool function_a (int a, bool b, bool c, bool d, bool e, bool f)
{
if (a == 100)
{
if (b || c)
// statement 1
if (d || e || f)
// statement 2
}
}
</syntaxhighlight><syntaxhighlight lang="c" line="1">
/* Function B */
bool function_b ( int a, bool b, bool c, bool d, bool e, bool f )
{
bool a_is_equal_to_100 = a == 100 ;
bool b_or_c = b ||c ;
bool d_or_e_or_f = d || e || f ;
if (a_is_equal_to_100)
{
if (b_or_c)
// statement 1
if (d_or_e_or_f)
// statement 2
}
}
</syntaxhighlight>In the above example Function B is likley to have higher MC/DC than Function A for a given set of test cases, eventhough functionally both are the same.
==RC/DC==
|