Skip to content

Commit 55b098b

Browse files
authored
rectangles: Add test for missing sides (#2050)
Some solutions to this exercise will look for the top corners of the rectangles, making sure they are connected by a horizontal line, then go on to walk down the left and right side to find corners at the same row, in which case a rectangle is detected. These solutions sometimes fail to check that the bottom two corners are connected by a horizontal line. This test case will catch that as well as missing left, right or top sides as well.
1 parent b2d6b77 commit 55b098b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

exercises/rectangles/canonical-data.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,23 @@
174174
]
175175
},
176176
"expected": 60
177+
},
178+
{
179+
"uuid": "6ef24e0f-d191-46da-b929-4faca24b4cd2",
180+
"description": "rectangles must have four sides",
181+
"property": "rectangles",
182+
"input": {
183+
"strings": [
184+
"+-+ +-+",
185+
"| | | |",
186+
"+-+-+-+",
187+
" | | ",
188+
"+-+-+-+",
189+
"| | | |",
190+
"+-+ +-+"
191+
]
192+
},
193+
"expected": 5
177194
}
178195
]
179196
}

0 commit comments

Comments
 (0)