Documentation
¶
Index ¶
- Variables
- func NewArrayStepper(steps []float64) *arrayStepper
- func NewRangeStepper(min, max, stepSize float64) *rangeStepper
- func PlotTestResults(name string, plotSeries PlotSeriesList)
- func PlotTestResultsWithConfig(name string, plotSeries PlotSeriesList, plotConfig PlotConfig)
- func WriteResultsToJsonFile(name string, results Results)
- type BigO
- type OMeasure
- type OMeasures
- type PlotConfig
- type PlotSeries
- type PlotSeriesList
- type Result
- type Results
- type RunConfig
- type Stepper
- type TestRunner
Constants ¶
This section is empty.
Variables ¶
var DefaultPlotConfig = PlotConfig{ ReferencePlots: false, PlotWidth: 6 * vg.Inch, PlotHeight: 6 * vg.Inch, LegendThumbNailWidth: 0.5 * vg.Inch, }
DefaultPlotConfig is used when calling PlotTestResults
Functions ¶
func NewArrayStepper ¶
func NewArrayStepper(steps []float64) *arrayStepper
NewRangeStepper returns a Stepper that steps from the beginning to the end of the provided array.
func NewRangeStepper ¶
func NewRangeStepper(min, max, stepSize float64) *rangeStepper
NewRangeStepper returns a Stepper that steps from min to max incremented by stepSize
func PlotTestResults ¶
func PlotTestResults(name string, plotSeries PlotSeriesList)
PlotTestResults plots the given results to a file prefixed with the given name
func PlotTestResultsWithConfig ¶
func PlotTestResultsWithConfig(name string, plotSeries PlotSeriesList, plotConfig PlotConfig)
PlotTestResultsWithConfig allows to plot with custom configuration
func WriteResultsToJsonFile ¶
WriteResultsToJson writes the captured results to a json file prefixed with the given name.
Types ¶
type BigO ¶
type BigO struct { Name string Runner TestRunner Results Results NStepper Stepper RunConfig RunConfig }
BigO holds values and methods to run tests
func NewWithConfig ¶
func NewWithConfig(name string, testRunner TestRunner, stepper Stepper, runConfig RunConfig) *BigO
New *BigO with config
func (*BigO) GetResults ¶ added in v0.0.3
GetResults returns captured results
func (*BigO) PlotResults ¶
PlotResults plots a graph from the captured results to a png file.
func (*BigO) PlotResultsWithConfig ¶
func (r *BigO) PlotResultsWithConfig(plotConfig PlotConfig) *BigO
PlotResultsWithConfig plots a graph from the captured results to a png file.
func (*BigO) Run ¶
Run starts a test run, calls the given TestRunner for every N consumed from the given Stepper.
func (*BigO) WriteResultsToJson ¶
WriteResultsToJson writes the captured results to a json file.
type OMeasure ¶
type OMeasure struct { // ResultValue may be used to store result values of the tested logic. // It is not used by this library, it's intention is debugging: // If those are deterministic they could be used to cross check that the tested code worked as expected. ResultValue interface{} `json:"V"` // O represents the number of operations used by the tested program. // Determining this value could be from tricky to impossible. // For a per machine comparison this could also be the duration of the logic under test. O float64 `json:"O"` }
OMeasure is a single capture of the O value
type PlotConfig ¶
type PlotConfig struct { ReferencePlots bool PlotWidth vg.Length PlotHeight vg.Length LegendThumbNailWidth vg.Length }
PlotConfig enables to configure the plot
type PlotSeries ¶
PlotSeries a list of result values assigned to a name
type PlotSeriesList ¶ added in v0.0.3
type PlotSeriesList []PlotSeries
PlotSeriesList a list PlotSeries
type RunConfig ¶
type RunConfig struct {
Speed float64
}
RunConfig gives detailed configuration to BigO
type Stepper ¶
Stepper implements the Next method. With every call it returned the next N and true. The boolean return parameter will be set to false when there are more steps to process.
type TestRunner ¶
TestRunner runs big o time complexity tests. BigO.Run() calls the Step method for every N and expects OMeasures to be returned.