Class 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 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 execute
        out - an optional stream for logging error traces
    • Method Detail

      • getInput

        public InputStream getInput()
        Returns a stream of random numbers
        Specified by:
        getInput in interface Guidance
        Returns:
        An infinitely long input stream that generates random numbers
      • hasInput

        public boolean hasInput()
        Returns true as long as maxTrials has not been reached.
        Specified by:
        hasInput in interface Guidance
        Returns:
        true as long as maxTrials has not been reached
      • handleResult

        public void handleResult​(Result result,
                                 Throwable error)
        Handles the result of a fuzz run.
        Specified by:
        handleResult in interface Guidance
        Parameters:
        result - the result of the fuzzing trial
        error - the error thrown during the trial, or null
      • 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 interface Guidance
        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