diff options
Diffstat (limited to 'logic/score_test.go')
| -rw-r--r-- | logic/score_test.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/logic/score_test.go b/logic/score_test.go index 4fe0000..11a460c 100644 --- a/logic/score_test.go +++ b/logic/score_test.go @@ -111,3 +111,28 @@ func TestInsert(t *testing.T) { t.Errorf("Inserting %v at index 200 should fail", d) } } + +func TestCancel(t *testing.T) { + s := NewScore() + + err := s.Cancel(1) + if err != nil { + t.Errorf("Cancelling Aces should not fail: %v", err) + } + + err = s.Cancel(1) + if err == nil { + t.Errorf("Cancelling Aces twice should fail") + } + + err = s.Cancel(12) + if err != nil { + t.Errorf("Cancelling Yahtzee should not fail: %v", err) + } + + err = s.Cancel(22) + if err == nil { + t.Errorf("Cancelling 22 should fail") + } + +} |
