MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / TestMatrixRows

Function TestMatrixRows

math/matrix/matrix_test.go:132–145  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

130}
131
132func TestMatrixRows(t *testing.T) {
133 // Create a sample matrix
134 data := [][]int{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}
135 matrix, err := matrix.NewFromElements(data)
136 if err != nil {
137 t.Fatalf("Failed to copy matrix: %v", err)
138 }
139 // Check the number of rows
140 expectedRows := len(data)
141 rows := matrix.Rows()
142 if rows != expectedRows {
143 t.Errorf("Expected %d rows, but got %d", expectedRows, rows)
144 }
145}
146
147func TestMatrixColumns(t *testing.T) {
148 // Create a sample matrix

Callers

nothing calls this directly

Calls 1

RowsMethod · 0.80

Tested by

no test coverage detected