dagtest

package
v1.32.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RequireComparableGraphEqual added in v1.32.0

func RequireComparableGraphEqual[Key Ordered](
	t *testing.T,
	expected []ExpectedNode[Key],
	comparableGraph *dag.ComparableGraph[Key],
)

RequireComparableGraphEqual requires that the Comparable equals the given ExpectedNodes.

The order of the input ExpectedNodes does not matter, and the order of the outbound Keys does not matter.

func RequireGraphEqual

func RequireGraphEqual[Key Ordered, Value any](
	t *testing.T,
	expected []ExpectedNode[Key],
	graph *dag.Graph[Key, Value],
	toKey func(Value) Key,
)

RequireGraphEqual requires that the graph equals the given ExpectedNodes.

The order of the input ExpectedNodes does not matter, and the order of the outbound Keys does not matter.

Types

type ExpectedNode

type ExpectedNode[Key Ordered] struct {
	Key      Key
	Outbound []Key
}

type Ordered

type Ordered interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64 |
		~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr |
		~float32 | ~float64 |
		~string
}

Ordered matches cmp.Ordered until we only support Go versions >= 1.21.

TODO: remove and replace with cmp.Ordered when we only support Go versions >= 1.21.

Jump to

Keyboard shortcuts

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