diff options
author | Andrii Riabushenko <cdome@bk.ru> | 2018-12-08 23:04:38 +0000 |
---|---|---|
committer | Andrii Riabushenko <cdome@bk.ru> | 2018-12-08 23:04:38 +0000 |
commit | ae24b872191bead0ed2ba456fb78903b9717f107 (patch) | |
tree | f9fd3fba925108a79f407d647077d0799b02a76b /tests/destructor | |
parent | e5b9d89bcf15f34b54aeb95a8678b0223d1d9f7a (diff) | |
download | Nim-ae24b872191bead0ed2ba456fb78903b9717f107.tar.gz |
Double sink checks
Diffstat (limited to 'tests/destructor')
-rw-r--r-- | tests/destructor/tmatrix.nim | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/destructor/tmatrix.nim b/tests/destructor/tmatrix.nim index a16bfa37b..6ae38fc29 100644 --- a/tests/destructor/tmatrix.nim +++ b/tests/destructor/tmatrix.nim @@ -67,17 +67,17 @@ proc `[]=`*(m: var Matrix, i, j: int, s: float) = proc `-`*(m: sink Matrix): Matrix = ## Unary minus result = m - for i in 0 ..< m.m: - for j in 0 ..< m.n: - result[i, j] = -m[i, j] + for i in 0 ..< result.m: + for j in 0 ..< result.n: + result[i, j] = -result[i, j] proc `+`*(a: sink Matrix; b: Matrix): Matrix = ## ``C = A + B`` assert(b.m == a.m and b.n == a.n, "Matrix dimensions must agree.") result = a - for i in 0 ..< a.m: - for j in 0 ..< a.n: - result[i, j] = a[i, j] + b[i, j] + for i in 0 ..< result.m: + for j in 0 ..< result.n: + result[i, j] = result[i, j] + b[i, j] proc `-`*(a: sink Matrix; b: Matrix): Matrix = ## ``C = A - B`` |