added coverage
This commit is contained in:
parent
3e9c1a9df6
commit
78387b0284
@ -282,7 +282,6 @@ func TestString(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func TestJson(t *testing.T) {
|
func TestJson(t *testing.T) {
|
||||||
ps := NewPopulationStat()
|
ps := NewPopulationStat()
|
||||||
for _, v := range []float64{1, 1, 2, 2} {
|
for _, v := range []float64{1, 1, 2, 2} {
|
||||||
@ -297,3 +296,30 @@ func TestJson(t *testing.T) {
|
|||||||
t.Fatalf("wrong json encoding; got %q, want %q", got, want)
|
t.Fatalf("wrong json encoding; got %q, want %q", got, want)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestN(t *testing.T) {
|
||||||
|
ps := NewPopulationStat()
|
||||||
|
for _, v := range []float64{1, 1, 2, 2} {
|
||||||
|
ps.Push(v)
|
||||||
|
}
|
||||||
|
if got, want := ps.N(), uint64(4); got != want {
|
||||||
|
t.Fatalf("unexpected number of values in ps: got %v, want %v", got, want)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestCI(t *testing.T) {
|
||||||
|
ps := NewPopulationStat()
|
||||||
|
for _, v := range []float64{1, 1, 2, 2} {
|
||||||
|
ps.Push(v)
|
||||||
|
}
|
||||||
|
cil, cir := ps.CI()
|
||||||
|
wantl, wantr := float64(1.01001), float64(1.98999)
|
||||||
|
|
||||||
|
if got, want := cil, wantl; got != want {
|
||||||
|
t.Errorf("unexpected lower confidence interval; got %v, want %v", got, want)
|
||||||
|
}
|
||||||
|
|
||||||
|
if got, want := cir, wantr; got != want {
|
||||||
|
t.Errorf("unexpected upper confidence interval; got %v, want %v", got, want)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user