test happy 1:1 shuffle

master
Bel LaPointe 2023-03-27 08:26:55 -06:00
parent e2d7c4a908
commit bc3f0271e7
1 changed files with 26 additions and 1 deletions

View File

@ -205,7 +205,32 @@ func TestServeGM(t *testing.T) {
}) })
t.Run("shuffle", func(t *testing.T) { t.Run("shuffle", func(t *testing.T) {
t.Error("not impl") t.Run("2u 2p", func(t *testing.T) {
v01 := NewV01(ctx, nil)
for i := 0; i < 100; i++ {
v01.cfg.Quiet = true
v01.cfg.Users = map[string]configUser{
"bel": configUser{Player: 1},
"zach": configUser{Player: 2},
}
v01.cfg.Players = []configPlayer{{}, {}}
do(v01, "/gm/rpc/shuffle", "")
if v01.cfg.Quiet {
t.Error(v01.cfg.Quiet)
}
if len(v01.cfg.Users) != 3 {
t.Error(v01.cfg.Users)
} else if len(v01.cfg.Players) != 2 {
t.Error(v01.cfg.Users)
} else if bp := v01.cfg.Users["bel"].Player; bp != 1 && bp != 2 {
t.Error(bp)
} else if zp := v01.cfg.Users["zach"].Player; zp != 1 && zp != 2 {
t.Error(zp)
} else if bp == zp {
t.Error(bp, zp)
}
}
})
}) })
t.Run("swap", func(t *testing.T) { t.Run("swap", func(t *testing.T) {