DEV-1479 ensure snake elimination turn is set (#93)
* ensure snake elimination turn is set - centralise elimination update logic to a single place to ensure consistency * doc the method * testing
This commit is contained in:
parent
663c377cc4
commit
e1289af5fb
6 changed files with 143 additions and 73 deletions
|
|
@ -881,3 +881,11 @@ func TestPlaceFoodRandomly(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
require.Equal(t, len(b.Food), 0)
|
||||
}
|
||||
|
||||
func TestEliminateSnake(t *testing.T) {
|
||||
s := &Snake{}
|
||||
EliminateSnake(s, "test-cause", "", 2)
|
||||
require.Equal(t, "test-cause", s.EliminatedCause)
|
||||
require.Equal(t, "", s.EliminatedBy)
|
||||
require.Equal(t, 2, s.EliminatedOnTurn)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue