Skip to content

Commit

Permalink
palette/moreland: remove go1.7 build constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
kortschak committed Oct 27, 2017
1 parent 3469efe commit a6eb396
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 32 deletions.
32 changes: 0 additions & 32 deletions palette/moreland/benchmarkgo17_test.go

This file was deleted.

20 changes: 20 additions & 0 deletions palette/moreland/luminance_test.go
Expand Up @@ -7,6 +7,7 @@ package moreland
import (
"fmt"
"image/color"
"math/rand"
"reflect"
"testing"
)
Expand Down Expand Up @@ -118,3 +119,22 @@ func TestExtendedBlackBody(t *testing.T) {
func floatToUint32(f float64) uint32 {
return uint32(f * 0xffff)
}

func BenchmarkLuminance_At(b *testing.B) {
pBase := ExtendedBlackBody()
for n := 2; n < 12; n += 2 {
p, err := NewLuminance(pBase.Palette(n).Colors())
if err != nil {
b.Fatal(err)
}
p.SetMax(1)
rand.Seed(1)
b.Run(fmt.Sprintf("%d controls", n), func(b *testing.B) {
for i := 0; i < b.N; i++ {
if _, err := p.At(rand.Float64()); err != nil {
b.Fatal(err)
}
}
})
}
}

0 comments on commit a6eb396

Please sign in to comment.