surgeutil

package
v1.2.8 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fuzz

func Fuzz(t reflect.Type)

Fuzz generates a random instance of a type, and then attempts to unmarshal random bytes into that instance. It returns nothing, but is expected to not panic.

func MarshalBufTooSmall

func MarshalBufTooSmall(t reflect.Type) error

MarshalBufTooSmall generates a random intance of a type, and then attempts to marshal it into a buffer that is too small. It returns an error when marshaling succeeds. Otherwise, it returns nil.

Equivalent to MarshalBufTooSmallSparse(t, 0).

func MarshalBufTooSmallSparse

func MarshalBufTooSmallSparse(t reflect.Type, steps int) error

MarshalBufTooSmallSparse generates a random intance of a type, and then attempts to marshal it into a buffer that is too small. It returns an error when marshaling succeeds. Otherwise, it returns nil.

The number of buffer sizes tested is determinted by the given integer. A value of 0 means that all buffer sizes will be tested.

func MarshalRemTooSmall

func MarshalRemTooSmall(t reflect.Type) error

MarshalRemTooSmall generates a random intance of a type, and then attempts to marshal when a remaining memory quota that is too small. It returns an error when marshaling succeeds. Otherwise, it returns nil.

Equivalent to MarshalRemTooSmallSparse(t, 0).

func MarshalRemTooSmallSparse

func MarshalRemTooSmallSparse(t reflect.Type, steps int) error

MarshalRemTooSmallSparse generates a random intance of a type, and then attempts to marshal when a remaining memory quota that is too small. It returns an error when marshaling succeeds. Otherwise, it returns nil.

The number of buffer sizes tested is determinted by the given integer. A value of 0 means that all buffer sizes will be tested.

func MarshalUnmarshalCheck

func MarshalUnmarshalCheck(t reflect.Type) error

MarshalUnmarshalCheck generates a random instance of a type, marshals it into binary, unmarshals the result into a new instance of the type, and then does a deep equality check on the two instances. An error is returned when generation, marshaling, or unmarshaling return an error, or if the two instances are unequal. Otherwise, it returns nil.

func UnmarshalBufTooSmall

func UnmarshalBufTooSmall(t reflect.Type) error

UnmarshalBufTooSmall generates a random intance of a type, marshals it into binary, and then attempts to unmarshal the result with a buffer that is too small. It returns an error when marshaling succeeds. Otherwise, it returns nil.

Equivalent to UnmarshalBufTooSmallSparse(t, 0).

func UnmarshalBufTooSmallSparse

func UnmarshalBufTooSmallSparse(t reflect.Type, steps int) error

UnmarshalBufTooSmallSparse generates a random intance of a type, marshals it into binary, and then attempts to unmarshal the result with a buffer that is too small. It returns an error when marshaling succeeds. Otherwise, it returns nil.

The number of buffer sizes tested is determinted by the given integer. A value of 0 means that all buffer sizes will be tested.

func UnmarshalRemTooSmall

func UnmarshalRemTooSmall(t reflect.Type) error

UnmarshalRemTooSmall generates a random intance of a type, marshals it into binary, and then attempts to unmarshal the result with a remaining memory quota that is too small. It returns an error when marshaling succeeds. Otherwise, it returns nil.

Equivalent to UnmarshalRemTooSmallSparse(t, 0).

func UnmarshalRemTooSmallSparse

func UnmarshalRemTooSmallSparse(t reflect.Type, steps int) error

UnmarshalRemTooSmallSparse generates a random intance of a type, marshals it into binary, and then attempts to unmarshal the result with a remaining memory quota that is too small. It returns an error when marshaling succeeds. Otherwise, it returns nil.

The number of buffer sizes tested is determinted by the given integer. A value of 0 means that all buffer sizes will be tested.

Types

This section is empty.

Jump to

Keyboard shortcuts

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