samba/server/truco/poker/alloc_test.go
2025-06-04 09:51:39 +08:00

66 lines
1.5 KiB
Go

package poker
import (
"testing"
)
func TestAllocator_Alloc(t *testing.T) {
t.Run("M 净", func(t *testing.T) {
m := NewMineiroCleanPokers()
m.Shuffle()
aoc := Allocator{}
aoc.Init(m, m.Pokers())
acts := []AllocAct{AllocGood, AllocGood, AllocBad, AllocBad}
t.Logf("max point %s", m.MaxPoint())
for i := 0; i < 4; i++ {
res, _ := aoc.Alloc(acts[i], 3)
t.Log(res[0].ToString(), res[1].ToString(), res[2].ToString())
}
})
t.Run("M 脏", func(t *testing.T) {
m := NewMineiroDirtyPokers()
m.Shuffle()
aoc := Allocator{}
aoc.Init(m, m.Pokers())
acts := []AllocAct{AllocGood, AllocGood, AllocBad, AllocBad}
t.Logf("max point %s", m.MaxPoint())
for i := 0; i < 4; i++ {
res, _ := aoc.Alloc(acts[i], 3)
t.Log(res[0].ToString(), res[1].ToString(), res[2].ToString())
}
})
t.Run("P 净", func(t *testing.T) {
m := NewPaulistaCleanPokers()
m.Shuffle()
aoc := Allocator{}
aoc.Init(m, m.Pokers())
acts := []AllocAct{AllocGood, AllocGood, AllocBad, AllocBad}
t.Logf("max point %s", m.MaxPoint())
for i := 0; i < 4; i++ {
res, _ := aoc.Alloc(acts[i], 3)
t.Log(res[0].ToString(), res[1].ToString(), res[2].ToString())
}
})
t.Run("P 脏", func(t *testing.T) {
m := NewPaulistaDirtyPokers()
m.Shuffle()
aoc := Allocator{}
aoc.Init(m, m.Pokers())
acts := []AllocAct{AllocGood, AllocGood, AllocBad, AllocBad}
t.Logf("max point %s", m.MaxPoint())
for i := 0; i < 4; i++ {
res, _ := aoc.Alloc(acts[i], 3)
t.Log(res[0].ToString(), res[1].ToString(), res[2].ToString())
}
})
}