package testutils

import "github.com/centrifuge/go-substrate-rpc-client/v4/types/test_utils"

Index

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
}

Source Files

test_utils.go

Version
v4.2.1 (latest)
Published
Dec 5, 2023
Platform
linux/amd64
Imports
9 packages
Last checked
1 week ago

Tools for package owners.