(b *testing.B)
| 43 | } |
| 44 | |
| 45 | func BenchmarkIsValid(b *testing.B) { |
| 46 | // Create a sample matrix for benchmarking |
| 47 | rows := 100 |
| 48 | columns := 100 |
| 49 | elements := make([][]int, rows) |
| 50 | for i := range elements { |
| 51 | elements[i] = make([]int, columns) |
| 52 | for j := range elements[i] { |
| 53 | elements[i][j] = i*columns + j // Some arbitrary values |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | // Reset the benchmark timer |
| 58 | b.ResetTimer() |
| 59 | |
| 60 | // Run the benchmark |
| 61 | for i := 0; i < b.N; i++ { |
| 62 | _ = matrix.IsValid(elements) |
| 63 | } |
| 64 | } |