Add test fixture for weighted Harmonic Mean

Added a simple test case for weighted harmonic mean.
This commit is contained in:
Jonathan J Lawlor
2014-11-02 23:12:11 -05:00
parent e96934fae8
commit ad68effc03

View File

@@ -321,6 +321,11 @@ func TestHarmonicMean(t *testing.T) {
x: []float64{.5, .125},
ans: .2,
},
{
x: []float64{.5, .125},
wts: []float64{2, 1},
ans: .25,
},
} {
c := HarmonicMean(test.x, test.wts)
if math.Abs(c-test.ans) > 1e-14 {