|
| 1 | +import classify from require 'perfect_numbers' |
| 2 | + |
| 3 | +describe 'perfect-numbers', -> |
| 4 | + describe 'Perfect numbers', -> |
| 5 | + it 'Smallest perfect number is classified correctly', -> |
| 6 | + assert.are.equal 'perfect', classify 6 |
| 7 | + |
| 8 | + pending 'Medium perfect number is classified correctly', -> |
| 9 | + assert.are.equal 'perfect', classify 28 |
| 10 | + |
| 11 | + pending 'Large perfect number is classified correctly', -> |
| 12 | + assert.are.equal 'perfect', classify 33550336 |
| 13 | + |
| 14 | + describe 'Abundant numbers', -> |
| 15 | + pending 'Smallest abundant number is classified correctly', -> |
| 16 | + assert.are.equal 'abundant', classify 12 |
| 17 | + |
| 18 | + pending 'Medium abundant number is classified correctly', -> |
| 19 | + assert.are.equal 'abundant', classify 30 |
| 20 | + |
| 21 | + pending 'Large abundant number is classified correctly', -> |
| 22 | + assert.are.equal 'abundant', classify 33550335 |
| 23 | + |
| 24 | + pending 'Perfect square abundant number is classified correctly', -> |
| 25 | + assert.are.equal 'abundant', classify 196 |
| 26 | + |
| 27 | + describe 'Deficient numbers', -> |
| 28 | + pending 'Smallest prime deficient number is classified correctly', -> |
| 29 | + assert.are.equal 'deficient', classify 2 |
| 30 | + |
| 31 | + pending 'Smallest non-prime deficient number is classified correctly', -> |
| 32 | + assert.are.equal 'deficient', classify 4 |
| 33 | + |
| 34 | + pending 'Medium deficient number is classified correctly', -> |
| 35 | + assert.are.equal 'deficient', classify 32 |
| 36 | + |
| 37 | + pending 'Large deficient number is classified correctly', -> |
| 38 | + assert.are.equal 'deficient', classify 33550337 |
| 39 | + |
| 40 | + pending 'Edge case (no factors other than itself) is classified correctly', -> |
| 41 | + assert.are.equal 'deficient', classify 1 |
| 42 | + |
| 43 | + describe 'Invalid inputs', -> |
| 44 | + pending 'Zero is rejected (as it is not a positive integer)', -> |
| 45 | + func = -> classify 0 |
| 46 | + assert.has.error func, 'Classification is only possible for positive integers.' |
| 47 | + |
| 48 | + pending 'Negative integer is rejected (as it is not a positive integer)', -> |
| 49 | + func = -> classify -1 |
| 50 | + assert.has.error func, 'Classification is only possible for positive integers.' |
0 commit comments