diff options
author | ludovicm67 <ludovicmuller1@gmail.com> | 2019-03-28 15:52:31 +0100 |
---|---|---|
committer | Quentin Gliech <quentingliech@gmail.com> | 2019-05-22 20:22:35 +0200 |
commit | e3ce535705ce8c1271ce0cfd44209184b9f9f238 (patch) | |
tree | 9fe7f93cefe26cba1f67f03131f78e1473784662 /bug/label_test.go | |
parent | 1d94fd1b31fd391709c8a80238f2fe87a35800ff (diff) | |
download | git-bug-e3ce535705ce8c1271ce0cfd44209184b9f9f238.tar.gz |
test: add some tests for label color
Diffstat (limited to 'bug/label_test.go')
-rw-r--r-- | bug/label_test.go | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/bug/label_test.go b/bug/label_test.go new file mode 100644 index 00000000..d22f7337 --- /dev/null +++ b/bug/label_test.go @@ -0,0 +1,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, + ) + } +} |