mirror of
https://github.com/gonum/gonum.git
synced 2025-10-05 23:26:52 +08:00
mat: disallow New calls with zero length
This commit is contained in:

committed by
Dan Kortschak

parent
d41320af1e
commit
3b99883391
@@ -30,7 +30,7 @@ var denseData = []struct {
|
||||
}{
|
||||
{
|
||||
raw: []byte("\x01\x00\x00\x00GFA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"),
|
||||
want: NewDense(0, 0, []float64{}),
|
||||
want: &Dense{},
|
||||
err: ErrZeroLength,
|
||||
eq: Equal,
|
||||
},
|
||||
@@ -305,7 +305,7 @@ var vectorData = []struct {
|
||||
}{
|
||||
{
|
||||
raw: []byte("\x01\x00\x00\x00GFA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"),
|
||||
want: NewVecDense(0, []float64{}),
|
||||
want: &VecDense{},
|
||||
err: ErrZeroLength,
|
||||
eq: Equal,
|
||||
},
|
||||
|
Reference in New Issue
Block a user