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

Function TestGraphColorUsingGreedyApproach

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

Source from the content-addressed store, hash-verified

9)
10
11func TestGraphColorUsingGreedyApproach(t *testing.T) {
12 for i, tt := range getTestGraphs() {
13 t.Run(strconv.Itoa(i), func(t *testing.T) {
14 colorsOfVertices, colors := tt.Graph.ColorUsingGreedyApproach()
15 if colors != tt.ColorsUsed {
16 t.Errorf("ColorUsingGreedyApproach() 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("ColorUsingGreedyApproach() assigned colors are wrong, error = %v", err)
21 }
22 })
23 }
24}

Callers

nothing calls this directly

Calls 3

getTestGraphsFunction · 0.85

Tested by

no test coverage detected