tiny.hypothesis.fuzzWithSettings
Defined in tiny.hypothesis.
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
| Definitions | 1 |
|---|---|
| Public names | 1 |
| Members | 0 |
| Version | 26.7.0 |
| Revision | daab053ee433 |