mirror of
https://github.com/gonum/gonum.git
synced 2025-10-06 07:37:03 +08:00
stat: unexport Panics testing helper
A+C: add Daniel Fireman
This commit is contained in:

committed by
Dan Kortschak

parent
fa42c6938b
commit
aff0e10c44
@@ -87,13 +87,13 @@ func TestCovarianceMatrix(t *testing.T) {
|
||||
}
|
||||
|
||||
}
|
||||
if !Panics(func() { CovarianceMatrix(nil, mat.NewDense(5, 2, nil), []float64{}) }) {
|
||||
if !panics(func() { CovarianceMatrix(nil, mat.NewDense(5, 2, nil), []float64{}) }) {
|
||||
t.Errorf("CovarianceMatrix did not panic with weight size mismatch")
|
||||
}
|
||||
if !Panics(func() { CovarianceMatrix(mat.NewSymDense(1, nil), mat.NewDense(5, 2, nil), nil) }) {
|
||||
if !panics(func() { CovarianceMatrix(mat.NewSymDense(1, nil), mat.NewDense(5, 2, nil), nil) }) {
|
||||
t.Errorf("CovarianceMatrix did not panic with preallocation size mismatch")
|
||||
}
|
||||
if !Panics(func() { CovarianceMatrix(nil, mat.NewDense(2, 2, []float64{1, 2, 3, 4}), []float64{1, -1}) }) {
|
||||
if !panics(func() { CovarianceMatrix(nil, mat.NewDense(2, 2, []float64{1, 2, 3, 4}), []float64{1, -1}) }) {
|
||||
t.Errorf("CovarianceMatrix did not panic with negative weights")
|
||||
}
|
||||
}
|
||||
@@ -183,13 +183,13 @@ func TestCorrelationMatrix(t *testing.T) {
|
||||
}
|
||||
|
||||
}
|
||||
if !Panics(func() { CorrelationMatrix(nil, mat.NewDense(5, 2, nil), []float64{}) }) {
|
||||
if !panics(func() { CorrelationMatrix(nil, mat.NewDense(5, 2, nil), []float64{}) }) {
|
||||
t.Errorf("CorrelationMatrix did not panic with weight size mismatch")
|
||||
}
|
||||
if !Panics(func() { CorrelationMatrix(mat.NewSymDense(1, nil), mat.NewDense(5, 2, nil), nil) }) {
|
||||
if !panics(func() { CorrelationMatrix(mat.NewSymDense(1, nil), mat.NewDense(5, 2, nil), nil) }) {
|
||||
t.Errorf("CorrelationMatrix did not panic with preallocation size mismatch")
|
||||
}
|
||||
if !Panics(func() { CorrelationMatrix(nil, mat.NewDense(2, 2, []float64{1, 2, 3, 4}), []float64{1, -1}) }) {
|
||||
if !panics(func() { CorrelationMatrix(nil, mat.NewDense(2, 2, []float64{1, 2, 3, 4}), []float64{1, -1}) }) {
|
||||
t.Errorf("CorrelationMatrix did not panic with negative weights")
|
||||
}
|
||||
}
|
||||
@@ -256,7 +256,7 @@ func TestCorrCov(t *testing.T) {
|
||||
t.Errorf("%d: covToCorr did not match direct Covariance calculation. Want: %v, got: %v. ", i, cov, covFromCorr)
|
||||
}
|
||||
|
||||
if !Panics(func() { corrToCov(mat.NewSymDense(2, nil), []float64{}) }) {
|
||||
if !panics(func() { corrToCov(mat.NewSymDense(2, nil), []float64{}) }) {
|
||||
t.Errorf("CorrelationMatrix did not panic with sigma size mismatch")
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user