Search in sources :

Example 16 with ICounter

use of org.jacoco.core.analysis.ICounter in project jacoco by jacoco.

the class CyclomaticComplexityTest method testSwitch1.

@Test
public void testSwitch1() throws Exception {
    instrument(Switch.class);
    final ICounter complexity = analyze();
    assertEquals(CounterImpl.getInstance(3, 0), complexity);
}
Also used : ICounter(org.jacoco.core.analysis.ICounter) Test(org.junit.Test)

Example 17 with ICounter

use of org.jacoco.core.analysis.ICounter in project jacoco by jacoco.

the class CyclomaticComplexityTest method testSwitch2.

@Test
public void testSwitch2() throws Exception {
    instrument(Switch.class);
    target.test(0);
    final ICounter complexity = analyze();
    assertEquals(CounterImpl.getInstance(2, 1), complexity);
}
Also used : ICounter(org.jacoco.core.analysis.ICounter) Test(org.junit.Test)

Example 18 with ICounter

use of org.jacoco.core.analysis.ICounter in project jacoco by jacoco.

the class CyclomaticComplexityTest method testNestedIf3.

@Test
public void testNestedIf3() throws Exception {
    instrument(NestedIf.class);
    target.test(-1);
    target.test(0);
    final ICounter complexity = analyze();
    assertEquals(CounterImpl.getInstance(1, 2), complexity);
}
Also used : ICounter(org.jacoco.core.analysis.ICounter) Test(org.junit.Test)

Example 19 with ICounter

use of org.jacoco.core.analysis.ICounter in project jacoco by jacoco.

the class CyclomaticComplexityTest method testTwoIf4.

@Test
public void testTwoIf4() throws Exception {
    instrument(TwoIf.class);
    target.test(-1);
    target.test(+1);
    final ICounter complexity = analyze();
    assertEquals(CounterImpl.getInstance(0, 3), complexity);
}
Also used : ICounter(org.jacoco.core.analysis.ICounter) Test(org.junit.Test)

Example 20 with ICounter

use of org.jacoco.core.analysis.ICounter in project jacoco by jacoco.

the class CyclomaticComplexityTest method testNestedIf4.

@Test
public void testNestedIf4() throws Exception {
    instrument(NestedIf.class);
    target.test(-1);
    target.test(0);
    target.test(+1);
    final ICounter complexity = analyze();
    assertEquals(CounterImpl.getInstance(0, 3), complexity);
}
Also used : ICounter(org.jacoco.core.analysis.ICounter) Test(org.junit.Test)

Aggregations

ICounter (org.jacoco.core.analysis.ICounter)50 Test (org.junit.Test)40 CounterEntity (org.jacoco.core.analysis.ICoverageNode.CounterEntity)2 FileWriter (java.io.FileWriter)1 PrintWriter (java.io.PrintWriter)1 Collection (java.util.Collection)1 List (java.util.List)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 IBundleCoverage (org.jacoco.core.analysis.IBundleCoverage)1 IClassCoverage (org.jacoco.core.analysis.IClassCoverage)1 ILine (org.jacoco.core.analysis.ILine)1 IMethodCoverage (org.jacoco.core.analysis.IMethodCoverage)1 IPackageCoverage (org.jacoco.core.analysis.IPackageCoverage)1 ISourceFileCoverage (org.jacoco.core.analysis.ISourceFileCoverage)1 Instruction (org.jacoco.core.internal.flow.Instruction)1 IReportVisitor (org.jacoco.report.IReportVisitor)1 ISourceFileLocator (org.jacoco.report.ISourceFileLocator)1 AbstractInsnNode (org.objectweb.asm.tree.AbstractInsnNode)1