//https://www.selftaughtjs.com/algorithm-sundays-converting-roman-numerals/
//Test Suite
describe("Roman", function () {
it('should be able to convert numbers 1 through 3 to roman numeral I to III', function () {
expect(RomanMath.ConvertToRomanNumeral(1)).toBe("I");
expect(RomanMath.ConvertToRomanNumeral(2)).toBe("II");
expect(RomanMath.ConvertToRomanNumeral(3)).toBe("III");
});
it('should be able to convert number 4 to roman numeral IV', function () {
expect(RomanMath.ConvertToRomanNumeral(4)).toBe("IV");
});
it('should be able to convert number 5 to roman numeral V', function () {
expect(RomanMath.ConvertToRomanNumeral(5)).toBe("V");
});
it('should be able to convert number 6 through 8 to roman numerals', function () {
expect(RomanMath.ConvertToRomanNumeral(6)).toBe("VI");
expect(RomanMath.ConvertToRomanNumeral(7)).toBe("VII");
expect(RomanMath.ConvertToRomanNumeral(8)).toBe("VIII");
});
fit('should be able to convert number 9 to roman numeral IX', function () {
expect(RomanMath.ConvertToRomanNumeral(9)).toBe("IX");
});
it('should be able to convert number 10 through 19 to roman numeral', function () {
expect(RomanMath.ConvertToRomanNumeral(10)).toBe("X");
expect(RomanMath.ConvertToRomanNumeral(11)).toBe("XI");
//expect(RomanMath.ConvertToRomanNumeral(19)).toBe("XIX");
});
it('should be able to convert number 20 - 99 to roman numerals', function () {
expect(RomanMath.ConvertToRomanNumeral(20)).toBe("XX");
expect(RomanMath.ConvertToRomanNumeral(23)).toBe("XXIII");
expect(RomanMath.ConvertToRomanNumeral(61)).toBe("LXI");
expect(RomanMath.ConvertToRomanNumeral(74)).toBe("LXXIV");
});
it('should be able to convert number 100 to 1000 to roman numeral', function () {
expect(RomanMath.ConvertToRomanNumeral(100)).toBe("C");
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.