Commit 9981d628 authored by santiaago's avatar santiaago
Browse files

test RandomColorFromArrayWithFreq

parent 61610392
Loading
Loading
Loading
Loading

draw/tools_test.go

0 → 100644
+25 −0
Original line number Diff line number Diff line
package draw

import (
	"image/color"
	"testing"
)

func TestRandomColorFromArrayWithFreq(t *testing.T) {

	c1 := color.RGBA{255, 245, 249, 255}
	colors := []color.RGBA{
		c1,
		color.RGBA{232, 70, 134, 255},
		color.RGBA{232, 70, 186, 255},
		color.RGBA{232, 70, 81, 255},
	}

	if c := RandomColorFromArrayWithFreq(colors, 0); c == c1 {
		t.Errorf("expected color different than", c1, "got", c)
	}

	if c := RandomColorFromArrayWithFreq(colors, 1); c != c1 {
		t.Errorf("expected color", c1, "got", c)
	}
}