|
| 1 | +Say = require './say' |
| 2 | + |
| 3 | +describe 'say', -> |
| 4 | + it 'zero', -> |
| 5 | + result = Say.in_english 0 |
| 6 | + expected = 'zero' |
| 7 | + assert.are.equal expected, result |
| 8 | + |
| 9 | + pending 'one', -> |
| 10 | + result = Say.in_english 1 |
| 11 | + expected = 'one' |
| 12 | + assert.are.equal expected, result |
| 13 | + |
| 14 | + pending 'fourteen', -> |
| 15 | + result = Say.in_english 14 |
| 16 | + expected = 'fourteen' |
| 17 | + assert.are.equal expected, result |
| 18 | + |
| 19 | + pending 'twenty', -> |
| 20 | + result = Say.in_english 20 |
| 21 | + expected = 'twenty' |
| 22 | + assert.are.equal expected, result |
| 23 | + |
| 24 | + pending 'twenty-two', -> |
| 25 | + result = Say.in_english 22 |
| 26 | + expected = 'twenty-two' |
| 27 | + assert.are.equal expected, result |
| 28 | + |
| 29 | + pending 'thirty', -> |
| 30 | + result = Say.in_english 30 |
| 31 | + expected = 'thirty' |
| 32 | + assert.are.equal expected, result |
| 33 | + |
| 34 | + pending 'ninety-nine', -> |
| 35 | + result = Say.in_english 99 |
| 36 | + expected = 'ninety-nine' |
| 37 | + assert.are.equal expected, result |
| 38 | + |
| 39 | + pending 'one hundred', -> |
| 40 | + result = Say.in_english 100 |
| 41 | + expected = 'one hundred' |
| 42 | + assert.are.equal expected, result |
| 43 | + |
| 44 | + pending 'one hundred twenty-three', -> |
| 45 | + result = Say.in_english 123 |
| 46 | + expected = 'one hundred twenty-three' |
| 47 | + assert.are.equal expected, result |
| 48 | + |
| 49 | + pending 'two hundred', -> |
| 50 | + result = Say.in_english 200 |
| 51 | + expected = 'two hundred' |
| 52 | + assert.are.equal expected, result |
| 53 | + |
| 54 | + pending 'nine hundred ninety-nine', -> |
| 55 | + result = Say.in_english 999 |
| 56 | + expected = 'nine hundred ninety-nine' |
| 57 | + assert.are.equal expected, result |
| 58 | + |
| 59 | + pending 'one thousand', -> |
| 60 | + result = Say.in_english 1000 |
| 61 | + expected = 'one thousand' |
| 62 | + assert.are.equal expected, result |
| 63 | + |
| 64 | + pending 'one thousand two hundred thirty-four', -> |
| 65 | + result = Say.in_english 1234 |
| 66 | + expected = 'one thousand two hundred thirty-four' |
| 67 | + assert.are.equal expected, result |
| 68 | + |
| 69 | + pending 'one million', -> |
| 70 | + result = Say.in_english 1000000 |
| 71 | + expected = 'one million' |
| 72 | + assert.are.equal expected, result |
| 73 | + |
| 74 | + pending 'one million two thousand three hundred forty-five', -> |
| 75 | + result = Say.in_english 1002345 |
| 76 | + expected = 'one million two thousand three hundred forty-five' |
| 77 | + assert.are.equal expected, result |
| 78 | + |
| 79 | + pending 'one billion', -> |
| 80 | + result = Say.in_english 1000000000 |
| 81 | + expected = 'one billion' |
| 82 | + assert.are.equal expected, result |
| 83 | + |
| 84 | + pending 'a big number', -> |
| 85 | + result = Say.in_english 987654321123 |
| 86 | + expected = 'nine hundred eighty-seven billion six hundred fifty-four million three hundred twenty-one thousand one hundred twenty-three' |
| 87 | + assert.are.equal expected, result |
| 88 | + |
| 89 | + pending 'numbers below zero are out of range', -> |
| 90 | + f = -> Say.in_english -1 |
| 91 | + assert.has.error f,'input out of range' |
| 92 | + |
| 93 | + pending 'numbers above 999,999,999,999 are out of range', -> |
| 94 | + f = -> Say.in_english 1000000000000 |
| 95 | + assert.has.error f,'input out of range' |
0 commit comments