Search in sources :

Example 36 with ICounter

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

the class CyclomaticComplexityTest method testIf2.

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

Example 37 with ICounter

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

the class CyclomaticComplexityTest method testTwoIf2.

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

Example 38 with ICounter

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

the class CyclomaticComplexityTest method testSimple1.

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

Example 39 with ICounter

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

the class CyclomaticComplexityTest method testSwitch3.

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

Example 40 with ICounter

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

the class CyclomaticComplexityTest method testNestedIf1.

@Test
public void testNestedIf1() throws Exception {
    instrument(NestedIf.class);
    final ICounter complexity = analyze();
    assertEquals(CounterImpl.getInstance(3, 0), 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