Skip to content

Commit 0633b28

Browse files
authored
Merge pull request exercism#288 from petertseng/rectangles-json
rectangles: Add JSON test data
2 parents 2d6e205 + 33f022c commit 0633b28

File tree

1 file changed

+101
-0
lines changed

1 file changed

+101
-0
lines changed

rectangles.json

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
{
2+
"#": [
3+
"The inputs are represented as arrays of strings to improve readability in this JSON file.",
4+
"Your track may choose whether to present the input as a single string (concatenating all the lines) or as the list."
5+
],
6+
"cases": [
7+
{
8+
"description": "no rows",
9+
"input": [],
10+
"expected": 0
11+
},
12+
{
13+
"description": "no columns",
14+
"input": [""],
15+
"expected": 0
16+
},
17+
{
18+
"description": "no rectangles",
19+
"input": [" "],
20+
"expected": 0
21+
},
22+
{
23+
"description": "one rectangle",
24+
"input": [
25+
"+-+",
26+
"| |",
27+
"+-+"
28+
],
29+
"expected": 1
30+
},
31+
{
32+
"description": "two rectangles without shared parts",
33+
"input": [
34+
" +-+",
35+
" | |",
36+
"+-+-+",
37+
"| | ",
38+
"+-+ "
39+
],
40+
"expected": 2
41+
},
42+
{
43+
"description": "five rectangles with shared parts",
44+
"input": [
45+
" +-+",
46+
" | |",
47+
"+-+-+",
48+
"| | |",
49+
"+-+-+"
50+
],
51+
"expected": 5
52+
},
53+
{
54+
"description": "only complete rectangles are counted",
55+
"input": [
56+
" +-+",
57+
" |",
58+
"+-+-+",
59+
"| | -",
60+
"+-+-+"
61+
],
62+
"expected": 1
63+
},
64+
{
65+
"description": "rectangles can be of different sizes",
66+
"input": [
67+
"+------+----+",
68+
"| | |",
69+
"+---+--+ |",
70+
"| | |",
71+
"+---+-------+"
72+
],
73+
"expected": 3
74+
},
75+
{
76+
"description": "corner is required for a rectangle to be complete",
77+
"input": [
78+
"+------+----+",
79+
"| | |",
80+
"+------+ |",
81+
"| | |",
82+
"+---+-------+"
83+
],
84+
"expected": 2
85+
},
86+
{
87+
"description": "large input with many rectangles",
88+
"input": [
89+
"+---+--+----+",
90+
"| +--+----+",
91+
"+---+--+ |",
92+
"| +--+----+",
93+
"+---+--+--+-+",
94+
"+---+--+--+-+",
95+
"+------+ | |",
96+
" +-+"
97+
],
98+
"expected": 60
99+
}
100+
]
101+
}

0 commit comments

Comments
 (0)