|
| 1 | +import org.scalatest.funsuite.AnyFunSuite |
| 2 | +import org.scalatest.matchers.should.Matchers |
| 3 | + |
| 4 | +class YachtTests extends AnyFunSuite with Matchers { |
| 5 | + |
| 6 | + test("Yacht") { |
| 7 | + Yacht.score(List(5, 5, 5, 5, 5), "yacht") shouldEqual 50 |
| 8 | + } |
| 9 | + |
| 10 | + test("Not Yacht") { |
| 11 | + pending |
| 12 | + Yacht.score(List(1, 3, 3, 2, 5), "yacht") shouldEqual 0 |
| 13 | + } |
| 14 | + |
| 15 | + test("Ones") { |
| 16 | + pending |
| 17 | + Yacht.score(List(1, 1, 1, 3, 5), "ones") shouldEqual 3 |
| 18 | + } |
| 19 | + |
| 20 | + test("Ones, out of order") { |
| 21 | + pending |
| 22 | + Yacht.score(List(3, 1, 1, 5, 1), "ones") shouldEqual 3 |
| 23 | + } |
| 24 | + |
| 25 | + test("No ones") { |
| 26 | + pending |
| 27 | + Yacht.score(List(4, 3, 6, 5, 5), "ones") shouldEqual 0 |
| 28 | + } |
| 29 | + |
| 30 | + test("Twos") { |
| 31 | + pending |
| 32 | + Yacht.score(List(2, 3, 4, 5, 6), "twos") shouldEqual 2 |
| 33 | + } |
| 34 | + |
| 35 | + test("Fours") { |
| 36 | + pending |
| 37 | + Yacht.score(List(1, 4, 1, 4, 1), "fours") shouldEqual 8 |
| 38 | + } |
| 39 | + |
| 40 | + test("Yacht counted as threes") { |
| 41 | + pending |
| 42 | + Yacht.score(List(3, 3, 3, 3, 3), "threes") shouldEqual 15 |
| 43 | + } |
| 44 | + |
| 45 | + test("Yacht of 3s counted as fives") { |
| 46 | + pending |
| 47 | + Yacht.score(List(3, 3, 3, 3, 3), "fives") shouldEqual 0 |
| 48 | + } |
| 49 | + |
| 50 | + test("Fives") { |
| 51 | + pending |
| 52 | + Yacht.score(List(1, 5, 3, 5, 3), "fives") shouldEqual 10 |
| 53 | + } |
| 54 | + |
| 55 | + test("Sixes") { |
| 56 | + pending |
| 57 | + Yacht.score(List(2, 3, 4, 5, 6), "sixes") shouldEqual 6 |
| 58 | + } |
| 59 | + |
| 60 | + test("Full house two small, three big") { |
| 61 | + pending |
| 62 | + Yacht.score(List(2, 2, 4, 4, 4), "full house") shouldEqual 16 |
| 63 | + } |
| 64 | + |
| 65 | + test("Full house three small, two big") { |
| 66 | + pending |
| 67 | + Yacht.score(List(5, 3, 3, 5, 3), "full house") shouldEqual 19 |
| 68 | + } |
| 69 | + |
| 70 | + test("Two pair is not a full house") { |
| 71 | + pending |
| 72 | + Yacht.score(List(2, 2, 4, 4, 5), "full house") shouldEqual 0 |
| 73 | + } |
| 74 | + |
| 75 | + test("Four of a kind is not a full house") { |
| 76 | + pending |
| 77 | + Yacht.score(List(1, 4, 4, 4, 4), "full house") shouldEqual 0 |
| 78 | + } |
| 79 | + |
| 80 | + test("Yacht is not a full house") { |
| 81 | + pending |
| 82 | + Yacht.score(List(2, 2, 2, 2, 2), "full house") shouldEqual 0 |
| 83 | + } |
| 84 | + |
| 85 | + test("Four of a Kind") { |
| 86 | + pending |
| 87 | + Yacht.score(List(6, 6, 4, 6, 6), "four of a kind") shouldEqual 24 |
| 88 | + } |
| 89 | + |
| 90 | + test("Yacht can be scored as Four of a Kind") { |
| 91 | + pending |
| 92 | + Yacht.score(List(3, 3, 3, 3, 3), "four of a kind") shouldEqual 12 |
| 93 | + } |
| 94 | + |
| 95 | + test("Full house is not Four of a Kind") { |
| 96 | + pending |
| 97 | + Yacht.score(List(3, 3, 3, 5, 5), "four of a kind") shouldEqual 0 |
| 98 | + } |
| 99 | + |
| 100 | + test("Little Straight") { |
| 101 | + pending |
| 102 | + Yacht.score(List(3, 5, 4, 1, 2), "little straight") shouldEqual 30 |
| 103 | + } |
| 104 | + |
| 105 | + test("Little Straight as Big Straight") { |
| 106 | + pending |
| 107 | + Yacht.score(List(1, 2, 3, 4, 5), "big straight") shouldEqual 0 |
| 108 | + } |
| 109 | + |
| 110 | + test("Four in order but not a little straight") { |
| 111 | + pending |
| 112 | + Yacht.score(List(1, 1, 2, 3, 4), "little straight") shouldEqual 0 |
| 113 | + } |
| 114 | + |
| 115 | + test("No pairs but not a little straight") { |
| 116 | + pending |
| 117 | + Yacht.score(List(1, 2, 3, 4, 6), "little straight") shouldEqual 0 |
| 118 | + } |
| 119 | + |
| 120 | + test("Minimum is 1, maximum is 5, but not a little straight") { |
| 121 | + pending |
| 122 | + Yacht.score(List(1, 1, 3, 4, 5), "little straight") shouldEqual 0 |
| 123 | + } |
| 124 | + |
| 125 | + test("Big Straight") { |
| 126 | + pending |
| 127 | + Yacht.score(List(4, 6, 2, 5, 3), "big straight") shouldEqual 30 |
| 128 | + } |
| 129 | + |
| 130 | + test("Big Straight as little straight") { |
| 131 | + pending |
| 132 | + Yacht.score(List(6, 5, 4, 3, 2), "little straight") shouldEqual 0 |
| 133 | + } |
| 134 | + |
| 135 | + test("No pairs but not a big straight") { |
| 136 | + pending |
| 137 | + Yacht.score(List(6, 5, 4, 3, 1), "big straight") shouldEqual 0 |
| 138 | + } |
| 139 | + |
| 140 | + test("Choice") { |
| 141 | + pending |
| 142 | + Yacht.score(List(3, 3, 5, 6, 6), "choice") shouldEqual 23 |
| 143 | + } |
| 144 | + |
| 145 | + test("Yacht as choice") { |
| 146 | + pending |
| 147 | + Yacht.score(List(2, 2, 2, 2, 2), "choice") shouldEqual 10 |
| 148 | + } |
| 149 | +} |
0 commit comments