Roman numeral kata

Problem

Create function to convert numeral into a digit, i.e. I, V, X, L, C, D, and M to 1, 5, 10, 50, 100, and 500 respectively.

Model

  • Input: numeral

  • Output: digit

  • Data: dictionary

    Numeral Digit
    I 1
    V 5
    X 10
    L 50
    D 500
    M 1000
  • Action: Use numeral to get digit

Test

  • is dictionary
  • add key value pair
  • matches numeral key and gets corresponding digit value