Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Graph ¶
func Graph( t TestingT, graphBuilder func() graph.Graph[int], mutableOrImmutable Mutability, directedOrUndirected DirectionMode, allowsOrDisallowsSelfLoops SelfLoopsMode, )
Graph produces a suite of test cases for testing implementations of the graph.Graph and graph.MutableGraph interfaces. Graph instances created for testing are to have int nodes.
Test cases that should be handled similarly in any graph implementation are included in this function; for example, testing that Nodes method returns the set of the nodes in the graph. Details of specific implementations of the graph.Graph and graph.MutableGraph interfaces are not tested.
Types ¶
type SelfLoopsMode ¶
type SelfLoopsMode int
const ( AllowsSelfLoops SelfLoopsMode = iota DisallowsSelfLoops )
type TestingT ¶
type TestingT interface { Helper() Fatalf(format string, args ...any) Run(name string, f func(t *testing.T)) bool }
TestingT is an interface for the parts of *testing.T that graphtest.Graph needs to run. Whenever you see an argument of this type, pass in an instance of *testing.T or your unit testing framework's equivalent.