2016-12-11 13:33:05 +00:00
|
|
|
package count
|
|
|
|
|
2016-12-11 13:50:01 +00:00
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
"time"
|
2016-12-11 13:33:05 +00:00
|
|
|
|
2018-04-27 15:28:03 +00:00
|
|
|
"github.com/usefathom/fathom/pkg/models"
|
|
|
|
)
|
2016-12-26 09:43:50 +00:00
|
|
|
|
|
|
|
func TestCalculatePointPercentages(t *testing.T) {
|
2018-04-27 15:28:03 +00:00
|
|
|
points := []*models.Point{
|
|
|
|
&models.Point{
|
2016-12-26 09:43:50 +00:00
|
|
|
Label: "Foo",
|
|
|
|
Value: 5,
|
|
|
|
},
|
|
|
|
}
|
2016-12-11 13:33:05 +00:00
|
|
|
|
2016-12-26 09:43:50 +00:00
|
|
|
points = calculatePointPercentages(points, 100)
|
|
|
|
|
|
|
|
if points[0].PercentageValue != 5.00 {
|
|
|
|
t.Errorf("Percentage value should be 5.00, is %.2f", points[0].PercentageValue)
|
|
|
|
}
|
2016-12-11 13:33:05 +00:00
|
|
|
}
|