test updates.

This commit is contained in:
Will Charczuk 2016-07-28 18:56:45 -07:00
parent a1fb284797
commit 490d7dae38
4 changed files with 7 additions and 7 deletions

View file

@ -109,7 +109,7 @@ func Normalize(values ...float64) []float64 {
}
output := make([]float64, len(values))
for x, v := range values {
output[x] = RoundDown(v/total, 0.00001)
output[x] = RoundDown(v/total, 0.0001)
}
return output
}

View file

@ -122,7 +122,7 @@ func TestNormalize(t *testing.T) {
normalized := Normalize(values...)
assert.Len(normalized, 5)
assert.Equal(0.25, normalized[0])
assert.Equal(0.15, normalized[4])
assert.Equal(0.1499, normalized[4])
}
var (

View file

@ -32,7 +32,7 @@ func (vs Values) Normalize() []Value {
output[index] = Value{
Style: v.Style,
Label: v.Label,
Value: RoundDown(v.Value/total, 0.00001),
Value: RoundDown(v.Value/total, 0.0001),
}
}
return output

View file

@ -45,8 +45,8 @@ func TestValuesValuesNormalized(t *testing.T) {
values := Values(vs).ValuesNormalized()
assert.Len(values, 7)
assert.Equal(0.212, values[0])
assert.Equal(0.042, values[6])
assert.Equal(0.2127, values[0])
assert.Equal(0.0425, values[6])
}
func TestValuesNormalize(t *testing.T) {
@ -64,6 +64,6 @@ func TestValuesNormalize(t *testing.T) {
values := Values(vs).Normalize()
assert.Len(values, 7)
assert.Equal(0.212, values[0].Value)
assert.Equal(0.042, values[6].Value)
assert.Equal(0.2127, values[0].Value)
assert.Equal(0.0425, values[6].Value)
}