Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mbogus committed Feb 21, 2017
1 parent 68a0021 commit 8b28157
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions stat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,18 @@ func TestNormalize(t *testing.T) {
}
}

func TestNormalize_Flat(t *testing.T) {
scores := []float64{1., 1., 1., 1., 1.}
zscores := Normalize(scores, nil)
compareArrays([]float64{0., 0., 0., 0., 0.}, zscores, t)
if got, want := stat.Mean(zscores, nil), 0.; !floatEquals(got, want) {
t.Errorf("Expected mean=%f, got=%f", want, got)
}
if got, want := stat.StdDev(zscores, nil), 0.; !floatEquals(got, want) {
t.Errorf("Expected standard deviation=%f, got=%f", want, got)
}
}

const epsilon float64 = 0.0001

func floatEquals(a, b float64) bool {
Expand Down

0 comments on commit 8b28157

Please sign in to comment.