a.
b.
To make the t2 more likely be discovered than t1, we can change the “while test” to be “while(numPrimes<3)”.
c.
To skip the while loop, we just need to test “n =1”.
d.
Node coverage={1,2,3,4,5,6,7,8,9,10,11,12,13}
Edge coverage={(1,2),(2,3),(2,4),(3,5),(4,11),(5,6),(5,9),(6,5),(6,8),(7,5),(8,9),(9,2),(9,10),(10,2),
(11,12),(11,13),(12,11)}
Prime path coverage={(1, 2 4 11 13),(1 2 4 11 12),(1 2 3 5 6 7),(1 2 3 5 6 8 9 10),(1 2 3 5 9 10),(2 3 5 6 8 2),(2 3 5 9 2),(2 3 5 9 10 2),(3 5 6 8 9 2 3),(3 5 6 8 9 10 2 3),(3 5 9 10 2 3),(3 5 9 2 3),(3 5 6 8 9 2 4 11 13),(3 5 6 8 9 2 4 11 12),(3 5 6 8 9 10 2 4 11 13),(3 5 6 8 9 10 2 4 11 12),(3 5 9 10 2 4 11 13),(3 5 9 10 2 4 11 12),(3 5 9 2 4 11 13),(3 5 9 2 4 11 12),(5 6 7 5),(5 6 8 9 2 3 5),(5 6 8 9 10 2 3 5),(5 9 10 2 3 5),(5 9 2 3 5),(5 6 8 9 2 4 11 13),(5 6 8 9 2 4 11 12),(5 6 8 9 10 2 4 11 13),(5 6 8 9 10 2 4 11 12),(5 9 10 2 4 11 13),(5 9 10 2 4 11 12),(5 9 2 4 11 13),(5 9 2 4 11 12),(6 7 5 6),(6 7 5 9 2 3),(6 7 5 9 10 2 3),(6 8 9 10 2 3 5 6),(6 7 5 9 2 4 11 13),(6 7 5 9 2 4 11 12),(6 7 5 9 10 2 4 11 13),(6 7 5 9 10 2 4 11 12),(7 5 6 7),(7 5 6 8 9 2 3),(7 5 6 8 9 2 4 11 13),(7 5 6 8 9 2 4 11 12),(7 5 6 8 9 10 2 3),(7 5 6 8 9 10 2 4 11 12),(8 9 2 3 5 6 7),(8 9 2 3 5 6 8),(8 9 10 2 3 5 6 7),(8 9 10 2 3 5 6 8),(9 2 3 5 6 8 9),(9 2 3 5 9),(9 10 2 3 5 6 8 9),(9 10 2 3 5 9),(10 2 3 5 6 8 9 10),(10 2 3 5 9 10),(11 12 11),(12 11 13),(12 11 12)}
Print path test:
以上次的三角形问题为例:
即使用(3,3,3)、(4,6,6)、(1,2,3)可完成全部测试用例的覆盖