From 219b791a5493d6ed98113053079341a8049f8ed3 Mon Sep 17 00:00:00 2001 From: Jonathan J Lawlor Date: Thu, 30 Oct 2014 23:04:56 -0400 Subject: [PATCH] add test for KL panic --- stat_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/stat_test.go b/stat_test.go index c44658b9..8e4291f9 100644 --- a/stat_test.go +++ b/stat_test.go @@ -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