core: fix loop detection
This commit is contained in:
@@ -87,6 +87,23 @@ public class TestCF3 extends AbstractTest {
|
||||
return j > 10;
|
||||
}
|
||||
|
||||
private int testLoops(int[] a, int b) {
|
||||
int i = 0;
|
||||
while (i < a.length && i < b) {
|
||||
a[i]++;
|
||||
i++;
|
||||
}
|
||||
while (i < a.length) {
|
||||
a[i]--;
|
||||
i++;
|
||||
}
|
||||
int sum = 0;
|
||||
for (int e : a) {
|
||||
sum += e;
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
public static boolean testLabeledBreakContinue() {
|
||||
String searchMe = "Look for a substring in me";
|
||||
String substring = "sub";
|
||||
@@ -227,6 +244,8 @@ public class TestCF3 extends AbstractTest {
|
||||
assertEquals(testComplexIfInLoop3(6), 6);
|
||||
assertEquals(testComplexIfInLoop3(8), 24);
|
||||
|
||||
assertEquals(testLoops(new int[]{1, 2, 3, 4, 5, 6}, 2), 19);
|
||||
|
||||
assertTrue(testInline() > 20);
|
||||
assertTrue(testInline2());
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user