Open zetashift opened 4 years ago
if it helps, an initial guess: seems like a typo in Line 19, see comment # below
"""
func ==
*[W,H](m1, m2: Matrix[W, H]): bool =
result = true
for x in 0 .. high(m1):
for y in 0 .. high(m1): #why not high(m1[0])?
if not m1[x][y].equal(m2[x][y]):
return false
"""
if it helps, an initial guess: seems like a typo in Line 19, see comment # below """ func
==
*[W,H](m1, m2: Matrix[W, H]): bool = result = true for x in 0 .. high(m1): for y in 0 .. high(m1): #why not high(m1[0])? if not m1[x][y].equal(m2[x][y]): return false """
Good catch, this is my bad! But since the matrix are equal sizes(2x2, 3x3 or 4x4) that iteration doesn't matter. I think I caught this and left it like that when I initially wrote the function.
Even changing that I still get the same error.
It works?
@mratsim I think I should've made the default code be the failing case. :P if you see in the setup
block that you should comment out the code to let it error out; like this: https://play.nim-lang.org/#ix=2gv9
For the current one you need to uncomment the matrix3x3 definition and it's test block.
Lol, @mratsim I made the same mistake...
See the playground example, if I have
matrix3x3
andmatrix4x4
defined, Nim throws an error of type mismatch at me, however if one of them is commented out, everything is fine and I get a successful compilation.Example
Failing example: https://play.nim-lang.org/#ix=2gv9 Working example: https://play.nim-lang.org/#ix=2fGO
Current Output
Expected Output
Possible Solution
None found, sorry :(.
Additional Information
I have not found a solution, replacing the suite/tests with a
block
statement and just assert expressions resulted in the same error. So it has nothing to do with unittest.