Documentation
¶
Overview ¶
Package graphtest holds test utilities for packages that depend on the graph package.
Index ¶
- func BuildTestBackend() backends.Backend
- func RunTestGraphFn(t *testing.T, testName string, graphFn TestGraphFn, want []any, delta float64)
- func RunTestGraphFnWithBackend(t *testing.T, testName string, backend backends.Backend, graphFn TestGraphFn, ...)
- func TestOfficialBackends(t *testing.T, testFn func(t *testing.T, backend backends.Backend), ...)
- type TestGraphFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildTestBackend ¶
BuildTestBackend and sets backends.DefaultConfig to "xla:cpu" -- it can be overwritten by GOMLX_BACKEND environment variable.
func RunTestGraphFn ¶
RunTestGraphFn tests a graph building function graphFn by executing it and comparing its output(s) to the values in want, reporting back any errors in t.
delta is the margin of value on the difference of output and want values that are acceptable. Values of delta <= 0 means only exact equality is accepted.
func RunTestGraphFnWithBackend ¶ added in v0.27.0
func RunTestGraphFnWithBackend(t *testing.T, testName string, backend backends.Backend, graphFn TestGraphFn, want []any, delta float64)
RunTestGraphFnWithBackend tests a graph building function graphFn by executing it and comparing its output(s) to the values in want, reporting back any errors in t.
delta is the margin of value on the difference of output and want values that are acceptable. Values of delta <= 0 means only exact equality is accepted.
func TestOfficialBackends ¶ added in v0.27.0
func TestOfficialBackends(t *testing.T, testFn func(t *testing.T, backend backends.Backend), excludeBackends ...string)
TestOfficialBackends iterates over list of backends and calls testFn for each of them. If GOMLX_BACKEND environment variable is set, it will only iterate over the one set. If GOMLX_BACKEND is not set, it will iterate over all official backends, except those in excludeBackends. (for tests known not to work on those backends)