Game of Life test data formatting

The Game of Life exercise currently formats test data on a single line, for example:

@test gameoflife([1 0 1; 1 0 1; 1 0 1]) == [0 0 0; 1 0 1; 0 0 0]

but as we’re dealing with a matrix, it would be more convenient to see the matrix visually as a 2d matrix:

matrix = [1 0 1
          1 0 1
          1 0 1]
expected = [0 0 0
            1 0 1
            0 0 0]
@test gameoflife(matrix) == expected
2 Likes

It looks like this got crunched onto one line 3 weeks ago, when we added Jinja2 templating.

We already have a julia_matrix macro to convert JSON’s nested lists to a real matrix. Now we need to make that more sophisticated in the way it handles output formatting.

Thanks for reporting, we’ll look into it.

3 Likes

I just pushed some changes in PR #1189, which will hopefully be merged later today. This also updates Spiral Matrix and Saddle Point, which had similar issues.

The main challenge was when the template macro got in a fight with the jlfmt formatter. Too much automation!

2 Likes