Documentation
¶
Index ¶
- func AddElement(t *testing.T, g construct.Graph, e any) (failed bool)
- func AssertGraphContains(t *testing.T, expect, actual construct.Graph)
- func AssertGraphEqual(t *testing.T, expect, actual construct.Graph, message string, args ...any)
- func MakeGraph(t *testing.T, g construct.Graph, elements ...any) construct.Graph
- func ParseEdge(t *testing.T, str string) construct.Edge
- func ParseId(t *testing.T, str string) (id construct.ResourceId)
- func ParsePath(t *testing.T, str string) construct.Path
- func ParseRef(t *testing.T, str string) construct.PropertyRef
- func StringToGraphElement(e string) (any, error)
- type GraphChanges
- func (c *GraphChanges) AddEdge(sourceHash, targetHash construct.ResourceId, ...) error
- func (c *GraphChanges) AddEdgesFrom(g construct.Graph) error
- func (c *GraphChanges) AddVertex(value *construct.Resource, options ...func(*graph.VertexProperties)) error
- func (c *GraphChanges) AddVerticesFrom(g construct.Graph) error
- func (expected *GraphChanges) AssertEqual(t *testing.T, actual *GraphChanges)
- func (c *GraphChanges) RemoveEdge(source, target construct.ResourceId) error
- func (c *GraphChanges) RemoveVertex(hash construct.ResourceId) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddElement ¶
AddElement is a utility function for adding an element to a graph. See MakeGraph for more information on supported element types. Returns whether adding the element failed.
func AssertGraphEqual ¶
func MakeGraph ¶
MakeGraph is a utility function for creating a graph from a list of elements which can be of types: - ResourceId : adds an empty resource with the given ID - Resource, *Resource : adds the given resource - Edge : adds the given edge - Path : adds all the edges in the path - string : parses the string as either a ResourceId or an Edge and add it as above
The input graph is so it can be either via NewGraph or NewAcyclicGraph. Users are encouraged to wrap this function for the specific test function for ease of use, such as:
makeGraph := func(elements ...any) Graph { return MakeGraph(t, NewGraph(), elements...) }
func StringToGraphElement ¶
Types ¶
type GraphChanges ¶
type GraphChanges struct { construct.Graph Added []construct.ResourceId Removed []construct.ResourceId AddedEdges []construct.Edge RemovedEdges []construct.Edge }
func RecordChanges ¶
func RecordChanges(inner construct.Graph) *GraphChanges
func (*GraphChanges) AddEdge ¶
func (c *GraphChanges) AddEdge( sourceHash, targetHash construct.ResourceId, options ...func(*graph.EdgeProperties), ) error
func (*GraphChanges) AddEdgesFrom ¶
func (c *GraphChanges) AddEdgesFrom(g construct.Graph) error
func (*GraphChanges) AddVertex ¶
func (c *GraphChanges) AddVertex(value *construct.Resource, options ...func(*graph.VertexProperties)) error
func (*GraphChanges) AddVerticesFrom ¶
func (c *GraphChanges) AddVerticesFrom(g construct.Graph) error
func (*GraphChanges) AssertEqual ¶
func (expected *GraphChanges) AssertEqual(t *testing.T, actual *GraphChanges)
func (*GraphChanges) RemoveEdge ¶
func (c *GraphChanges) RemoveEdge(source, target construct.ResourceId) error
func (*GraphChanges) RemoveVertex ¶
func (c *GraphChanges) RemoveVertex(hash construct.ResourceId) error