Class JetCheckGeneration

java.lang.Object
edu.berkeley.cs.jqf.fuzz.jetcheck.JetCheckGeneration

public final class JetCheckGeneration extends Object
Runs a jetCheck Generator against JQF's guided byte stream.

Since jetCheck 0.3.0, GenerationEnvironment.generative(IntSource, int) is public, so this drives generation through public API only. jetCheck reads ints through an IntSource; routing each draw to a Random that reads the engine's stream keeps generation byte-structured, because IntDistribution.generateInt(Random) consumes only the bytes each draw needs.

  • Method Details

    • generate

      public static <T> T generate(org.jetbrains.jetCheck.Generator<T> generator, Random random, int sizeHint)
      Generates one non-null value from generator, drawing every int from random.

      A constrained generator (nonEmptyLists, suchThat) can fail to satisfy its constraint from the current input -- most often the all-zero "zeros" seed. jetCheck then throws CannotSatisfyCondition, or a mapped generator yields null. Either way this reports a SkipTrialException, the engine's standard skip signal, so the input is dropped rather than reaching the test as a leaked jetCheck exception or a spurious NullPointerException.

      Type Parameters:
      T - the generated type
      Parameters:
      generator - the jetCheck generator bound to a parameter type
      random - the guided source of randomness (JQF's StreamBackedRandom)
      sizeHint - the collection-size hint jetCheck uses to bias list and string lengths
      Returns:
      a generated value, never null
      Throws:
      SkipTrialException - if the generator cannot produce a value for this input