Spiral Matrix tests have expected and actual results swapped

The Spiral Matrix tests report actual results as expected results and expected results as actual results. This makes the failure messages confusing at first glance as it appears that the tests are expecting the wrong result.

1 Like

Good catch, the order is indeed flipped. A solution that returns Nil shows this (see below). The track currently doesn’t have its own maintainer, but I think a PR is warranted to swap the actual and expected results.

- Suite: Spiral.spiral
  ✓ Passed: empty spiral
  ☠ Failed: trivial spiral because expected Nil, got ((1 : Nil) : Nil)
  ☠ Failed: spiral of side length 2 because expected Nil, got ((1 : 2 : Nil) : (4 : 3 : Nil) : Nil)
  ☠ Failed: spiral of side length 3 because expected Nil, got ((1 : 2 : 3 : Nil) : (8 : 9 : 4 : Nil) : (7 : 6 : 5 : Nil) : Nil)
  ☠ Failed: spiral of side length 4 because expected Nil, got ((1 : 2 : 3 : 4 : Nil) : (12 : 13 : 14 : 5 : Nil) : (11 : 16 : 15 : 6 : Nil) : (10 : 9 : 8 : 7 : Nil) : Nil)
  ☠ Failed: spiral of side length 5 because expected Nil, got ((1 : 2 : 3 : 4 : 5 : Nil) : (16 : 17 : 18 : 19 : 6 : Nil) : (15 : 24 : 25 : 20 : 7 : Nil) : (14 : 23 : 22 : 21 : 8 : Nil) : (13 : 12 : 11 : 10 : 9 : Nil) : Nil)

I’ve created a pull request that flips the inputs to be correct.

Merged. Thanks for your contribution

1 Like