Documente Academic
Documente Profesional
Documente Cultură
The first statement defines variable A. The second statement defines A and uses i , x, and y. Alternate: second statement defines A[i] and not the entire array A.
C-use
Uses of a variable that occur within an expression as part of an assignment statement, in an output statement, as a parameter within a function call, and in subscript expressions, are classified as c-use, where the ``c" in c-use stands for computational. How many c-uses of x can you find in the following statements?
Answer: 5
p-use
The occurrence of a variable in an expression used as a condition in a branch statement such as an if and a while, is considered as a p-use. The ``p" in p-use stands for predicate. How many p-uses of z and x can you find in the following statements?
Answer: 3 (2 of z and 1 of x)
All-defs coverage (ADC) : TR set consists of at least single definition-clear sub path from each definition to any particular use reached by that definition
Then we make sure that every def reaches all possible uses
All-uses coverage (AUC) : TR set consists of at least single definition-clear sub path from each definition to each use reached by that definition
Finally, we cover all the paths between defs and uses
All-du-paths coverage (ADUPC) : TR set consists of All definition-clear sub paths from each definition to each use reached by that definition
Z = X-8
All-defs for X
[ 0, 1, 3, 4 ]
All-uses for X
[ 0, 1, 3, 4 ] [ 0, 1, 3, 5 ]
All-du-paths for X
[ 0, 1, 3, 4 ] [ 0, 2, 3, 4 ]
[ 0, 1, 3, 5 ]
[ 0, 2, 3, 5 ]