codies/internal/game/layouts_test.go

26 lines
471 B
Go
Raw Normal View History

2020-05-23 21:51:11 +00:00
package game
import (
"sort"
"testing"
"gotest.tools/v3/assert"
)
func TestLayouts(t *testing.T) {
for key, layout := range layouts {
assert.Equal(t, len(layout.teams), key.numTeams)
sum := layout.bomb + layout.neutral
for _, x := range layout.teams {
sum += x
}
assert.Equal(t, sum, key.boardSize)
assert.Assert(t, sort.SliceIsSorted(layout.teams, func(i, j int) bool {
2020-08-03 04:08:33 +00:00
return layout.teams[i] >= layout.teams[j] //nolint:scopelint
2020-05-23 21:51:11 +00:00
}))
}
}