Package org.jacoco.core.analysis

Examples of org.jacoco.core.analysis.ICounter


    assertFalse(c1.hashCode() == c2.hashCode());
  }

  @Test
  public void testToString() {
    ICounter c = CounterImpl.getInstance(300, 123);
    assertEquals("Counter[300/123]", c.toString());
  }
View Full Code Here


  public void item(final HTMLElement td, final ITableItem item,
      final Resources resources, final ReportOutputFolder base)
      throws IOException {
    if (max > 0) {
      final ICounter counter = item.getNode().getCounter(entity);
      final int missed = counter.getMissedCount();
      bar(td, missed, Resources.REDBAR, resources, base);
      final int covered = counter.getCoveredCount();
      bar(td, covered, Resources.GREENBAR, resources, base);
    }
  }
View Full Code Here

    element.close();
  }

  private void createCounterElement(final CounterEntity counterEntity)
      throws IOException {
    final ICounter counter = node.getCounter(counterEntity);
    if (counter.getTotalCount() > 0) {
      final XMLElement counterNode = this.element.element("counter");
      counterNode.attr("type", counterEntity.name());
      counterNode.attr("covered", counter.getCoveredCount());
      counterNode.attr("missed", counter.getMissedCount());
      counterNode.close();
    }
  }
View Full Code Here

*/
public class CounterImplTest {

  @Test
  public void testGetInstance1() {
    ICounter c = CounterImpl.getInstance(0, 0);
    assertEquals(0, c.getTotalCount());
    assertEquals(0, c.getMissedCount());
    assertEquals(0, c.getCoveredCount());
  }
View Full Code Here

    assertEquals(0, c.getCoveredCount());
  }

  @Test
  public void testGetInstance2() {
    ICounter c = CounterImpl.getInstance(33, 15);
    assertEquals(48, c.getTotalCount());
    assertEquals(33, c.getMissedCount());
    assertEquals(15, c.getCoveredCount());
  }
View Full Code Here

    assertEquals(15, c.getCoveredCount());
  }

  @Test
  public void testGetInstance3() {
    ICounter c = CounterImpl.getInstance(15, 12);
    ICounter copy = CounterImpl.getInstance(c);
    assertEquals(27, copy.getTotalCount());
    assertEquals(15, copy.getMissedCount());
    assertEquals(12, copy.getCoveredCount());
  }
View Full Code Here

    assertEquals(12, copy.getCoveredCount());
  }

  @Test
  public void testFixInstance() {
    ICounter c1 = CounterImpl.getInstance(30, 30);
    ICounter c2 = CounterImpl.getInstance(30, 30);
    assertSame(c1, c2);
  }
View Full Code Here

    assertSame(c1, c2);
  }

  @Test
  public void testVarInstance() {
    ICounter c1 = CounterImpl.getInstance(31, 30);
    ICounter c2 = CounterImpl.getInstance(31, 30);
    assertNotSame(c1, c2);
  }
View Full Code Here

    assertEquals(8, c.getCoveredCount());
  }

  @Test
  public void testGetCoveredRatio1() {
    ICounter c = CounterImpl.getInstance(30, 10);
    assertEquals(0.25, c.getCoveredRatio(), 0.0);
  }
View Full Code Here

    assertEquals(0.25, c.getCoveredRatio(), 0.0);
  }

  @Test
  public void testGetCoveredRatio2() {
    ICounter c = CounterImpl.getInstance(20, 0);
    assertEquals(0.0, c.getCoveredRatio(), 0.0);
  }
View Full Code Here

TOP

Related Classes of org.jacoco.core.analysis.ICounter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.