Class JetCheckArgumentsGenerator
java.lang.Object
edu.berkeley.cs.jqf.fuzz.jetcheck.JetCheckArgumentsGenerator
- All Implemented Interfaces:
ArgumentsGenerator
Generates one trial's arguments by running the per-parameter jetCheck generators
against the engine's guided byte stream.
Each value is produced by JetCheckGeneration, so the bytes the engine
supplies determine the arguments and replaying the same bytes rebuilds them. If a
generator cannot produce a value for the current input, the whole trial is skipped.
A custom ArgumentsGeneratorFactory for its own parameter types can reuse
this loop -- the per-parameter draw and the null/skip guard -- by building one
through builder(Generator[]) with its own generators.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbuilder(org.jetbrains.jetCheck.Generator<?>... generators) Starts a builder for a generator over the given per-parameter jetCheck generators.Object[]generate(InputStream input) Generates one trial's arguments from the given input.
-
Field Details
-
DEFAULT_SIZE_HINT
public static final int DEFAULT_SIZE_HINTThe default size hint. It biases jetCheck's list and string lengths; the exact length is still drawn from the byte stream, this only sets the centre of that draw. jetCheck's own default cycles 1..100, so a fixed 16 keeps generated collections small.- See Also:
-
-
Method Details
-
builder
@SafeVarargs public static JetCheckArgumentsGenerator.Builder builder(org.jetbrains.jetCheck.Generator<?>... generators) Starts a builder for a generator over the given per-parameter jetCheck generators.- Parameters:
generators- one generator per test-method parameter, in declaration order- Returns:
- a builder, defaulting to
DEFAULT_SIZE_HINT
-
generate
Description copied from interface:ArgumentsGeneratorGenerates one trial's arguments from the given input.The array length equals the test method's parameter count. Reading past the end of the input typically surfaces as a
SkipTrialException, which the engine treats as a signal to move on to the next input rather than as a test failure.- Specified by:
generatein interfaceArgumentsGenerator- Parameters:
input- the guided input bytes for this trial- Returns:
- the arguments to pass to the test method
-