-
-
Notifications
You must be signed in to change notification settings - Fork 551
/
Copy pathcanonical-data.json
180 lines (180 loc) · 4.55 KB
/
canonical-data.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
{
"exercise": "palindrome-products",
"cases": [
{
"uuid": "5cff78fe-cf02-459d-85c2-ce584679f887",
"description": "find the smallest palindrome from single digit factors",
"property": "smallest",
"input": {
"min": 1,
"max": 9
},
"expected": {
"value": 1,
"factors": [[1, 1]]
}
},
{
"uuid": "0853f82c-5fc4-44ae-be38-fadb2cced92d",
"description": "find the largest palindrome from single digit factors",
"property": "largest",
"input": {
"min": 1,
"max": 9
},
"expected": {
"value": 9,
"factors": [
[1, 9],
[3, 3]
]
}
},
{
"uuid": "66c3b496-bdec-4103-9129-3fcb5a9063e1",
"description": "find the smallest palindrome from double digit factors",
"property": "smallest",
"input": {
"min": 10,
"max": 99
},
"expected": {
"value": 121,
"factors": [[11, 11]]
}
},
{
"uuid": "a10682ae-530a-4e56-b89d-69664feafe53",
"description": "find the largest palindrome from double digit factors",
"property": "largest",
"input": {
"min": 10,
"max": 99
},
"expected": {
"value": 9009,
"factors": [[91, 99]]
}
},
{
"uuid": "cecb5a35-46d1-4666-9719-fa2c3af7499d",
"description": "find the smallest palindrome from triple digit factors",
"property": "smallest",
"input": {
"min": 100,
"max": 999
},
"expected": {
"value": 10201,
"factors": [[101, 101]]
}
},
{
"uuid": "edab43e1-c35f-4ea3-8c55-2f31dddd92e5",
"description": "find the largest palindrome from triple digit factors",
"property": "largest",
"input": {
"min": 100,
"max": 999
},
"expected": {
"value": 906609,
"factors": [[913, 993]]
}
},
{
"uuid": "4f802b5a-9d74-4026-a70f-b53ff9234e4e",
"description": "find the smallest palindrome from four digit factors",
"property": "smallest",
"input": {
"min": 1000,
"max": 9999
},
"expected": {
"value": 1002001,
"factors": [[1001, 1001]]
}
},
{
"uuid": "787525e0-a5f9-40f3-8cb2-23b52cf5d0be",
"description": "find the largest palindrome from four digit factors",
"property": "largest",
"input": {
"min": 1000,
"max": 9999
},
"expected": {
"value": 99000099,
"factors": [[9901, 9999]]
}
},
{
"uuid": "58fb1d63-fddb-4409-ab84-a7a8e58d9ea0",
"description": "empty result for smallest if no palindrome in the range",
"property": "smallest",
"input": {
"min": 1002,
"max": 1003
},
"expected": {
"value": null,
"factors": []
}
},
{
"uuid": "9de9e9da-f1d9-49a5-8bfc-3d322efbdd02",
"description": "empty result for largest if no palindrome in the range",
"property": "largest",
"input": {
"min": 15,
"max": 15
},
"expected": {
"value": null,
"factors": []
}
},
{
"uuid": "12e73aac-d7ee-4877-b8aa-2aa3dcdb9f8a",
"description": "error result for smallest if min is more than max",
"property": "smallest",
"input": {
"min": 10000,
"max": 1
},
"expected": {
"error": "min must be <= max"
}
},
{
"uuid": "eeeb5bff-3f47-4b1e-892f-05829277bd74",
"description": "error result for largest if min is more than max",
"property": "largest",
"input": {
"min": 2,
"max": 1
},
"expected": {
"error": "min must be <= max"
}
},
{
"uuid": "16481711-26c4-42e0-9180-e2e4e8b29c23",
"description": "smallest product does not use the smallest factor",
"comments": [
"This test catches code which assumes the smallest product is the product which uses the smallest factor.",
"e.g. `for x in (min_factor .. max_factor) for y in (min_factor .. max_factor) if palindrome(x, y) return [x * y, [x, y]]`",
"All the other tests pass when using logic like that, i.e. the other tests check for palindrome product but do not always test for the _smallest_ product"
],
"property": "smallest",
"input": {
"min": 3215,
"max": 4000
},
"expected": {
"value": 10988901,
"factors": [[3297, 3333]]
}
}
]
}