Test simple matrix operations
(t *testing.T)
| 8 | |
| 9 | // Test simple matrix operations |
| 10 | func Test(t *testing.T) { |
| 11 | |
| 12 | m := NewMatrix() |
| 13 | |
| 14 | // m.Get(1, 1) // panics with "runtime error: index out of range" as expected |
| 15 | |
| 16 | m.Set(2, 4, true) |
| 17 | m.Set(3, 2, true) |
| 18 | if m.Get(1, 1) != false { |
| 19 | t.Error("Get failed") |
| 20 | } |
| 21 | if m.Get(2, 4) != true { |
| 22 | t.Error("Get failed") |
| 23 | } |
| 24 | if m.Get(3, 2) != true { |
| 25 | t.Error("Get failed") |
| 26 | } |
| 27 | |
| 28 | m.Set(2, 4, false) |
| 29 | m.Set(3, 2, false) |
| 30 | if m.Get(2, 4) != false { |
| 31 | t.Error("Get failed") |
| 32 | } |
| 33 | if m.Get(3, 2) != false { |
| 34 | t.Error("Get failed") |
| 35 | } |
| 36 | |
| 37 | // m.Get(100, 100) // panics with "runtime error: index out of range" as expected |
| 38 | } |