Text: input x;
y = 7; // node 1
while (x < 0) // node 2
{
input y; // node 3
if (y < x + 7) // node 4
{
x -= y; // node 5
}
print y; // node 6
}
print x; // node 7
b) (2 points) Which places is the variable x defined?
c) (2 points) Which places is the variable y defined?
d) (2 points) Which places is the variable x used?
e) (2 points) Which places is the variable y used?
f) (4 points) Give all of the du-paths for variables x and y.
g) (4 points) Give the test requirements for all-uses coverage.
h) (4 points) Consider the following test paths. Create a matrix that gives test paths as rows and du-paths for variable x as columns. For each box in the matrix, mark the box with a 't' if that test path tours that du-path with a direct tour, with an 's' if it tours it with a side trip, or with a 'd' if it tours it with a detour. Otherwise, leave the box blank.
T: [1,2,7] T2: [1,2,3,4,6,2,7] T3: [1,2,3,4,5,6,2,7] T4: [1,2,3,4,5,6,2,3,4,5,6,2,7] Ts: [1,2,3,4,6,2,3,4,6,2,7]
i) (4 points) What is a minimal set of test paths that achieves all-du-paths coverage for variable x using direct tours only.