Skip to documentation
SLOP

tiny.hypothesis.fuzzWithSettings

Reference tiny.hypothesis fuzzWithSettings

Defined in tiny.hypothesis.

Called byCallstiny.hypothesisfuzztest sourcelib.hypothesis.src.testingtest: fuzz: corpus admission stops at...test sourcelib.hypothesis.src.testingtest: fuzz: corpus failure reports pr...private sourcelib.hypothesis.src.testingFuzzContextTypeprivate sourcelib.hypothesis.src.testingFuzzTestTypeprivate sourcelib.hypothesis.src.testingprintFailuretiny.hypothesisfuzzWithSettings
Static calls · unresolved targets: 1 · external targets: 4.

Source

Source: lib/hypothesis/src/testing.zig:146

zig
pub fn fuzzWithSettings(    context: anytype,    comptime fuzzFn: fn (context: @TypeOf(context), input: []const u8) anyerror!void,    options: FuzzInputOptions,    settings: Settings,) anyerror!void {    const allocator = std.testing.allocator;    var seed_cases: []SeedCase = &.{};    var seed_nodes: []conjecture.ChoiceNode = &.{};    defer {        if (seed_cases.len > 0) allocator.free(seed_cases);        if (seed_nodes.len > 0) allocator.free(seed_nodes);    }    if (options.corpus.len > 0) {        const corpus_count = @min(options.corpus.len, settings.max_replays);        if (corpus_count > 0) {            seed_cases = try allocator.alloc(SeedCase, corpus_count);            seed_nodes = try allocator.alloc(conjecture.ChoiceNode, corpus_count);            for (options.corpus[0..corpus_count], 0..) |input, idx| {                const max_len: usize = if (input.len > default_max_input_size)                    input.len                else                    default_max_input_size;                seed_nodes[idx] = .{                    .kind = .integer,                    .value = @intCast(input.len),                    .min = 0,                    .max = @intCast(max_len),                    .shrink_towards = 0,                };                seed_cases[idx] = .{                    .choices = seed_nodes[idx .. idx + 1],                    .byte_blocks = input,                };            }        }    }    var wrapper_ctx = FuzzContextType(@TypeOf(context)){        .user_context = context,        .fuzz_fn = fuzzFn,        .max_input_size = default_max_input_size,    };    var result = try engine_mod.runWithContextSeeded(        allocator,        &FuzzTestType(@TypeOf(context)).testFn,        @ptrCast(&wrapper_ctx),        settings,        seed_cases,    );    defer result.deinit();    if (!result.passed) {        if (settings.report_failure) {            printFailure(&result);        }        return error.PropertyFailed;    }}

Source: lib/hypothesis/src/root.zig:61

zig
pub const fuzzWithSettings = testing.fuzzWithSettings;

Audit

Definitions1
Public names1
Members0
Version26.7.0
Revisiondaab053ee433