This repo holds my solution for the Roman Numerals Kata. It is an excercise in Unit Testing and TDD. Personally, I used testem and Jasmine as my testrunner and testing framework, respectively.
To run the tests, simply run testem
from the command line at the root of this project. Open http://localhost:7357/ in a browser (for example) and enjoy.
source: http://agilekatas.co.uk/katas/romannumerals-kata
The Romans wrote their numbers using letters; specifically the letters 'I' meaning '1', 'V' meaning '5', 'X' meaning '10', 'L' meaning '50', 'C' meaning '100', 'D' meaning '500', and 'M' meaning '1000'.
There were certain rules that the numerals followed which should be observed.
- The symbols 'I', 'X', 'C', and 'M' can be repeated at most 3 times in a row.
- The symbols 'V', 'L', and 'D' can never be repeated.
- The '1' symbols ('I', 'X', and 'C') can only be subtracted from the 2 next highest values ('IV' and 'IX', 'XL' and 'XC', 'CD' and 'CM').
- Only one subtraction can be made per numeral ('XC' is allowed, 'XXC' is not).
The '5' symbols ('V', 'L', and 'D') can never be subtracted.
We would like to be able to convert Arabic numbers into their Roman numeral equivalents. We just need some kind of program that can accept a numeric input and output the Roman numeral for the input number.
Convert Arabic Number to Roman Numeral
As a game developer I want to be able to convert a number to a numeral So that I can label my game releases using Roman numerals
Given I have started the converter When I enter $number Then $numeral is returned
The change from the Arabic numbering system to using Roman numerals has gone really well, all things considered. There is a slight issue in that sales of the latest games have dropped off, and when questioned people have said it's because they no longer know what the latest version is, as there's no easy to read number. To remedy this, we are going to install Roman numeral to Arabic number converters everywhere we sell games, so people can work out which is the latest game.
Convert Roman Numeral to Arabic Number
As a marketing manager I want customers to be able to convert numerals to numbers So that they can buy the latest version of the game
Given I have started the converter When I enter $numeral Then $number is returned
*Notes
When learning how to use Jasmine, I found this to be helpful:
https://www.cheatography.com/citguy/cheat-sheets/jasmine-js-testing/