package oklab import ( "math" "testing" "smariot.com/color/internal/helper" ) func eq(c0, c1 Color) bool { return helper.EqFloat64SliceFuzzy( []float64{c0.Lightness, c0.ChromaA, c0.ChromaB}, []float64{c1.Lightness, c1.ChromaA, c1.ChromaB}, ) } func midpoint(c0, c1 Color) Color { return Color{(c0.Lightness + c1.Lightness) / 2, (c0.ChromaA + c1.ChromaA) / 2, (c0.ChromaB + c1.ChromaB) / 2} } func TestModel(t *testing.T) { helper.TestModel(t, false, Model, eq, []helper.ConvertTest[Color]{ { Name: "passthrough", In: Color{math.Inf(1), math.Inf(-1), math.NaN()}, Out: Color{math.Inf(1), math.Inf(-1), math.NaN()}, }, }) } func TestDistance(t *testing.T) { helper.TestDistance(t, false, midpoint, Distance, Model) }