aboutsummaryrefslogtreecommitdiffstats
path: root/bug/label_test.go
blob: d22f7337f103dbb57905516e3dd98107d8791331 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package bug

import "testing"

func TestLabelColorClassic(t *testing.T) {
	label := Label("test")
	color := label.Color()
	expected := Color{red: 244, green: 67, blue: 54}

	if color != expected {
		t.Errorf(
			"Got (R=%d, G=%d, B=%d) instead of (R=%d, G=%d, B=%d).",
			color.red, color.green, color.blue,
			expected.red, expected.green, expected.blue,
		)
	}
}

func TestLabelColorSimilar(t *testing.T) {
	label := Label("test1")
	color := label.Color()
	expected := Color{red: 121, green: 85, blue: 72}

	if color != expected {
		t.Errorf(
			"Got (R=%d, G=%d, B=%d) instead of (R=%d, G=%d, B=%d).",
			color.red, color.green, color.blue,
			expected.red, expected.green, expected.blue,
		)
	}
}

func TestLabelColorReverse(t *testing.T) {
	label := Label("tset")
	color := label.Color()
	expected := Color{red: 158, green: 158, blue: 158}

	if color != expected {
		t.Errorf(
			"Got (R=%d, G=%d, B=%d) instead of (R=%d, G=%d, B=%d).",
			color.red, color.green, color.blue,
			expected.red, expected.green, expected.blue,
		)
	}
}

func TestLabelColorEqual(t *testing.T) {
	label1 := Label("test")
	color1 := label1.Color()
	label2 := Label("test")
	color2 := label2.Color()

	if color1 != color2 {
		t.Errorf(
			"(R=%d, G=%d, B=%d) should be equal to (R=%d, G=%d, B=%d).",
			color1.red, color1.green, color1.blue,
			color2.red, color2.green, color2.blue,
		)
	}
}