gen

package
v0.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 13, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package gen produces random but valid ClassAd source text for differential fuzzing. Purely random bytes almost never parse as a ClassAd, so a grammar directed generator is what actually exercises the evaluators. Generation is deterministic given a seed, so any divergence the driver finds can be reproduced from its seed alone.

The generator deliberately avoids nondeterministic builtins (random, time, currentTime, ...) so that a divergence reflects an engine difference rather than wall-clock or RNG state. It also stays within types both engines can represent.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	MaxAttrs   int // maximum number of top-level attributes
	MaxDepth   int // maximum expression nesting depth
	MaxListLen int // maximum elements in a generated list
	// AllowNonDeterministic, if set, permits time/random builtins. Off by
	// default because they make differential results meaningless.
	AllowNonDeterministic bool
}

Config bounds the shape of generated ClassAds.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig is a reasonable default for broad coverage.

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

Generator emits ClassAds from a seeded PRNG.

func New

func New(seed int64, cfg Config) *Generator

New returns a generator seeded deterministically.

func (*Generator) ClassAd

func (g *Generator) ClassAd() string

ClassAd generates one ClassAd as source text (always [ ... ] form).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL