X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.scl.compiler%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Fmodule%2Fcoverage%2FModuleCoverage.java;h=c933a0fb999e75582b784791d01af018c3efa62b;hb=3c2807a26920491016a1887d2c1a95609c082a19;hp=bad4012dcfbedca90819a22d1469a5aff2456403;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/module/coverage/ModuleCoverage.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/module/coverage/ModuleCoverage.java index bad4012dc..c933a0fb9 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/module/coverage/ModuleCoverage.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/module/coverage/ModuleCoverage.java @@ -1,41 +1,41 @@ -package org.simantics.scl.compiler.module.coverage; - -import java.io.PrintStream; -import java.util.Arrays; - -import gnu.trove.map.hash.THashMap; - -public class ModuleCoverage extends AbstractCoverage { - - public final THashMap functionCoverages; - - public final int totalFunctionCount; - public final int coveredFunctionCount; - public final double functionCoverage; - - public ModuleCoverage(String moduleName, THashMap functionCoverages, - int totalCodeSize, int coveredCodeSize, - int totalFunctionCount, int coveredFunctionCount) { - - super(moduleName, totalCodeSize, coveredCodeSize); - this.functionCoverages = functionCoverages; - this.totalFunctionCount = totalFunctionCount; - this.coveredFunctionCount = coveredFunctionCount; - this.functionCoverage = CoverageUtils.safeDiv(coveredFunctionCount, totalFunctionCount); - } - - public void print(PrintStream s) { - s.println("Code coverage: " + toPercent(getCoverage()) + - " (" + getCoveredCodeSize() + " / " + getTotalCodeSize() + ")"); - s.println("Function coverage: " + toPercent(functionCoverage) + - " (" + coveredFunctionCount + " / " + totalFunctionCount + ")"); - String[] functionNames = functionCoverages.keySet().toArray(new String[functionCoverages.size()]); - Arrays.sort(functionNames); - for(String functionName : functionNames) { - FunctionCoverage fCov = functionCoverages.get(functionName); - s.println(" " + functionName + ": " + toPercent(fCov.getCoverage()) + - " (" + fCov.coveredCodeSize + " / " + fCov.totalCodeSize + ")"); - } - } - -} +package org.simantics.scl.compiler.module.coverage; + +import java.io.PrintStream; +import java.util.Arrays; + +import gnu.trove.map.hash.THashMap; + +public class ModuleCoverage extends AbstractCoverage { + + public final THashMap functionCoverages; + + public final int totalFunctionCount; + public final int coveredFunctionCount; + public final double functionCoverage; + + public ModuleCoverage(String moduleName, THashMap functionCoverages, + int totalCodeSize, int coveredCodeSize, + int totalFunctionCount, int coveredFunctionCount) { + + super(moduleName, totalCodeSize, coveredCodeSize); + this.functionCoverages = functionCoverages; + this.totalFunctionCount = totalFunctionCount; + this.coveredFunctionCount = coveredFunctionCount; + this.functionCoverage = CoverageUtils.safeDiv(coveredFunctionCount, totalFunctionCount); + } + + public void print(PrintStream s) { + s.println("Code coverage: " + toPercent(getCoverage()) + + " (" + getCoveredCodeSize() + " / " + getTotalCodeSize() + ")"); + s.println("Function coverage: " + toPercent(functionCoverage) + + " (" + coveredFunctionCount + " / " + totalFunctionCount + ")"); + String[] functionNames = functionCoverages.keySet().toArray(new String[functionCoverages.size()]); + Arrays.sort(functionNames); + for(String functionName : functionNames) { + FunctionCoverage fCov = functionCoverages.get(functionName); + s.println(" " + functionName + ": " + toPercent(fCov.getCoverage()) + + " (" + fCov.coveredCodeSize + " / " + fCov.totalCodeSize + ")"); + } + } + +}