draft/pod_test.go

34 lines
825 B
Go

package draft_test
import (
"log"
"testing"
"git.fromouter.space/mcg/draft"
)
// Tests that a pod can be created and seeded correctly
func TestCreatePod(t *testing.T) {
const PacksPerPlayer = 3
const PlayersPerPod = 5
// Get provider for test set
testProvider := draft.PacksFromSet(PacksPerPlayer, testSet)
// Create pod
pod := draft.MakePod(PlayersPerPod, testProvider)
if len(pod.Players) != PlayersPerPod {
log.Fatalf("Expected %d players in pod but got %d\n", PlayersPerPod, len(pod.Players))
}
for i, player := range pod.Players {
t.Logf("Player #%d:", i)
for packi, pack := range player.Packs {
t.Logf(" - Pack #%d: %s", packi, pack)
}
if len(player.Packs) != PacksPerPlayer {
log.Fatalf("Player #%d has %d packs but should have %d\n", i, PacksPerPlayer, len(player.Packs))
}
}
}