Closed fcmartins closed 12 years ago
As you indicated I created three methods (below) and I generated the CFG of the three as you indicated (m1, m2 and finally m3).
/**
* @CoverageCriteria PRIME_PATH
* @InfeasiblePath [0, 1, 3]
* @AdditionalTestPath [0, 1, 2, 3]
*/
public void m1() {
int x = 0;
if (x == 0)
x = 2;
System.out.println(x);
}
public void m2 () {
int x = 0;
if (x < 2)
System.out.println("<2");
else
System.out.println(">2");
if (x + 1 < 3) {
x++;
int y = 0;
} else
x--;
}
public boolean m3 () {
int n = 2;
int num = 10;
boolean prime = true;
while (n * n <= num && prime) {
prime &= num % 2 != 0;
n++;
if(n > 5)
break;
}
while (n < 5) {
n++;
if(n > 5)
break;
}
if(prime)
return true;
else
return false;
}
As you can see, after the generation of the m1, the selected coverage criteria is @CoverageCriteria PRIME_PATH. (note: the coverage criteria only change if you select another one). This means that after generating the CFG for m3 the selected coverage criteria remains @CoverageCriteria PRIME_PATH.
Then i change the coverage criteria for @CoverageCriteria EDGE_PAIR. The obtained result are show below:
/**
* @CoverageCriteria PRIME_PATH
* @InfeasiblePath [0, 1, 3]
* @AdditionalTestPath [0, 1, 2, 3]
*/
public void m1() {
int x = 0;
if (x == 0)
x = 2;
System.out.println(x);
}
public void m2 () {
int x = 0;
if (x < 2)
System.out.println("<2");
else
System.out.println(">2");
if (x + 1 < 3) {
x++;
int y = 0;
} else
x--;
}
/**
* @CoverageCriteria EDGE_PAIR
* @InfeasiblePath [0, 1, 3]
* @AdditionalTestPath [0, 1, 2, 3]
*/
public boolean m3 () {
int n = 2;
int num = 10;
boolean prime = true;
while (n * n <= num && prime) {
prime &= num % 2 != 0;
n++;
if(n > 5)
break;
}
while (n < 5) {
n++;
if(n > 5)
break;
}
if(prime)
return true;
else
return false;
}
I think this shows that this problem no longer exists.
The class that interacts with the editor is not deleting its observers.