Test matrix returned from matrix.New
(t *testing.T)
| 97 | |
| 98 | // Test matrix returned from matrix.New |
| 99 | func TestDefaultMatrix(t *testing.T) { |
| 100 | initialValue := 0 |
| 101 | initialRows := 3 |
| 102 | initialCols := 3 |
| 103 | defaultMatrix := matrix.New(initialRows, initialCols, initialValue) |
| 104 | |
| 105 | determinant, err := defaultMatrix.Determinant() |
| 106 | |
| 107 | if err != nil { |
| 108 | t.Fatalf("Error finding the determinant of 3 by 3 default matrix: %v.", err) |
| 109 | } |
| 110 | expectedValue := 0 |
| 111 | if determinant != expectedValue { |
| 112 | t.Errorf("Determinant of the default matrix with an initial value 0 was %d; wanted %d.", initialValue, expectedValue) |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | // Benchmark a 3 by 3 matrix for computational throughput |
| 117 | func BenchmarkSmallMatrixDeterminant(b *testing.B) { |
nothing calls this directly
no test coverage detected