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

Function TestMatrixEmptyRowsAndColumns

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

Source from the content-addressed store, hash-verified

160}
161
162func TestMatrixEmptyRowsAndColumns(t *testing.T) {
163 // Create an empty matrix
164 emptyMatrix := matrix.New(0, 0, 0)
165
166 // Check the number of rows and columns for an empty matrix
167 rows := emptyMatrix.Rows()
168 columns := emptyMatrix.Columns()
169
170 if rows != 0 {
171 t.Errorf("Expected 0 rows for an empty matrix, but got %d", rows)
172 }
173
174 if columns != 0 {
175 t.Errorf("Expected 0 columns for an empty matrix, but got %d", columns)
176 }
177}
178
179// BenchmarkNew benchmarks the New function.
180func BenchmarkNew(b *testing.B) {

Callers

nothing calls this directly

Calls 3

NewFunction · 0.92
RowsMethod · 0.80
ColumnsMethod · 0.80

Tested by

no test coverage detected