chaos

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package chaos provides utilities for chaos testing parsers with corrupt inputs.

Chaos testing intentionally corrupts valid inputs to verify parsers handle malformed data gracefully without panicking.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Corruptor

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

Corruptor defines methods for corrupting input data.

func NewCorruptor

func NewCorruptor(seed int64) *Corruptor

NewCorruptor creates a new Corruptor with the given seed.

func (*Corruptor) Corrupt

func (c *Corruptor) Corrupt(input []byte) []byte

Corrupt applies a random corruption to the input.

func (*Corruptor) CorruptN

func (c *Corruptor) CorruptN(input []byte, n int) []byte

CorruptN applies n random corruptions to the input.

func (*Corruptor) GenerateCorpus

func (c *Corruptor) GenerateCorpus(valid []byte, count int) [][]byte

GenerateCorpus generates a corpus of corrupted inputs from a valid input.

type Mutation

type Mutation int

Mutation represents a type of corruption applied to input.

const (
	ByteFlip Mutation = iota
	ByteDelete
	ByteInsert
	ByteReplace
	Utf8Corrupt
	Truncation
	BitInversion
)

Jump to

Keyboard shortcuts

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