Skip to content
This repository has been archived by the owner on Dec 10, 2018. It is now read-only.

Commit

Permalink
Check result of Norm for zero-sized matrices and vectors
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimir-ch committed Oct 9, 2015
1 parent d0a9cf9 commit 9cdf4d7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mat64/matrix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,16 @@ func TestNormZero(t *testing.T) {
&TriDense{mat: blas64.Triangular{Uplo: blas.Upper, Diag: blas.NonUnit}},
&Vector{},
} {
want := 0.0
for _, norm := range []float64{1, 2, math.Inf(1)} {
panicked, message := panics(func() { Norm(a, norm) })
var got float64
panicked, message := panics(func() { got = Norm(a, norm) })
if panicked {
t.Errorf("unexpected panic for Norm(&%T{}, %v): %v", a, norm, message)
}
if got != want {
t.Errorf("unexpected result for Norm(&%T{}, %v). Want %v, got %v", a, norm, want, got)
}
}
}
}
Expand Down

0 comments on commit 9cdf4d7

Please sign in to comment.