private static List<Integer> coveredLines(ISourceFileCoverage coverage) { List<Integer> coveredLines = new ArrayList<>(); for (int lineId = coverage.getFirstLine(); lineId <= coverage.getLastLine(); lineId++) { ILine line = coverage.getLine(lineId); switch (line.getInstructionCounter().getStatus()) { case ICounter.FULLY_COVERED: case ICounter.PARTLY_COVERED: coveredLines.add(lineId); break; case ICounter.NOT_COVERED: break; default: continue; } } return coveredLines; }
/** * Returns a tooltip for the branch coverage data. * * @param cov * branch coverage data * @return Tooltip if branch coverage data exists for the given line, * otherwise <code>null</code> */ private String getTooltip(ICounter cov) { switch (cov.getStatus()) { case ICounter.FULLY_COVERED: return "All " + cov.getTotalCount() + " branches covered."; case ICounter.PARTLY_COVERED: return cov.getMissedCount() + " of " + cov.getTotalCount() + " branches missed."; case ICounter.NOT_COVERED: return "All " + cov.getTotalCount() + " branches missed."; default: return null; } }
switch (branches.getStatus()) { case ICounter.NOT_COVERED: return span(pre, lineId, style, Styles.BRANCH_NOT_COVERED,
private static CoverageMeasuresBuilder analyzeFile(Resource resource, ISourceFileCoverage coverage) { CoverageMeasuresBuilder builder = CoverageMeasuresBuilder.create(); for (int lineId = coverage.getFirstLine(); lineId <= coverage.getLastLine(); lineId++) { final int hits; ILine line = coverage.getLine(lineId); switch (line.getInstructionCounter().getStatus()) { case ICounter.FULLY_COVERED: case ICounter.PARTLY_COVERED: hits = 1; break; case ICounter.NOT_COVERED: hits = 0; break; case ICounter.EMPTY: continue; default: JaCoCoScalaExtensions.LOG.warn("Unknown status for line {} in {}", lineId, resource); continue; } builder.setHits(lineId, hits); ICounter branchCounter = line.getBranchCounter(); int conditions = branchCounter.getTotalCount(); if (conditions > 0) { int coveredConditions = branchCounter.getCoveredCount(); builder.setConditions(lineId, conditions, coveredConditions); } } return builder; }
private CoverageMeasuresBuilder analyzeFile(Resource resource, ISourceFileCoverage coverage) { CoverageMeasuresBuilder builder = CoverageMeasuresBuilder.create(); for (int lineId = coverage.getFirstLine(); lineId <= coverage.getLastLine(); lineId++) { final int hits; ILine line = coverage.getLine(lineId); switch (line.getInstructionCounter().getStatus()) { case ICounter.FULLY_COVERED: case ICounter.PARTLY_COVERED: hits = 1; break; case ICounter.NOT_COVERED: hits = 0; break; case ICounter.EMPTY: continue; default: JaCoCoUtils.LOG.warn("Unknown status for line {} in {}", lineId, resource); continue; } builder.setHits(lineId, hits); ICounter branchCounter = line.getBranchCounter(); int conditions = branchCounter.getTotalCount(); if (conditions > 0) { int coveredConditions = branchCounter.getCoveredCount(); builder.setConditions(lineId, conditions, coveredConditions); } } return builder; }
private CoverageMeasuresBuilder analyzeFile(Resource resource, ISourceFileCoverage coverage) { CoverageMeasuresBuilder builder = CoverageMeasuresBuilder.create(); for (int lineId = coverage.getFirstLine(); lineId <= coverage.getLastLine(); lineId++) { final int hits; ILine line = coverage.getLine(lineId); switch (line.getInstructionCounter().getStatus()) { case ICounter.FULLY_COVERED: case ICounter.PARTLY_COVERED: hits = 1; break; case ICounter.NOT_COVERED: hits = 0; break; case ICounter.EMPTY: continue; default: JaCoCoExtensions.LOG.warn("Unknown status for line {} in {}", lineId, resource); continue; } builder.setHits(lineId, hits); ICounter branchCounter = line.getBranchCounter(); int conditions = branchCounter.getTotalCount(); if (conditions > 0) { int coveredConditions = branchCounter.getCoveredCount(); builder.setConditions(lineId, conditions, coveredConditions); } } return builder; }
ILine line = coverage.getLine(lineId); boolean ignore = false; switch (line.getInstructionCounter().getStatus()) { case ICounter.FULLY_COVERED: case ICounter.PARTLY_COVERED:
private static void analyzeFile(NewCoverage newCoverage, InputFile resource, ISourceFileCoverage coverage) { for (int lineId = coverage.getFirstLine(); lineId <= coverage.getLastLine(); lineId++) { final int hits; ILine line = coverage.getLine(lineId); switch (line.getInstructionCounter().getStatus()) { case ICounter.FULLY_COVERED: case ICounter.PARTLY_COVERED: hits = 1; break; case ICounter.NOT_COVERED: hits = 0; break; case ICounter.EMPTY: continue; default: JaCoCoExtensions.LOG.warn("Unknown status for line {} in {}", lineId, resource); continue; } newCoverage.lineHits(lineId, hits); ICounter branchCounter = line.getBranchCounter(); int conditions = branchCounter.getTotalCount(); if (conditions > 0) { int coveredConditions = branchCounter.getCoveredCount(); newCoverage.conditions(lineId, conditions, coveredConditions); } } } }