-
Notifications
You must be signed in to change notification settings - Fork 1
/
matrixRegistry_test.go
46 lines (40 loc) · 925 Bytes
/
matrixRegistry_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright (c) 2018 Ross Merrigan
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
package graphblas_test
import (
"testing"
"github.com/rossmerr/graphblas"
)
func TestSparseMatrixRegistry_IsSparseMatrix(t *testing.T) {
tests := []struct {
name string
s graphblas.MatrixLogical[float64]
isSparse bool
}{
{
name: "DenseMatrix",
s: graphblas.NewDenseMatrix[float64](2, 2),
isSparse: false,
},
{
name: "CSCMatrix",
s: graphblas.NewCSCMatrix[float64](2, 2),
isSparse: true,
},
{
name: "CSRMatrix",
s: graphblas.NewCSRMatrix[float64](2, 2),
isSparse: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
v := graphblas.IsSparseMatrix(tt.s)
if tt.isSparse != v {
t.Errorf("%+v IsSparseMatrix = %+v, want %+v", tt.name, v, tt.isSparse)
}
})
}
}