Search in sources :

Example 41 with ICounter

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

the class CyclomaticComplexityTest method testNestedIf2.

@Test
public void testNestedIf2() throws Exception {
    instrument(NestedIf.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 42 with ICounter

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

the class CyclomaticComplexityTest method testIf1.

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

Example 43 with ICounter

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

the class CyclomaticComplexityTest method testIf3.

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

Example 44 with ICounter

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

the class CyclomaticComplexityTest method testSimple2.

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

Example 45 with ICounter

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

the class CyclomaticComplexityTest method testTwoIf1.

@Test
public void testTwoIf1() throws Exception {
    instrument(TwoIf.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