Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Domain-to-range ratio

From Wikipedia, the free encyclopedia

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,D{\displaystyle D}, and a range,R{\displaystyle R}, the domain-to-range ratio is given as:DRR=|D||R|{\displaystyle DRR={\frac {|D|}{|R|}}}It can be used to measure the risk of missing potentialerrors when testing the range of outputs alone.[3]

Example

[edit]

Consider the functionisEven() below, which checks the parity of anunsigned short numberx{\displaystyle x}, any value between0{\displaystyle 0} and65,536{\displaystyle 65,536}, and yields aboolean value which corresponds to whetherx{\displaystyle x} 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);}

Becausex{\displaystyle x} can be any value from0{\displaystyle 0} to65,535{\displaystyle 65,535}, the function's domain has a cardinality of65,536{\displaystyle 65,536}. The function yields0{\displaystyle 0}, ifx{\displaystyle x} is even, or1{\displaystyle 1}, ifx{\displaystyle x} is odd. This is expressed as the range{0;1}{\displaystyle \{0;1\}}, which has acardinality of2{\displaystyle 2}. Therefore, the domain-to-range ratio ofisEven() is given by:DRR=65,5362=32,768{\displaystyle DRR={65,536 \over 2}=32,768}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 ofx{\displaystyle x} in order from0{\displaystyle 0} to65,535{\displaystyle 65,535}, the program would have to perform32,768{\displaystyle 32,768} 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.

See also

[edit]

References

[edit]
  1. ^Voas, J.M.; Miller, K.W. (March 1993). "Semantic metrics for software testability".Journal of Systems and Software.20 (3):207–216.doi:10.1016/0164-1212(93)90064-5.
  2. ^Woodward, Martin R.; Al-Khanjari, Zuhoor A. (5 September 2000).Testability, fault size and the domain-to-range ratio: An eternal triangle. ACM SIGSOFT. pp. 168–172.doi:10.1145/347324.349016.ISBN 978-1-58113-266-3.S2CID 17772461.
  3. ^Tarlinder, Alexander (2016).Developer testing : building quality into software. Addison-Wesley.ISBN 978-0-13-429106-2.OCLC 992888632.


Stub icon

Thissoftware-engineering-related article is astub. You can help Wikipedia byexpanding it.

Stub icon

Thismathematics-related article is astub. You can help Wikipedia byexpanding it.

Stub icon

Thislogic-related article is astub. You can help Wikipedia byexpanding it.

Retrieved from "https://en.wikipedia.org/w/index.php?title=Domain-to-range_ratio&oldid=1246525150"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp