fathom/pkg/count/count_test.go

23 lines
399 B
Go
Raw Normal View History

2016-12-11 13:33:05 +00:00
package count
2016-12-11 13:50:01 +00:00
import (
"testing"
2016-12-11 13:33:05 +00:00
"github.com/usefathom/fathom/pkg/models"
)
func TestCalculatePointPercentages(t *testing.T) {
totals := []*models.Total{
&models.Total{
Value: "Foo",
Count: 5,
},
}
2016-12-11 13:33:05 +00:00
totals = calculatePercentagesOfTotal(totals, 100)
if totals[0].PercentageOfTotal != 5.00 {
t.Errorf("Percentage value should be 5.00, is %.2f", totals[0].PercentageOfTotal)
}
2016-12-11 13:33:05 +00:00
}