Package edu.berkeley.cs.jqf.fuzz.random
Class NoGuidance
- java.lang.Object
-
- edu.berkeley.cs.jqf.fuzz.random.NoGuidance
-
- All Implemented Interfaces:
Guidance
- Direct Known Subclasses:
DiffFuzzNoGuidance
public class NoGuidance extends Object implements Guidance
A front-end that only generates random inputs.This class provides no guidance to quickcheck. It seeds random values from
Random
, making it effectively an unguided random test input generator.
-
-
Constructor Summary
Constructors Constructor Description NoGuidance(long maxTrials, PrintStream out)
Creates a NoGuidance instance that will run a maximum number of trials.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Consumer<TraceEvent>
generateCallBack(Thread thread)
Returns a callback that does almost nothing.Coverage
getCoverage()
Returns a reference to the coverage statistics.InputStream
getInput()
Returns a stream of random numbersvoid
handleResult(Result result, Throwable error)
Handles the result of a fuzz run.boolean
hasInput()
Returnstrue
as long asmaxTrials
has not been reached.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface edu.berkeley.cs.jqf.fuzz.guidance.Guidance
observeGeneratedArgs, run
-
-
-
-
Constructor Detail
-
NoGuidance
public NoGuidance(long maxTrials, PrintStream out)
Creates a NoGuidance instance that will run a maximum number of trials.- Parameters:
maxTrials
- the maximum number of runs to executeout
- an optional stream for logging error traces
-
-
Method Detail
-
getInput
public InputStream getInput()
Returns a stream of random numbers
-
hasInput
public boolean hasInput()
Returnstrue
as long asmaxTrials
has not been reached.
-
handleResult
public void handleResult(Result result, Throwable error)
Handles the result of a fuzz run.- Specified by:
handleResult
in interfaceGuidance
- Parameters:
result
- the result of the fuzzing trialerror
- the error thrown during the trial, ornull
-
generateCallBack
public Consumer<TraceEvent> generateCallBack(Thread thread)
Returns a callback that does almost nothing.Since this is unguided random guidance, the trace events are not used in generating inputs.
The handler here merely updates coverage statistics.
- Specified by:
generateCallBack
in interfaceGuidance
- Parameters:
thread
- the thread whose events to handle- Returns:
- a callback that does nothing.
-
getCoverage
public Coverage getCoverage()
Returns a reference to the coverage statistics.- Returns:
- a reference to the coverage statistics
-
-