Zig 0.17.0-dev (Split by item)

This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.

fuzzer_main

fuzzer.fuzzer_main
export fn fuzzer_main(
    n_tests: u32,
    seed: u32,
    limit_kind: abi.LimitKind,
    amount_or_instance: u64,
) void

File

lib/fuzzer.zig:2196

Code

export fn fuzzer_main(
    n_tests: u32,
    seed: u32,
    limit_kind: abi.LimitKind,
    amount_or_instance: u64,
) void {
    fuzzer = .init(
        n_tests,
        seed ^ amount_or_instance, // seed is otherwise the same for all instances
        if (limit_kind == .forever) @as(u32, @intCast(amount_or_instance)) else 0,
        if (limit_kind == .forever) null else amount_or_instance,
    );
    defer fuzzer.deinit();
    abi.runner_start_input_poller();
    defer abi.runner_stop_input_poller();

    if (n_tests == 1) {
        // no swapping between fuzz tests
        runTest(0);
    } else {
        while (fuzzer.select()) |i| {
            runTest(i);
        }
    }
}