Description
The test suite for line-up does not include any numbers whose last two digits are a multiple of 11, 12, or 13 outside the 11–13 range itself (e.g. 22, 24, 33, 36, 44, 52, 60, 63, 65, 72, 78, 91, 96...).
This gap allows an incorrect implementation to pass. For example, a common bug is checking divisibility instead of range when handling the "teens" exception:
if (last2 % 11 === 0 || last2 % 12 === 0 || last2 % 13 === 0) return `${number}th`;
This looks like it's meant to handle the 11th/12th/13th exception (and does, since 11%11=0, 12%12=0, 13%13=0), but it also incorrectly catches any other multiple of 11, 12, or 13 — such as 22, 33, 44, 52, 91 — and returns "th" for them instead of the correct "nd"/"rd"/"st".
Expected behavior
22 → "22nd" (a buggy implementation using the check above would produce "22th")
33 → "33rd"
52 → "52nd"
91 → "91st"
Suggested fix
Add at least one test case per suffix category (1st/2nd/3rd/4th-equivalents) that is also a multiple of 11, 12, or 13, to catch this class of bug (e.g. 22, 33, 52, 91.)
If line-up has canonical data in problem-specifications, it may be worth raising there too, since it's shared across tracks.
Description
The test suite for
line-updoes not include any numbers whose last two digits are a multiple of 11, 12, or 13 outside the 11–13 range itself (e.g. 22, 24, 33, 36, 44, 52, 60, 63, 65, 72, 78, 91, 96...).This gap allows an incorrect implementation to pass. For example, a common bug is checking divisibility instead of range when handling the "teens" exception:
This looks like it's meant to handle the 11th/12th/13th exception (and does, since 11%11=0, 12%12=0, 13%13=0), but it also incorrectly catches any other multiple of 11, 12, or 13 — such as 22, 33, 44, 52, 91 — and returns "th" for them instead of the correct "nd"/"rd"/"st".
Expected behavior
22→"22nd"(a buggy implementation using the check above would produce"22th")33→"33rd"52→"52nd"91→"91st"Suggested fix
Add at least one test case per suffix category (1st/2nd/3rd/4th-equivalents) that is also a multiple of 11, 12, or 13, to catch this class of bug (e.g.
22,33,52,91.)If
line-uphas canonical data inproblem-specifications, it may be worth raising there too, since it's shared across tracks.