add test for KL panic

This commit is contained in:
Jonathan J Lawlor
2014-10-30 23:04:56 -04:00
parent f3f7e82a84
commit 219b791a54

View File

@@ -727,6 +727,12 @@ func ExampleKullbackLeibler() {
// The K-L distance between identical distributions is 0.0000
}
func TestKullbackLeibler(t *testing.T) {
if !Panics(func() { KullbackLeibler(make([]float64, 3), make([]float64, 2)) }) {
t.Errorf("KullbackLeibler did not panic with p, q length mismatch")
}
}
func TestChiSquare(t *testing.T) {
for i, test := range []struct {
p []float64