Skip to content

Kokovikhina/RomanNumeralChallenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RomanNumeralChallenge

Table of Content:

About roman numeral challenge:

We'd like you to write some code to parse and output roman numerals and share it with us as a GitHub repo. If we wrapped your code into a console application called roman, we'd expect it to work like this:

$ roman ix
9
ix

$ roman XIIII
14
XIV

$ roman MCMXCIX
1999
MCMXCIX

Additional Notes

  • Roman numerals on Wikipedia
  • Do create an abstract data type to represent a roman number.
  • Do write unit tests.
  • Do include links to any references you used.
  • Do apply Postel's Law
  • Don't take much more than an hour.
  • Don't use someone else's code to do the parsing (we want to see how you do it!).

We'd prefer your implementation to be written in Go; if you use a different language, please advise why you chose it.

Instructions

To run program

$ go run .
Enter Roman Number: x 
10
x

To run program with roman number as argument

$ go run . x
10
x

To run tests

$ cd roman
$ go test -v

  === RUN   TestRomanToDecimal
  === RUN   TestRomanToDecimal/{"XXXIX"_'\x00'},_39
  === RUN   TestRomanToDecimal/{"CCXLVI"_'\x00'},_246
  === RUN   TestRomanToDecimal/{"DCCLXXXIX"_'\x00'},_789
  === RUN   TestRomanToDecimal/{"MMCDXXI"_'\x00'},_2421
  === RUN   TestRomanToDecimal/{""_'\x00'},_0
  === RUN   TestRomanToDecimal/{"_"_'\x00'},_0
  === RUN   TestRomanToDecimal/{"_V_"_'\x00'},_5
  === RUN   TestRomanToDecimal/{"U"_'\x00'},_0
  === RUN   TestRomanToDecimal/{"VU"_'\x00'},_0
  === RUN   TestRomanToDecimal/{"_MM_CDXXI_"_'\x00'},_2421
  === RUN   TestRomanToDecimal/{"___dcc___L__xxxIX_"_'\x00'},_789
  --- PASS: TestRomanToDecimal (0.00s)
      --- PASS: TestRomanToDecimal/{"XXXIX"_'\x00'},_39 (0.00s)
      --- PASS: TestRomanToDecimal/{"CCXLVI"_'\x00'},_246 (0.00s)
      --- PASS: TestRomanToDecimal/{"DCCLXXXIX"_'\x00'},_789 (0.00s)
      --- PASS: TestRomanToDecimal/{"MMCDXXI"_'\x00'},_2421 (0.00s)
      --- PASS: TestRomanToDecimal/{""_'\x00'},_0 (0.00s)
      --- PASS: TestRomanToDecimal/{"_"_'\x00'},_0 (0.00s)
      --- PASS: TestRomanToDecimal/{"_V_"_'\x00'},_5 (0.00s)
      --- PASS: TestRomanToDecimal/{"U"_'\x00'},_0 (0.00s)
      --- PASS: TestRomanToDecimal/{"VU"_'\x00'},_0 (0.00s)
      --- PASS: TestRomanToDecimal/{"_MM_CDXXI_"_'\x00'},_2421 (0.00s)
      --- PASS: TestRomanToDecimal/{"___dcc___L__xxxIX_"_'\x00'},_789 (0.00s)
  PASS
  ok      romannumeralchallenge/roman     0.291s

Reference links

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages