testutils

package
v4.0.0-...-b8792c0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertDecode

func AssertDecode(t *testing.T, decodingAsserts []DecodingAssert)

func AssertDecodeNilData

func AssertDecodeNilData[T any](t *testing.T)

func AssertEncode

func AssertEncode(t *testing.T, encodingAsserts []EncodingAssert)

func AssertEncodeEmptyObj

func AssertEncodeEmptyObj[T any](t *testing.T, expectedByteLen int)

func AssertEncodeToHex

func AssertEncodeToHex(t *testing.T, encodeToHexAsserts []EncodeToHexAssert)

func AssertEncodedLength

func AssertEncodedLength(t *testing.T, encodedLengthAsserts []EncodedLengthAssert)

func AssertEq

func AssertEq(t *testing.T, eqAsserts []EqAssert)

func AssertEqual

func AssertEqual(t *testing.T, a interface{}, b interface{})

func AssertHash

func AssertHash(t *testing.T, hashAsserts []HashAssert)

func AssertJSONRoundTrip

func AssertJSONRoundTrip[T any, U jsonMarshalerUnmarshaler[T]](t *testing.T, value U)

func AssertRoundTripFuzz

func AssertRoundTripFuzz[T any](t *testing.T, fuzzCount int, fuzzOpts ...FuzzOpt)

func AssertRoundtrip

func AssertRoundtrip(t *testing.T, value interface{})

func AssertString

func AssertString(t *testing.T, stringAsserts []StringAssert)

Types

type DecodingAssert

type DecodingAssert struct {
	Input    []byte
	Expected interface{}
}

type EncodeToHexAssert

type EncodeToHexAssert struct {
	Input    interface{}
	Expected string
}

type EncodedLengthAssert

type EncodedLengthAssert struct {
	Input    interface{}
	Expected int
}

type EncodingAssert

type EncodingAssert struct {
	Input    interface{}
	Expected []byte
}

type EqAssert

type EqAssert struct {
	Input    interface{}
	Other    interface{}
	Expected bool
}

type FuzzOpt

type FuzzOpt func(f *fuzz.Fuzzer)

func CombineFuzzOpts

func CombineFuzzOpts(optsSlice ...[]FuzzOpt) []FuzzOpt

func WithFuzzFuncs

func WithFuzzFuncs(fuzzFns ...any) FuzzOpt

func WithMaxDepth

func WithMaxDepth(depth int) FuzzOpt

func WithNilChance

func WithNilChance(p float64) FuzzOpt

func WithNumElements

func WithNumElements(atLeast, atMost int) FuzzOpt

type HashAssert

type HashAssert struct {
	Input    interface{}
	Expected []byte
}

type StringAssert

type StringAssert struct {
	Input    interface{}
	Expected string
}

Jump to

Keyboard shortcuts

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