testutil

package
Version: v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdjacentEqual64

func AdjacentEqual64(a, b float64) bool

AdjacentEqual64 reports whether a equals b or they are adjacent floating point numbers.

func Close64

func Close64(a, b float64, tolerance float64) bool

Close64 reports whether two 64-bit floats are equal within a given tolerance.

func Equiv64

func Equiv64(a, b float64) bool

Equiv64 reports whether two 64-bit floats are equivalent. It returns true if they are both infinite, NaN or numerically equal to one another.

func EquivOrCloseFloat64

func EquivOrCloseFloat64(a, b float64, tolerance float64) bool

EquivOrCloseFloat64 reports whether two 64-bit floats are equivalent. It returns true if they are both infinite, NaN or numerically equal within a given tolerance.

func FillRandomByteSlice

func FillRandomByteSlice(buf []byte, rng Rand)

FillRandomByteSlice fills a byte slice with n random bytes using rng as the source of randomness.

func Printable

func Printable(rng Rand) byte

Printable returns a byte from the range of printable ASCII characters (0x20-0x7E).

func RandomByteSlice

func RandomByteSlice(n int, rng Rand) []byte

RandomByteSlice creates a byte slice filled with n random bytes using rng as the source of randomness.

func RandomByteSlices

func RandomByteSlices(m, n int, rng Rand) [][]byte

RandomByteSlices creates m byte slices each filled with n random bytes using rng as the source of randomness.

func Shuffle

func Shuffle(buf [][]byte, rng Rand)

func ShuffleRepeated

func ShuffleRepeated(n int, src [][]byte, rng Rand) [][]byte

ShuffleRepeated returns n byte slices drawn randomly from src. If n is larger than len(src) then it will draw entries at random from src to fill the spare space ensuring that each entry from src appears at least once.

Types

type Rand

type Rand interface {
	// Intn returns a number in [0,n)
	Intn(n int) int
}

Source Files

Jump to

Keyboard shortcuts

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