Skip to content

Commit 3b08f23

Browse files
authored
Merge pull request #642 from rbasso/grains-schema
grains: Make exercise schema-compliant
2 parents 572f58d + 2e0e77e commit 3b08f23

File tree

1 file changed

+75
-60
lines changed

1 file changed

+75
-60
lines changed

exercises/grains/canonical-data.json

Lines changed: 75 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,81 @@
11
{
2-
"#": [
2+
"exercise": "grains",
3+
"version": "1.0.0",
4+
"comments": [
35
"The final tests of square test error conditions",
46
"The expection for these tests is -1, indicating an error",
57
"In these cases you should expect an error as is idiomatic for your language"
68
],
7-
"square": {
8-
"description": "returns the number of grains on the square",
9-
"cases": [
10-
{
11-
"description": "1",
12-
"input": 1,
13-
"expected": 1
14-
},
15-
{
16-
"description": "2",
17-
"input": 2,
18-
"expected": 2
19-
},
20-
{
21-
"description": "3",
22-
"input": 3,
23-
"expected": 4
24-
},
25-
{
26-
"description": "4",
27-
"input": 4,
28-
"expected": 8
29-
},
30-
{
31-
"description": "16",
32-
"input": 16,
33-
"expected": 32768
34-
},
35-
{
36-
"description": "32",
37-
"input": 32,
38-
"expected": 2147483648
39-
},
40-
{
41-
"description": "64",
42-
"input": 64,
43-
"expected": 9223372036854775808
44-
},
45-
{
46-
"description": "square 0 raises an exception",
47-
"input": 0,
48-
"expected": -1
49-
},
50-
{
51-
"description": "negative square raises an exception",
52-
"input": -1,
53-
"expected": -1
54-
},
55-
{
56-
"description": "square greater than 64 raises an exception",
57-
"input": 65,
58-
"expected": -1
59-
}
60-
]
61-
},
62-
"total": {
63-
"description": "returns the total number of grains on the board",
64-
"expected": 18446744073709551615
65-
}
9+
"cases": [
10+
{
11+
"description": "returns the number of grains on the square",
12+
"cases": [
13+
{
14+
"description": "1",
15+
"property": "square",
16+
"input": 1,
17+
"expected": 1
18+
},
19+
{
20+
"description": "2",
21+
"property": "square",
22+
"input": 2,
23+
"expected": 2
24+
},
25+
{
26+
"description": "3",
27+
"property": "square",
28+
"input": 3,
29+
"expected": 4
30+
},
31+
{
32+
"description": "4",
33+
"property": "square",
34+
"input": 4,
35+
"expected": 8
36+
},
37+
{
38+
"description": "16",
39+
"property": "square",
40+
"input": 16,
41+
"expected": 32768
42+
},
43+
{
44+
"description": "32",
45+
"property": "square",
46+
"input": 32,
47+
"expected": 2147483648
48+
},
49+
{
50+
"description": "64",
51+
"property": "square",
52+
"input": 64,
53+
"expected": 9223372036854775808
54+
},
55+
{
56+
"description": "square 0 raises an exception",
57+
"property": "square",
58+
"input": 0,
59+
"expected": -1
60+
},
61+
{
62+
"description": "negative square raises an exception",
63+
"property": "square",
64+
"input": -1,
65+
"expected": -1
66+
},
67+
{
68+
"description": "square greater than 64 raises an exception",
69+
"property": "square",
70+
"input": 65,
71+
"expected": -1
72+
}
73+
]
74+
},
75+
{
76+
"description": "returns the total number of grains on the board",
77+
"property": "total",
78+
"expected": 18446744073709551615
79+
}
80+
]
6681
}

0 commit comments

Comments
 (0)