Standard library / testing
testing.F.Add()
Add typed seed arguments matching the fuzz target parameters before calling Fuzz. Expected stdout: 'seed checked\nPASS\n'. Run as a _test.go file using the Go test harness.
Formal Syntax & Structure
go syntaxgo
func (f *F) Add(args ...any)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| args | ...any | Arguments supplied to logging, skipping or corpus entry as applicable. |
Working Example
Example Snippetgo
package main
import ( "fmt" "strings" "testing")
func FuzzReference(f *testing.F) { f.Add("abc") f.Fuzz(func(t *testing.T, s string) { if strings.ToUpper(strings.ToUpper(s)) != strings.ToUpper(s) { t.Fatal("not idempotent") } fmt.Println("seed checked") })}