Skip to content

Commit acdf199

Browse files
meatball133IsaacG
andauthored
[palindrome-products ]: Added test case where first product is not min product (#2174)
Update exercises/palindrome-products/canonical-data.json with a test case where the first product (i.e. min factor) is not the min product. Co-authored-by: Isaac Good <[email protected]>
1 parent cb7eab5 commit acdf199

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

exercises/palindrome-products/canonical-data.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,24 @@
157157
"expected": {
158158
"error": "min must be <= max"
159159
}
160+
},
161+
{
162+
"uuid": "16481711-26c4-42e0-9180-e2e4e8b29c23",
163+
"description": "smallest product does not use the smallest factor",
164+
"comments": [
165+
"This test catches code which assumes the smallest product is the product which uses the smallest factor.",
166+
"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]]`",
167+
"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"
168+
],
169+
"property": "smallest",
170+
"input": {
171+
"min": 3215,
172+
"max": 4000
173+
},
174+
"expected": {
175+
"value": 10988901,
176+
"factors": [[3297, 3333]]
177+
}
160178
}
161179
]
162180
}

0 commit comments

Comments
 (0)