Search in sources :

Example 1 with ICounter

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

the class CounterImplTest method testGetInstance3.

@Test
public void testGetInstance3() {
    ICounter c = CounterImpl.getInstance(15, 12);
    ICounter copy = CounterImpl.getInstance(c);
    assertEquals(27, copy.getTotalCount());
    assertEquals(27.0, c.getValue(CounterValue.TOTALCOUNT), 0.0);
    assertEquals(15, copy.getMissedCount());
    assertEquals(15.0, c.getValue(CounterValue.MISSEDCOUNT), 0.0);
    assertEquals(12, copy.getCoveredCount());
    assertEquals(12.0, c.getValue(CounterValue.COVEREDCOUNT), 0.0);
}
Also used : ICounter(org.jacoco.core.analysis.ICounter) Test(org.junit.Test)

Example 2 with ICounter

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

the class CounterImplTest method testToString.

@Test
public void testToString() {
    ICounter c = CounterImpl.getInstance(300, 123);
    assertEquals("Counter[300/123]", c.toString());
}
Also used : ICounter(org.jacoco.core.analysis.ICounter) Test(org.junit.Test)

Example 3 with ICounter

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

the class CounterImplTest method testGetInstance2.

@Test
public void testGetInstance2() {
    ICounter c = CounterImpl.getInstance(33, 15);
    assertEquals(48, c.getTotalCount());
    assertEquals(48.0, c.getValue(CounterValue.TOTALCOUNT), 0.0);
    assertEquals(33, c.getMissedCount());
    assertEquals(33.0, c.getValue(CounterValue.MISSEDCOUNT), 0.0);
    assertEquals(15, c.getCoveredCount());
    assertEquals(15.0, c.getValue(CounterValue.COVEREDCOUNT), 0.0);
}
Also used : ICounter(org.jacoco.core.analysis.ICounter) Test(org.junit.Test)

Example 4 with ICounter

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

the class CounterImplTest method testGetCoveredRatio2.

@Test
public void testGetCoveredRatio2() {
    ICounter c = CounterImpl.getInstance(20, 0);
    assertEquals(0.0, c.getCoveredRatio(), 0.0);
    assertEquals(0.0, c.getValue(CounterValue.COVEREDRATIO), 0.0);
}
Also used : ICounter(org.jacoco.core.analysis.ICounter) Test(org.junit.Test)

Example 5 with ICounter

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

the class CounterImplTest method testGetMissedRatio3.

@Test
public void testGetMissedRatio3() {
    ICounter c = CounterImpl.getInstance(0, 0);
    assertEquals(Double.NaN, c.getMissedRatio(), 0.0);
    assertEquals(Double.NaN, c.getValue(CounterValue.MISSEDRATIO), 0.0);
}
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