diff options
| author | Florian Fischer <florian.fl.fischer@fau.de> | 2017-02-18 19:48:20 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fl.fischer@fau.de> | 2017-02-18 19:48:20 +0100 |
| commit | c4f76699aa1459564792395f272052fce6b433bd (patch) | |
| tree | 49f6220ec4d2314b6e5afbce1f84feeb24f7baf4 /logic/dices_test.go | |
| parent | 23ac00e3ae0f2810a4c6fe77744cb7d66cd4b427 (diff) | |
| download | goffel-c4f76699aa1459564792395f272052fce6b433bd.tar.gz goffel-c4f76699aa1459564792395f272052fce6b433bd.zip | |
TIL dice is the plural of die
Diffstat (limited to 'logic/dices_test.go')
| -rw-r--r-- | logic/dices_test.go | 115 |
1 files changed, 0 insertions, 115 deletions
diff --git a/logic/dices_test.go b/logic/dices_test.go deleted file mode 100644 index 2a6c67c..0000000 --- a/logic/dices_test.go +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright (c) 2016 Florian Fischer. All rights reserved. -// Use of this source code is governed by a MIT license found in the LICENSE file. - -package logic - -import "testing" - -func TestSum(t *testing.T) { - d := Dices{1, 1, 1, 2, 6} - if d.Sum(1) != 3 { - t.Errorf("Sum(1) of %v should be 3", d) - } - d = Dices{1, 1, 1, 2, 6} - if d.Sum(2) != 2 { - t.Errorf("Sum(2) of %v should be 2", d) - } - d = Dices{1, 1, 1, 2, 6} - if d.Sum(0) != 11 { - t.Errorf("Sum(0) of %v should be 11", d) - } - d = Dices{1, 1, 1, 2, 6} - if d.Sum(3) != 0 { - t.Errorf("Sum(3) of %v should be 0", d) - } -} - -func TestIsThreeOfAKind(t *testing.T) { - dices := []Dices{Dices{1, 2, 3, 3, 3}, Dices{1, 4, 4, 4, 5}, Dices{2, 2, 2, 3, 6}, Dices{1, 1, 1, 1, 1}} - for _, d := range dices { - if !d.IsThreeOfAKind() { - t.Errorf("%v is three of a kind", d) - } - } - dices = []Dices{Dices{1, 2, 3, 3, 4}, Dices{1, 4, 4, 5, 5}, Dices{1, 2, 2, 3, 6}, Dices{1, 1, 2, 5, 6}} - for _, d := range dices { - if d.IsThreeOfAKind() { - t.Errorf("%v is not three of a kind", d) - } - } -} - -func TestIsFourOfAKind(t *testing.T) { - dices := []Dices{Dices{1, 3, 3, 3, 3}, Dices{1, 4, 4, 4, 4}, Dices{2, 2, 2, 2, 6}, Dices{1, 1, 1, 1, 1}} - for _, d := range dices { - if !d.IsFourOfAKind() { - t.Errorf("%v is four of a kind", d) - } - } - dices = []Dices{Dices{1, 2, 3, 3, 4}, Dices{1, 4, 4, 5, 5}, Dices{1, 2, 2, 3, 6}, Dices{1, 1, 2, 5, 6}} - for _, d := range dices { - if d.IsFourOfAKind() { - t.Errorf("%v is not four of a kind", d) - } - } -} - -func TestIsFullHouse(t *testing.T) { - dices := []Dices{Dices{1, 1, 3, 3, 3}, Dices{1, 1, 4, 4, 4}, Dices{2, 2, 2, 6, 6}} - for _, d := range dices { - if !d.IsFullHouse() { - t.Errorf("%v is a full house", d) - } - } - dices = []Dices{Dices{1, 2, 3, 3, 4}, Dices{1, 4, 4, 5, 5}, Dices{1, 2, 2, 3, 6}, Dices{1, 1, 2, 5, 6}} - for _, d := range dices { - if d.IsFullHouse() { - t.Errorf("%v is not a full house", d) - } - } -} - -func TestIsSmallStraight(t *testing.T) { - dices := []Dices{Dices{1, 2, 3, 4, 6}, Dices{1, 1, 2, 3, 4}, Dices{2, 3, 4, 5, 6}, Dices{1, 2, 3, 3, 4}} - for _, d := range dices { - if !d.IsSmallStraight() { - t.Errorf("%v is a small straight", d) - } - } - dices = []Dices{Dices{1, 2, 3, 3, 5}, Dices{1, 4, 4, 5, 5}, Dices{1, 2, 2, 3, 6}, Dices{1, 1, 2, 5, 6}} - for _, d := range dices { - if d.IsSmallStraight() { - t.Errorf("%v is not a small straight", d) - } - } -} - -func TestIsLargeStraight(t *testing.T) { - dices := []Dices{Dices{1, 2, 3, 4, 5}, Dices{2, 3, 4, 5, 6}} - for _, d := range dices { - if !d.IsLargeStraight() { - t.Errorf("%v is a large straight", d) - } - } - dices = []Dices{Dices{1, 2, 3, 3, 4}, Dices{1, 4, 4, 5, 5}, Dices{1, 2, 2, 3, 6}, Dices{1, 1, 2, 5, 6}} - for _, d := range dices { - if d.IsLargeStraight() { - t.Errorf("%v is not a large straight", d) - } - } -} - -func TestIsYahtzee(t *testing.T) { - dices := []Dices{Dices{3, 3, 3, 3, 3}, Dices{1, 1, 1, 1, 1}} - for _, d := range dices { - if !d.IsYahtzee() { - t.Errorf("%v is a yahtzee", d) - } - } - dices = []Dices{Dices{1, 2, 3, 3, 4}, Dices{1, 4, 4, 5, 5}, Dices{1, 2, 2, 3, 6}, Dices{1, 1, 2, 5, 6}} - for _, d := range dices { - if d.IsYahtzee() { - t.Errorf("%v is not a yahtzee", d) - } - } -} |
