|
| 1 | +Yacht = require 'yacht' |
| 2 | + |
| 3 | +describe 'yacht', -> |
| 4 | + it 'Yacht', -> |
| 5 | + result = Yacht.score 'yacht', {5, 5, 5, 5, 5} |
| 6 | + assert.is.equal 50, result |
| 7 | + |
| 8 | + pending 'Not Yacht', -> |
| 9 | + result = Yacht.score 'yacht', {1, 3, 3, 2, 5} |
| 10 | + assert.is.equal 0, result |
| 11 | + |
| 12 | + pending 'Ones', -> |
| 13 | + result = Yacht.score 'ones', {1, 1, 1, 3, 5} |
| 14 | + assert.is.equal 3, result |
| 15 | + |
| 16 | + pending 'Ones, out of order', -> |
| 17 | + result = Yacht.score 'ones', {3, 1, 1, 5, 1} |
| 18 | + assert.is.equal 3, result |
| 19 | + |
| 20 | + pending 'No ones', -> |
| 21 | + result = Yacht.score 'ones', {4, 3, 6, 5, 5} |
| 22 | + assert.is.equal 0, result |
| 23 | + |
| 24 | + pending 'Twos', -> |
| 25 | + result = Yacht.score 'twos', {2, 3, 4, 5, 6} |
| 26 | + assert.is.equal 2, result |
| 27 | + |
| 28 | + pending 'Fours', -> |
| 29 | + result = Yacht.score 'fours', {1, 4, 1, 4, 1} |
| 30 | + assert.is.equal 8, result |
| 31 | + |
| 32 | + pending 'Yacht counted as threes', -> |
| 33 | + result = Yacht.score 'threes', {3, 3, 3, 3, 3} |
| 34 | + assert.is.equal 15, result |
| 35 | + |
| 36 | + pending 'Yacht of 3s counted as fives', -> |
| 37 | + result = Yacht.score 'fives', {3, 3, 3, 3, 3} |
| 38 | + assert.is.equal 0, result |
| 39 | + |
| 40 | + pending 'Fives', -> |
| 41 | + result = Yacht.score 'fives', {1, 5, 3, 5, 3} |
| 42 | + assert.is.equal 10, result |
| 43 | + |
| 44 | + pending 'Sixes', -> |
| 45 | + result = Yacht.score 'sixes', {2, 3, 4, 5, 6} |
| 46 | + assert.is.equal 6, result |
| 47 | + |
| 48 | + pending 'Full house two small, three big', -> |
| 49 | + result = Yacht.score 'full house', {2, 2, 4, 4, 4} |
| 50 | + assert.is.equal 16, result |
| 51 | + |
| 52 | + pending 'Full house three small, two big', -> |
| 53 | + result = Yacht.score 'full house', {5, 3, 3, 5, 3} |
| 54 | + assert.is.equal 19, result |
| 55 | + |
| 56 | + pending 'Two pair is not a full house', -> |
| 57 | + result = Yacht.score 'full house', {2, 2, 4, 4, 5} |
| 58 | + assert.is.equal 0, result |
| 59 | + |
| 60 | + pending 'Four of a kind is not a full house', -> |
| 61 | + result = Yacht.score 'full house', {1, 4, 4, 4, 4} |
| 62 | + assert.is.equal 0, result |
| 63 | + |
| 64 | + pending 'Yacht is not a full house', -> |
| 65 | + result = Yacht.score 'full house', {2, 2, 2, 2, 2} |
| 66 | + assert.is.equal 0, result |
| 67 | + |
| 68 | + pending 'Four of a Kind', -> |
| 69 | + result = Yacht.score 'four of a kind', {6, 6, 4, 6, 6} |
| 70 | + assert.is.equal 24, result |
| 71 | + |
| 72 | + pending 'Yacht can be scored as Four of a Kind', -> |
| 73 | + result = Yacht.score 'four of a kind', {3, 3, 3, 3, 3} |
| 74 | + assert.is.equal 12, result |
| 75 | + |
| 76 | + pending 'Full house is not Four of a Kind', -> |
| 77 | + result = Yacht.score 'four of a kind', {3, 3, 3, 5, 5} |
| 78 | + assert.is.equal 0, result |
| 79 | + |
| 80 | + pending 'Little Straight', -> |
| 81 | + result = Yacht.score 'little straight', {3, 5, 4, 1, 2} |
| 82 | + assert.is.equal 30, result |
| 83 | + |
| 84 | + pending 'Little Straight as Big Straight', -> |
| 85 | + result = Yacht.score 'big straight', {1, 2, 3, 4, 5} |
| 86 | + assert.is.equal 0, result |
| 87 | + |
| 88 | + pending 'Four in order but not a little straight', -> |
| 89 | + result = Yacht.score 'little straight', {1, 1, 2, 3, 4} |
| 90 | + assert.is.equal 0, result |
| 91 | + |
| 92 | + pending 'No pairs but not a little straight', -> |
| 93 | + result = Yacht.score 'little straight', {1, 2, 3, 4, 6} |
| 94 | + assert.is.equal 0, result |
| 95 | + |
| 96 | + pending 'Minimum is 1, maximum is 5, but not a little straight', -> |
| 97 | + result = Yacht.score 'little straight', {1, 1, 3, 4, 5} |
| 98 | + assert.is.equal 0, result |
| 99 | + |
| 100 | + pending 'Big Straight', -> |
| 101 | + result = Yacht.score 'big straight', {4, 6, 2, 5, 3} |
| 102 | + assert.is.equal 30, result |
| 103 | + |
| 104 | + pending 'Big Straight as little straight', -> |
| 105 | + result = Yacht.score 'little straight', {6, 5, 4, 3, 2} |
| 106 | + assert.is.equal 0, result |
| 107 | + |
| 108 | + pending 'No pairs but not a big straight', -> |
| 109 | + result = Yacht.score 'big straight', {6, 5, 4, 3, 1} |
| 110 | + assert.is.equal 0, result |
| 111 | + |
| 112 | + pending 'Choice', -> |
| 113 | + result = Yacht.score 'choice', {3, 3, 5, 6, 6} |
| 114 | + assert.is.equal 23, result |
| 115 | + |
| 116 | + pending 'Yacht as choice', -> |
| 117 | + result = Yacht.score 'choice', {2, 2, 2, 2, 2} |
| 118 | + assert.is.equal 10, result |
0 commit comments