testtools

package
v2.0.0-...-3afa7df 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

View Source
var (
	TestDataDir = filepath.Join(filepath.Dir(callerPath), "../testdata")
)

Functions

func AssertSamplesEqual

func AssertSamplesEqual(t *testing.T, expected, actual [][2]float64)

func AssertStreamerHasCorrectReturnBehaviour

func AssertStreamerHasCorrectReturnBehaviour(t *testing.T, s beep.Streamer, expectedSamples int)

AssertStreamerHasCorrectReturnBehaviour tests whether the return values returned by the streamer s adhere to the description on the Streamer interface.

func Collect

func Collect(s beep.Streamer) [][2]float64

Collect drains Streamer s and returns all the samples it streamed.

func CollectNum

func CollectNum(num int, s beep.Streamer) [][2]float64

CollectNum collects num samples from the streamer in chunks and returns them all.

func NewDataStreamer

func NewDataStreamer(data [][2]float64) (s beep.StreamSeeker)

NewDataStreamer creates a streamer which streams the given data.

func NewDelayedErrorStreamer

func NewDelayedErrorStreamer(s beep.Streamer, numSamples int, err error) beep.StreamSeeker

NewDelayedErrorStreamer wraps streamer s but returns an error after numSamples have been streamed.

func NewErrorStreamer

func NewErrorStreamer(err error) beep.StreamSeeker

NewErrorStreamer returns a streamer which errors immediately with the given err.

func NewSequentialDataStreamer

func NewSequentialDataStreamer(numSamples int) (s beep.StreamSeeker, data [][2]float64)

NewSequentialDataStreamer creates a streamer which streams samples with values {0, 0}, {1, 1}, {2, 2}, etc. Note that this aren't valid sample values in the range of [-1, 1], but it can nonetheless be useful for testing.

func RandomDataStreamer

func RandomDataStreamer(numSamples int) (s beep.StreamSeeker, data [][2]float64)

RandomDataStreamer generates numSamples random samples and returns a StreamSeeker to stream them.

func TestFilePath

func TestFilePath(path string) string

Types

type ErrorStreamer

type ErrorStreamer struct {
	Error error
	// contains filtered or unexported fields
}

func (*ErrorStreamer) Err

func (e *ErrorStreamer) Err() error

func (*ErrorStreamer) Len

func (e *ErrorStreamer) Len() int

func (*ErrorStreamer) Position

func (e *ErrorStreamer) Position() int

func (*ErrorStreamer) Seek

func (e *ErrorStreamer) Seek(p int) error

func (*ErrorStreamer) Stream

func (e *ErrorStreamer) Stream(samples [][2]float64) (n int, ok bool)

type SeekErrorStreamer

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

func NewSeekErrorStreamer

func NewSeekErrorStreamer(s beep.StreamSeeker, err error) *SeekErrorStreamer

func (*SeekErrorStreamer) Err

func (s *SeekErrorStreamer) Err() error

func (*SeekErrorStreamer) Len

func (s *SeekErrorStreamer) Len() int

func (*SeekErrorStreamer) Position

func (s *SeekErrorStreamer) Position() int

func (*SeekErrorStreamer) Seek

func (s *SeekErrorStreamer) Seek(p int) error

func (*SeekErrorStreamer) Stream

func (s *SeekErrorStreamer) Stream(samples [][2]float64) (n int, ok bool)

Jump to

Keyboard shortcuts

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