Description:
The formatRomanNumeral(num) function will convert a positive integer into its Roman numeral representation.
It should support values from 1 up to at least 3999 (standard Roman numeral system).
Acceptance Criteria:
1 → "I"
4 → "IV"
9 → "IX"
58 → "LVIII" // (50 + 5 + 3)
1994 → "MCMXCIV" // (1000 + 900 + 90 + 4)
2025 → "MMXXV"
3999 → "MMMCMXCIX"
0 → "" // return empty string or throw error for 0
-5 → Error // invalid input
"123" → Error // must be number
The function must:
- Handle all valid integers in the range 1–3999.
- Use subtractive notation (e.g., IV for 4, IX for 9, XL for 40, CM for 900).
- Return an empty string or throw an error for 0 and negative numbers.
- Throw a TypeError if the input is not a number.
- Include comprehensive unit tests for edge cases (1, 4, 9, 3999, invalid inputs).
Description:
The formatRomanNumeral(num) function will convert a positive integer into its Roman numeral representation.
It should support values from 1 up to at least 3999 (standard Roman numeral system).
Acceptance Criteria:
The function must: