Package org.jacoco.core.analysis

Examples of org.jacoco.core.analysis.ICounter


    // Report result:
    coverage.ensureCapacity(firstLine, lastLine);
    for (final Instruction i : instructions) {
      final int total = i.getBranches();
      final int covered = i.getCoveredBranches();
      final ICounter instructions = covered == 0 ? CounterImpl.COUNTER_1_0
          : CounterImpl.COUNTER_0_1;
      final ICounter branches = total > 1 ? CounterImpl.getInstance(total
          - covered, covered) : CounterImpl.COUNTER_0_0;
      coverage.increment(instructions, branches, i.getLine());
    }
  }
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

    for (int nr = source.getFirstLine(); nr <= last; nr++) {
      final ILine line = source.getLine(nr);
      if (line.getStatus() != ICounter.EMPTY) {
        final XMLElement element = parent.element("line");
        element.attr("nr", nr);
        final ICounter insn = line.getInstructionCounter();
        element.attr("mi", insn.getMissedCount());
        element.attr("ci", insn.getCoveredCount());
        final ICounter branches = line.getBranchCounter();
        element.attr("mb", branches.getMissedCount());
        element.attr("cb", branches.getCoveredCount());
      }
    }
  }
View Full Code Here

  }

  @Override
  public boolean equals(final Object obj) {
    if (obj instanceof ICounter) {
      final ICounter that = (ICounter) obj;
      return this.missed == that.getMissedCount()
          && this.covered == that.getCoveredCount();
    } else {
      return false;
    }
  }
View Full Code Here

    // Report result:
    coverage.ensureCapacity(firstLine, lastLine);
    for (final Instruction i : instructions) {
      final int total = i.getBranches();
      final int covered = i.getCoveredBranches();
      final ICounter instructions = covered == 0 ? CounterImpl.COUNTER_1_0
          : CounterImpl.COUNTER_0_1;
      final ICounter branches = total > 1 ? CounterImpl.getInstance(total
          - covered, covered) : CounterImpl.COUNTER_0_0;
      coverage.increment(instructions, branches, i.getLine());
    }
  }
View Full Code Here

    // Report result:
    coverage.ensureCapacity(firstLine, lastLine);
    for (final Instruction i : instructions) {
      final int total = i.getBranches();
      final int covered = i.getCoveredBranches();
      final ICounter instrCounter = covered == 0 ? CounterImpl.COUNTER_1_0
          : CounterImpl.COUNTER_0_1;
      final ICounter branchCounter = total > 1 ? CounterImpl.getInstance(
          total - covered, covered) : CounterImpl.COUNTER_0_0;
      coverage.increment(instrCounter, branchCounter, i.getLine());
    }
    coverage.incrementMethodCounter();
  }
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

    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

  /**
   * This method must be called exactly once after all instructions and
   * branches have been incremented for this method coverage node.
   */
  public void incrementMethodCounter() {
    final ICounter base = this.instructionCounter.getCoveredCount() == 0 ? CounterImpl.COUNTER_1_0
        : CounterImpl.COUNTER_0_1;
    this.methodCounter = this.methodCounter.increment(base);
    this.complexityCounter = this.complexityCounter.increment(base);
  }
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.