mock

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2019 License: MIT Imports: 3 Imported by: 0

README

Mock

GoDoc Go Report Card Build Status codecov

Mock DSP components to test your pipeline. Check godoc for more information.

Documentation

Overview

Package mock allows to mock pipeline components and execute integration tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hooks added in v0.2.0

type Hooks struct {
	Resetted    bool
	Flushed     bool
	Interrupted bool

	ErrorOnReset     error
	ErrorOnFlush     error
	ErrorOnInterrupt error
}

Hooks allows to mock components hooks.

type Processor

type Processor struct {
	ErrorOnCall error
	Hooks
	// contains filtered or unexported fields
}

Processor mocks a pipe.Processor interface.

func (*Processor) Count

func (c *Processor) Count() (int, int)

Count returns messages and samples metrics.

func (*Processor) Flush

func (m *Processor) Flush(string) error

Flush implements pipe.Flusher.

func (*Processor) Interrupt

func (m *Processor) Interrupt(string) error

Interrupt implements pipe.Interrupter.

func (*Processor) Process

func (m *Processor) Process(pipeID string, sampleRate, numChannels int) (func([][]float64) ([][]float64, error), error)

Process implementation for runner

func (*Processor) Reset

func (m *Processor) Reset(string) error

Reset implements pipe.Resetter.

type Pump

type Pump struct {
	Interval    time.Duration
	Limit       int
	Value       float64
	NumChannels int
	SampleRate  int
	ErrorOnCall error
	Hooks
	// contains filtered or unexported fields
}

Pump mocks a pipe.Pump interface.

func (*Pump) Count

func (c *Pump) Count() (int, int)

Count returns messages and samples metrics.

func (*Pump) Flush

func (m *Pump) Flush(string) error

Flush implements pipe.Flusher.

func (*Pump) Interrupt

func (m *Pump) Interrupt(string) error

Interrupt implements pipe.Interrupter.

func (*Pump) IntervalParam

func (m *Pump) IntervalParam(i time.Duration) func()

IntervalParam pushes new interval value for pump.

func (*Pump) LimitParam

func (m *Pump) LimitParam(l int) func()

LimitParam pushes new limit value for pump.

func (*Pump) Pump

func (m *Pump) Pump(sourceID string) (func(bufferSize int) ([][]float64, error), int, int, error)

Pump returns new buffer for pipe.

func (*Pump) Reset

func (m *Pump) Reset(string) error

Reset implements pipe.Resetter.

func (*Pump) ValueParam

func (m *Pump) ValueParam(v float64) func()

ValueParam pushes new signal value for pump.

type Sink

type Sink struct {
	ErrorOnCall error
	Hooks
	// contains filtered or unexported fields
}

Sink mocks up a pipe.Sink interface. Buffer is not thread-safe, so should not be checked while pipe is running.

func (*Sink) Buffer

func (m *Sink) Buffer() signal.Float64

Buffer returns sink's buffer

func (*Sink) Count

func (c *Sink) Count() (int, int)

Count returns messages and samples metrics.

func (*Sink) Flush

func (m *Sink) Flush(string) error

Flush implements pipe.Flusher.

func (*Sink) Interrupt

func (m *Sink) Interrupt(string) error

Interrupt implements pipe.Interrupter.

func (*Sink) Reset

func (m *Sink) Reset(string) error

Reset implements pipe.Resetter.

func (*Sink) Sink

func (m *Sink) Sink(pipeID string, sampleRate, numChannels int) (func([][]float64) error, error)

Sink implementation for runner.

Jump to

Keyboard shortcuts

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