Skip to content

Commit c534e4d

Browse files
authored
pascals-triangle: format each row as one line (#1996)
suggested as a follow-up action to format-array being merged, on at least two separate occasions: #1968 (comment) #1966 (comment) The reason for the suggestion is that helps visualise the human-readable form of the triangle that we are used to seeing.
1 parent 4758bf7 commit c534e4d

File tree

2 files changed

+28
-5
lines changed

2 files changed

+28
-5
lines changed

bin/format-array.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@
6161
'ocr-numbers' => {
6262
'rows' => :multi_line,
6363
},
64+
'pascals-triangle' => {
65+
'expected' => :multi_line,
66+
},
6467
'rectangles' => {
6568
'strings' => :multi_line_unless_single,
6669
},

exercises/pascals-triangle/canonical-data.json

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
"input": {
2222
"count": 1
2323
},
24-
"expected": [[1]]
24+
"expected": [
25+
[1]
26+
]
2527
},
2628
{
2729
"uuid": "a6e5a2a2-fc9a-4b47-9f4f-ed9ad9fbe4bd",
@@ -30,7 +32,10 @@
3032
"input": {
3133
"count": 2
3234
},
33-
"expected": [[1], [1, 1]]
35+
"expected": [
36+
[1],
37+
[1, 1]
38+
]
3439
},
3540
{
3641
"uuid": "97206a99-79ba-4b04-b1c5-3c0fa1e16925",
@@ -39,7 +44,11 @@
3944
"input": {
4045
"count": 3
4146
},
42-
"expected": [[1], [1, 1], [1, 2, 1]]
47+
"expected": [
48+
[1],
49+
[1, 1],
50+
[1, 2, 1]
51+
]
4352
},
4453
{
4554
"uuid": "565a0431-c797-417c-a2c8-2935e01ce306",
@@ -48,7 +57,12 @@
4857
"input": {
4958
"count": 4
5059
},
51-
"expected": [[1], [1, 1], [1, 2, 1], [1, 3, 3, 1]]
60+
"expected": [
61+
[1],
62+
[1, 1],
63+
[1, 2, 1],
64+
[1, 3, 3, 1]
65+
]
5266
},
5367
{
5468
"uuid": "06f9ea50-9f51-4eb2-b9a9-c00975686c27",
@@ -57,7 +71,13 @@
5771
"input": {
5872
"count": 5
5973
},
60-
"expected": [[1], [1, 1], [1, 2, 1], [1, 3, 3, 1], [1, 4, 6, 4, 1]]
74+
"expected": [
75+
[1],
76+
[1, 1],
77+
[1, 2, 1],
78+
[1, 3, 3, 1],
79+
[1, 4, 6, 4, 1]
80+
]
6181
},
6282
{
6383
"uuid": "c3912965-ddb4-46a9-848e-3363e6b00b13",

0 commit comments

Comments
 (0)