Done as a recorded exercise for TechReturners, following the kata at CodingDojo.
The priority here was to practice TDD, and the red-green-refactor cycle.
As the explanatory link from the CodingDojo site was not simple to parse, I chose to follow the "standard form" of Roman Numerals as defined on wikipedia:
Thousands | Hundreds | Tens | Units | |
---|---|---|---|---|
1 | M | C | X | I |
2 | MM | CC | XX | II |
3 | MMM | CCC | XXX | III |
4 | CD | XL | IV | |
5 | D | L | V | |
6 | DC | LX | VI | |
7 | DCC | LXX | VII | |
8 | DCCC | LXXX | VIII | |
9 | CM | XC | IX |