mirror of
https://github.com/gonum/gonum.git
synced 2025-10-20 05:54:41 +08:00
add test for KL panic
This commit is contained in:
@@ -727,6 +727,12 @@ func ExampleKullbackLeibler() {
|
|||||||
// The K-L distance between identical distributions is 0.0000
|
// 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) {
|
func TestChiSquare(t *testing.T) {
|
||||||
for i, test := range []struct {
|
for i, test := range []struct {
|
||||||
p []float64
|
p []float64
|
||||||
|
Reference in New Issue
Block a user