MCPcopy Index your code
hub / github.com/TheAlgorithms/Go / TestGraphColorUsingBFS

Function TestGraphColorUsingBFS

graph/coloring/bfs_test.go:11–24  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func TestGraphColorUsingBFS(t *testing.T) {
12 for i, tt := range getTestGraphs() {
13 t.Run(strconv.Itoa(i), func(t *testing.T) {
14 colorsOfVertices, colors := tt.Graph.ColorUsingBFS()
15 if colors != tt.ColorsUsed {
16 t.Errorf("ColorUsingBFS() return more number of colors: %v, want %v colors", colors, tt.ColorsUsed)
17 }
18 // check colors
19 if err := tt.Graph.ValidateColorsOfVertex(colorsOfVertices); err != nil {
20 t.Errorf("ColorUsingBFS() assigned colors are wrong, error = %v", err)
21 }
22 })
23 }
24}

Callers

nothing calls this directly

Calls 3

getTestGraphsFunction · 0.85
ColorUsingBFSMethod · 0.80

Tested by

no test coverage detected