本文整理汇总了Java中org.jacoco.core.analysis.ILine类的典型用法代码示例。如果您正苦于以下问题:Java ILine类的具体用法?Java ILine怎么用?Java ILine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ILine类属于org.jacoco.core.analysis包,在下文中一共展示了ILine类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createAnnotations
import org.jacoco.core.analysis.ILine; //导入依赖的package包/类
private void createAnnotations(final ISourceNode linecoverage) {
AnnotationModelEvent event = new AnnotationModelEvent(this);
clear(event);
final int firstline = linecoverage.getFirstLine();
final int lastline = Math.min(linecoverage.getLastLine(),
document.getNumberOfLines());
try {
for (int l = firstline; l <= lastline; l++) {
final ILine line = linecoverage.getLine(l);
if (line.getStatus() != ICounter.EMPTY) {
final IRegion region = document.getLineInformation(l - 1);
final CoverageAnnotation ca = new CoverageAnnotation(
region.getOffset(), region.getLength(), line);
annotations.add(ca);
event.annotationAdded(ca);
}
}
} catch (BadLocationException ex) {
EclEmmaUIPlugin.log(ex);
}
fireModelChanged(event);
}
开发者ID:eclipse,项目名称:eclemma,代码行数:23,代码来源:CoverageAnnotationModel.java示例2: buildLoose
import org.jacoco.core.analysis.ILine; //导入依赖的package包/类
public static
SourceFileCoverage<ILine> buildLoose(ISourceFileCoverage coverage,
String sessionName) {
String packageName = coverage.getPackageName();
String sourcefileName = coverage.getName();
int firstLine = coverage.getFirstLine();
int lastLine = coverage.getLastLine();
ILine[] linesCoverage = null;
if(firstLine != -1) {
linesCoverage = new ILine[lastLine - firstLine + 1];
int counter = 0;
for(int i = firstLine; i <= lastLine; i += 1) {
linesCoverage[counter] = coverage.getLine(i);
counter += 1;
}
}
SourceFileCoverage<ILine> cov =
new SourceFileCoverage<>(sourcefileName, packageName, sessionName,
firstLine, lastLine, LineCoverageFormat.LOOSE, linesCoverage);
return cov;
}
开发者ID:spideruci,项目名称:tacoco,代码行数:24,代码来源:SourceFileCoverageBuilder.java示例3: prettyPrintSourceLines
import org.jacoco.core.analysis.ILine; //导入依赖的package包/类
private void prettyPrintSourceLines(ISourceFileCoverage sourceCoverage) {
out.println("\t" + sourceCoverage.getName() +
" ... " + prettyCoverageCount(sourceCoverage.getClassCounter()));
int firstLine = sourceCoverage.getFirstLine();
int lastLine = sourceCoverage.getLastLine();
for(int line = firstLine; line <= lastLine; line += 1) {
if(line == -1) continue;
ILine sourceLine = sourceCoverage.getLine(line);
if(sourceLine == null) {
out.printf("%d: null\n", line);
continue;
}
out.printf("%d: %s, %s, %s\n",
line,
lineStatusString(sourceLine.getStatus()),
prettyCoverageCount(sourceLine.getInstructionCounter()),
prettyCoverageCount(sourceLine.getBranchCounter()));
}
}
开发者ID:spideruci,项目名称:tacoco,代码行数:21,代码来源:CoveragePrettyPrinter.java示例4: shouldCodeCoverageStatusFor15linesInOneInteger
import org.jacoco.core.analysis.ILine; //导入依赖的package包/类
@Test
public void shouldCodeCoverageStatusFor15linesInOneInteger() {
//given
int numberOfLines = 15;
int expectedCodeCount = 1;
Collection<ILine> linesCoverage = mockLinesCoverage(numberOfLines);
LinesStatusCoder coder = new LinesStatusCoder();
//when
int[] codes = coder.encode(linesCoverage);
//and
assertThat(linesCoverage.size(), equalTo(numberOfLines));
//then
assertEquals(expectedCodeCount, codes.length);
}
开发者ID:spideruci,项目名称:tacoco,代码行数:17,代码来源:TestLinesStatusCoder.java示例5: shouldCodeCoverageStatusFor16linesInOneInteger
import org.jacoco.core.analysis.ILine; //导入依赖的package包/类
@Test
public void shouldCodeCoverageStatusFor16linesInOneInteger() {
//given
int numberOfLines = 16;
int expectedCodeCount = 1;
Collection<ILine> linesCoverage = mockLinesCoverage(numberOfLines);
LinesStatusCoder coder = new LinesStatusCoder();
//when
int[] codes = coder.encode(linesCoverage);
//and
assertThat(linesCoverage.size(), equalTo(numberOfLines));
//then
assertEquals(expectedCodeCount, codes.length);
}
开发者ID:spideruci,项目名称:tacoco,代码行数:17,代码来源:TestLinesStatusCoder.java示例6: compactEncodedCountersShouldEqualOriginalCounters
import org.jacoco.core.analysis.ILine; //导入依赖的package包/类
@Test
public void compactEncodedCountersShouldEqualOriginalCounters() {
// given
ILine lineCoverage = mock(ILine.class);
when(lineCoverage.getInstructionCounter())
.thenReturn(CounterImpl.getInstance(im, ic));
when(lineCoverage.getBranchCounter())
.thenReturn(CounterImpl.getInstance(bm, bc));
LineCoverageCoder coder = new LineCoverageCoder();
//when
int codedCoverage = coder.encode(lineCoverage);
//and
int[] decodedCoverage = coder.decode(codedCoverage);
String decodedCovArrayString = Arrays.toString(decodedCoverage);
//then
assertEquals(decodedCovArrayString, ic, decodedCoverage[0]);
//and
assertEquals(decodedCovArrayString, im, decodedCoverage[1]);
//and
assertEquals(decodedCovArrayString, bc, decodedCoverage[2]);
//and
assertEquals(decodedCovArrayString, bm, decodedCoverage[3]);
}
开发者ID:spideruci,项目名称:tacoco,代码行数:26,代码来源:TestLineCoverageCoder.java示例7: getAnnotationID
import org.jacoco.core.analysis.ILine; //导入依赖的package包/类
private static String getAnnotationID(ILine line) {
switch (line.getStatus()) {
case ICounter.FULLY_COVERED:
return FULL_COVERAGE;
case ICounter.PARTLY_COVERED:
return PARTIAL_COVERAGE;
case ICounter.NOT_COVERED:
return NO_COVERAGE;
}
throw new AssertionError(line.getStatus());
}
开发者ID:eclipse,项目名称:eclemma,代码行数:12,代码来源:CoverageAnnotation.java示例8: buildDense
import org.jacoco.core.analysis.ILine; //导入依赖的package包/类
public static
SourceFileCoverage<Integer> buildDense(ISourceFileCoverage coverage,
String sessionName) {
String packageName = coverage.getPackageName();
String sourcefileName = coverage.getName();
int firstLine = coverage.getFirstLine();
int lastLine = coverage.getLastLine();
Collection<ILine> linesCoverage = new ArrayList<>();
if(firstLine != -1) {
for(int i = firstLine; i <= lastLine; i += 1) {
linesCoverage.add(coverage.getLine(i));
}
}
LinesStatusCoder coder = new LinesStatusCoder();
int[] statuses = coder.encode(linesCoverage);
Integer[] lineStatuses = new Integer[statuses.length];
int count = 0;
for(int status : statuses) {
lineStatuses[count++] = status;
}
SourceFileCoverage<Integer> cov =
new SourceFileCoverage<>(sourcefileName, packageName, sessionName,
firstLine, lastLine, LineCoverageFormat.DENSE, lineStatuses);
return cov;
}
开发者ID:spideruci,项目名称:tacoco,代码行数:29,代码来源:SourceFileCoverageBuilder.java示例9: encode
import org.jacoco.core.analysis.ILine; //导入依赖的package包/类
public int[] encode(Collection<ILine> linesCoverage) {
int lineCount = linesCoverage.size();
int codeCount = (lineCount / 16) + (lineCount % 16 == 0 ? 0 : 1);
int[] codedCoverage = new int[codeCount];
int code = 0;
int count = 0;
int codeIndex = 0;
for(ILine lineCoverage : linesCoverage) {
int status = lineCoverage.getStatus();
code = code | status;
count += 1;
if(count == lineCount) {
code = code << (SHIFT * (16 - (count % 16)));
codedCoverage[codeIndex] = code;
break;
}
if(count % 16 == 0) {
codedCoverage[codeIndex] = code;
codeIndex += 1;
code = 0;
continue;
}
code = code << SHIFT;
}
return codedCoverage;
}
开发者ID:spideruci,项目名称:tacoco,代码行数:31,代码来源:LinesStatusCoder.java示例10: encode
import org.jacoco.core.analysis.ILine; //导入依赖的package包/类
public int encode(ILine lineCoverage) {
ICounter insnCounter = lineCoverage.getInstructionCounter();
int ic = insnCounter.getCoveredCount();
int im = insnCounter.getMissedCount();
ICounter branchCounter = lineCoverage.getBranchCounter();
int bc = branchCounter.getCoveredCount();
int bm = branchCounter.getMissedCount();
int code = encode(ic, im, bc, bm);
return code;
}
开发者ID:spideruci,项目名称:tacoco,代码行数:12,代码来源:LineCoverageCoder.java示例11: print_source_counter_verbose
import org.jacoco.core.analysis.ILine; //导入依赖的package包/类
public static void print_source_counter_verbose(ISourceNode source)
{
int firstLine = source.getFirstLine();
int lastLine = source.getLastLine();
System.out.printf("%18s: %s\n", "First Line", firstLine);
System.out.printf("%18s: %s\n", "Last Line", lastLine);
for(int i = firstLine; i <= lastLine; i++)
{
ILine line = source.getLine(i);
ICounter instructionCounter = line.getInstructionCounter();
int status = instructionCounter.getStatus();
if(status != ICounter.EMPTY)
{
String status_string = "";
switch(status)
{
case ICounter.NOT_COVERED:
status_string = "NOT_COVERED";
break;
case ICounter.FULLY_COVERED:
status_string = "FULLY_COVERED";
break;
case ICounter.PARTLY_COVERED:
status_string = "PARTLY_COVERED";
break;
default:
}
System.out.printf("%18s: %6s (%s)\n", "Line "+i, instructionCounter.getCoveredCount() + "/" + instructionCounter.getTotalCount(), status_string);
}
}
}
开发者ID:spideruci,项目名称:tacoco,代码行数:32,代码来源:ExecAnalyze.java示例12: shouldCodeCoverageStatusForZerolinesWithZeroIntegers
import org.jacoco.core.analysis.ILine; //导入依赖的package包/类
@Test
public void shouldCodeCoverageStatusForZerolinesWithZeroIntegers() {
//given
int numberOfLines = 0;
int expectedCodeCount = 0;
Collection<ILine> linesCoverage = mockLinesCoverage(numberOfLines);
LinesStatusCoder coder = new LinesStatusCoder();
//when
int[] codes = coder.encode(linesCoverage);
//then
assertEquals(expectedCodeCount, codes.length);
}
开发者ID:spideruci,项目名称:tacoco,代码行数:15,代码来源:TestLinesStatusCoder.java示例13: shouldCodeCoverageStatusForUnder16linesInOneInteger
import org.jacoco.core.analysis.ILine; //导入依赖的package包/类
@Test
public void shouldCodeCoverageStatusForUnder16linesInOneInteger() {
//given
int numberOfLines = 8;
int expectedCodeCount = 1;
Collection<ILine> linesCoverage = mockLinesCoverage(numberOfLines);
LinesStatusCoder coder = new LinesStatusCoder();
//when
int[] codes = coder.encode(linesCoverage);
//then
assertEquals(expectedCodeCount, codes.length);
}
开发者ID:spideruci,项目名称:tacoco,代码行数:15,代码来源:TestLinesStatusCoder.java示例14: shouldCodeCoverageStatusForOver16AndUnder32linesInTwoIntegers
import org.jacoco.core.analysis.ILine; //导入依赖的package包/类
@Test
public void shouldCodeCoverageStatusForOver16AndUnder32linesInTwoIntegers() {
//given
int numberOfLines = 17;
int expectedCodeCount = 2;
Collection<ILine> linesCoverage = mockLinesCoverage(numberOfLines);
LinesStatusCoder coder = new LinesStatusCoder();
//when
int[] codes = coder.encode(linesCoverage);
//then
assertEquals(expectedCodeCount, codes.length);
}
开发者ID:spideruci,项目名称:tacoco,代码行数:15,代码来源:TestLinesStatusCoder.java示例15: shouldCodeCoverageStatusForOver31linesInTwoIntegers
import org.jacoco.core.analysis.ILine; //导入依赖的package包/类
@Test
public void shouldCodeCoverageStatusForOver31linesInTwoIntegers() {
//given
int numberOfLines = 31;
int expectedCodeCount = 2;
Collection<ILine> linesCoverage = mockLinesCoverage(numberOfLines);
LinesStatusCoder coder = new LinesStatusCoder();
//when
int[] codes = coder.encode(linesCoverage);
//then
assertEquals(expectedCodeCount, codes.length);
}
开发者ID:spideruci,项目名称:tacoco,代码行数:15,代码来源:TestLinesStatusCoder.java本文标签属性:
示例:示例英语
代码:代码生成器
java:javascript什么意思
ILine:ILine