From bc3f0271e71d29231e0d73748cab826b961ffacc Mon Sep 17 00:00:00 2001 From: Bel LaPointe Date: Mon, 27 Mar 2023 08:26:55 -0600 Subject: [PATCH] test happy 1:1 shuffle --- src/device/input/parse/v01/server_test.go | 27 ++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/device/input/parse/v01/server_test.go b/src/device/input/parse/v01/server_test.go index f8123ae..3561bd6 100644 --- a/src/device/input/parse/v01/server_test.go +++ b/src/device/input/parse/v01/server_test.go @@ -205,7 +205,32 @@ func TestServeGM(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) {