MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / TestHEXToRGB

Function TestHEXToRGB

conversion/rgbhex_test.go:17–27  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

15}
16
17func TestHEXToRGB(t *testing.T) {
18 for i := 0; i < len(HEX); i++ {
19 hex := HEX[i]
20 expected := RGB[i]
21 resultR, resultG, resultB := HEXToRGB(hex)
22 if resultR != expected[0] || resultG != expected[1] || resultB != expected[2] {
23 t.Errorf("HEXToRGB(%d) = %d,%d,%d; want %d,%d,%d",
24 hex, resultR, resultG, resultB, expected[0], expected[1], expected[2])
25 }
26 }
27}
28
29func BenchmarkHEXToRGB(b *testing.B) {
30 for i := 0; i < b.N; i++ {

Callers

nothing calls this directly

Calls 1

HEXToRGBFunction · 0.85

Tested by

no test coverage detected