Standard library / testing/quick
testing/quick.Config
Control trial count, pseudo-random source and argument generation. MaxCount overrides scaling when nonzero. Fixed seeds improve reproducibility. Expected stdout: '20 true\n'.
Formal Syntax & Structure
go syntaxgo
type Config struct { MaxCount int MaxCountScale float64 Rand *rand.Rand Values func([]reflect.Value, *rand.Rand)}Working Example
Example Snippetgo
package main
import ( "fmt" "math/rand" "testing/quick")
func main() { c := &quick.Config{MaxCount: 20, Rand: rand.New(rand.NewSource(42))} calls := 0 err := quick.Check(func(x int) bool { calls++; return true }, c) fmt.Println(calls, err == nil)}