Guest User

Untitled

a guest
Feb 21st, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. import {assert} from "chai";
  2. import {Roman} from "../src/Roman";
  3.  
  4. function toRoman(arabic: number) {
  5. return new Roman().toRoman(arabic);
  6. }
  7.  
  8. describe('RomanNumbers', () => {
  9. describe('toRoman() is', () => {
  10.  
  11. function assertRomanIs(arabic: number, expected: string) {
  12. assert.equal(toRoman(arabic), expected);
  13. }
  14.  
  15. it('I for 1', () => {
  16. assertRomanIs(1, 'I');
  17. });
  18.  
  19. it('II for 2', () => {
  20. assertRomanIs(2, 'II');
  21. });
  22.  
  23. it('is III for 3', () => {
  24. assertRomanIs(3, 'III');
  25. });
  26.  
  27. it('is IV for 4', () => {
  28. assertRomanIs(4, 'IV');
  29. });
  30.  
  31. it('adds V for numbers between 8 and 5', () => {
  32. assertRomanIs(5, 'V')
  33. assertRomanIs(6, 'VI');
  34. assertRomanIs(7, 'VII');
  35. assertRomanIs(8, 'VIII');
  36. });
  37.  
  38. it('is IX for 9', () => {
  39. assertRomanIs(9, 'IX');
  40. });
  41.  
  42. it('adds X for numbers between 19 and 10', () => {
  43. assertRomanIs(10, 'X');
  44. assertRomanIs(11, 'XI');
  45. // ...
  46. });
  47.  
  48. });
  49. });
Add Comment
Please, Sign In to add comment