Package edu.berkeley.cs.jqf.fuzz.util
Class Coverage
java.lang.Object
edu.berkeley.cs.jqf.fuzz.util.Coverage
- All Implemented Interfaces:
ICoverage<Counter>,TraceEventVisitor
Utility class to collect branch and function coverage
- Author:
- Rohan Padhye
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears the coverage map.org.eclipse.collections.api.list.primitive.IntListcomputeNewCoverage(ICoverage baseline) Returns a set of edges in this coverage that don't exist in baselinecopy()Creates a copy of an this coverage map.org.eclipse.collections.api.list.primitive.IntListReturns a collection of branches that are covered.intReturns the number of edges covered.voidUpdates coverage information based on emitted event.inthashCode()Returns a hash code of the edge counts in the coverage map.intReturns a hash code of the list of edges that have been covered at least once.intsize()Returns the size of the coverage map.toString()booleanupdateBits(ICoverage that) Updates this coverage with bits from the parameter.voidvoidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface edu.berkeley.cs.jqf.instrument.tracing.events.TraceEventVisitor
visitAllocEvent, visitReadEvent, visitReturnEvent
-
Constructor Details
-
Coverage
public Coverage()Creates a new coverage map.
-
-
Method Details
-
copy
Creates a copy of an this coverage map. -
size
public int size()Returns the size of the coverage map. -
handleEvent
Updates coverage information based on emitted event.This method updates its internal counters for branch and call events.
- Parameters:
e- the event to be processed
-
visitBranchEvent
- Specified by:
visitBranchEventin interfaceTraceEventVisitor
-
visitCallEvent
- Specified by:
visitCallEventin interfaceTraceEventVisitor
-
getNonZeroCount
public int getNonZeroCount()Returns the number of edges covered.- Specified by:
getNonZeroCountin interfaceICoverage<Counter>- Returns:
- the number of edges with non-zero counts
-
getCovered
public org.eclipse.collections.api.list.primitive.IntList getCovered()Returns a collection of branches that are covered.- Specified by:
getCoveredin interfaceICoverage<Counter>- Returns:
- a collection of keys that are covered
-
computeNewCoverage
Returns a set of edges in this coverage that don't exist in baseline- Specified by:
computeNewCoveragein interfaceICoverage<Counter>- Parameters:
baseline- the baseline coverage- Returns:
- the set of edges that do not exist in
baseline
-
clear
public void clear()Clears the coverage map. -
updateBits
Updates this coverage with bits from the parameter.- Specified by:
updateBitsin interfaceICoverage<Counter>- Parameters:
that- the run coverage whose bits to OR- Returns:
trueiffthatis not a subset ofthis, causingthisto change.
-
hashCode
public int hashCode()Returns a hash code of the edge counts in the coverage map. -
nonZeroHashCode
public int nonZeroHashCode()Returns a hash code of the list of edges that have been covered at least once.- Specified by:
nonZeroHashCodein interfaceICoverage<Counter>- Returns:
- a hash of non-zero entries
-
toString
-
getCounter
- Specified by:
getCounterin interfaceICoverage<Counter>
-