This article'stone or style may not reflect theencyclopedic tone used on Wikipedia. See Wikipedia'sguide to writing better articles for suggestions.(May 2016) (Learn how and when to remove this message) |
Thedomain-to-range ratio (DRR) is a ratio which describes how the number of outputs corresponds to the number of inputs of a given logicalfunction orsoftware component. The domain-to-range ratio is a mathematical ratio ofcardinality between theset of the function's possible inputs (thedomain) and the set of possible outputs (therange).[1][2] For a function defined on a domain,, and a range,, the domain-to-range ratio is given as:It can be used to measure the risk of missing potentialerrors when testing the range of outputs alone.[3]
Consider the functionisEven() below, which checks the parity of anunsigned short number, any value between and, and yields aboolean value which corresponds to whether is even or odd. This solution takes advantage of the fact that integer division in programming typically rounds towards zero.
boolisEven(unsignedshortx){return(x/2)==((x+3)/2-1);}
Because can be any value from to, the function's domain has a cardinality of. The function yields, if is even, or, if is odd. This is expressed as the range, which has acardinality of. Therefore, the domain-to-range ratio ofisEven() is given by:Here, the domain-to-range ratio indicates that this function would require a comparatively large number of tests to find errors. If a test program attempts every possible value of in order from to, the program would have to perform tests for each of the two possible outputs in order to find errors oredge cases. Because errors in functions with a high domain-to-range ratio are difficult to identify viamanual testing or methods which reduce the number of tested inputs, such asorthogonal array testing or all-pairs testing, morecomputationally complex techniques may be used, such asfuzzing orstatic program analysis, to find errors.
Thissoftware-engineering-related article is astub. You can help Wikipedia byexpanding it. |
Thismathematics-related article is astub. You can help Wikipedia byexpanding it. |