Skip to content

Commit

Permalink
round decimals in test
Browse files Browse the repository at this point in the history
  • Loading branch information
gabotechs committed Feb 3, 2024
1 parent 986db16 commit 1561d9c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/entropy/dirs_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package entropy

import (
"math"
"testing"

"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -195,14 +196,19 @@ func TestDirTree_GroupingsForDir(t *testing.T) {
var colors [][]float64
for _, path := range tt.Paths {
groupings = append(groupings, dirTree.GroupingsForDir(splitBaseNames(path)))
colors = append(colors, dirTree.ColorForDir(splitBaseNames(path), HSV))
color := dirTree.ColorForDir(splitBaseNames(path), HSV)
colors = append(colors, []float64{round(color[0]), round(color[1]), round(color[2])})
}
a.Equal(tt.ExpectedGroupings, groupings)
a.Equal(tt.ExpectedColors, colors)
})
}
}

func round(n float64) float64 {
return math.Round(n*1000) / 1000
}

func unwrapDirTree(tree *DirTree) interface{} {
if tree == nil {
return nil
Expand Down

0 comments on commit 1561d9c

Please sign in to comment.