testutil

package
v2.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Float64Bytes

func Float64Bytes(v float64) []byte

Float64Bytes returns an 8-byte little-endian payload that numeric.Float64 will decode into the provided value. v is clamped to [0, 1).

func Uint64Bytes

func Uint64Bytes(u uint64) []byte

Uint64Bytes returns the little-endian encoding of u.

func WithSource

func WithSource(t *testing.T, r io.Reader)

WithSource sets the entropy source for testing and restores it on cleanup.

Types

type ErrReader

type ErrReader struct {
	Err error
}

ErrReader always fails with the provided error.

func (ErrReader) Read

func (e ErrReader) Read(p []byte) (int, error)

Read implements io.Reader.

type SeqReader

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

SeqReader feeds deterministic entropy to crypto consumers. It returns each configured byte in order and, once exhausted, keeps returning the final byte so callers never see EOF mid-read.

func NewSeqReader

func NewSeqReader(chunks ...[]byte) *SeqReader

NewSeqReader builds a SeqReader from one or more byte chunks.

func (*SeqReader) Read

func (r *SeqReader) Read(p []byte) (int, error)

Read implements io.Reader.

Jump to

Keyboard shortcuts

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