func TestSendMessageForGameBadRunnerState(t *testing.T) {
	tests := []struct {
		playerSockets map[player.Name]map[message.Addr]chan<- message.Message
		playerGames   map[player.Name]map[game.ID]message.Addr
	}{
		{
			playerGames: map[player.Name]map[game.ID]message.Addr{
				"fred": {
					1: "addr1",
				},
			},
		},
		{
			playerSockets: map[player.Name]map[message.Addr]chan<- message.Message{
				"fred": {},
			},
			playerGames: map[player.Name]map[game.ID]message.Addr{
				"fred": {
					1: "addr1",
				},
			},
		},
	}
	for i, test := range tests {
		log := new(logtest.Logger)
		r := Runner{
			log:           log,
			playerSockets: test.playerSockets,
			playerGames:   test.playerGames,
		}
		ctx := context.Background()
		m := message.Message{
			Game: &game.Info{
				ID: 1,
			},
			PlayerName: "fred",
		}
		r.sendMessageForGame(ctx, m)
		if log.Empty() {
			t.Errorf("Test %v: wanted error logged for bad runner state", i)
		}
	}
}
// TestSendMessageForGameBadRunnerState adds coverage for some scenarios where playerGames do do not have matching playerSocket entries
TestSendMessageForGameBadRunnerState adds coverage for some scenarios where playerGames do do not have matching playerSocket entries
// TestSendMessageForGameBadRunnerState adds coverage for some scenarios where playerGames do do not have matching playerSocket entries
func TestSendMessageForGameBadRunnerState(t *testing.T) {
	tests := []struct {
		playerSockets map[player.Name]map[message.Addr]chan<- message.Message
		playerGames   map[player.Name]map[game.ID]message.Addr
	}{
		{
			playerGames: map[player.Name]map[game.ID]message.Addr{
				"fred": {
					1: "addr1",
				},
			},
		},
		{
			playerSockets: map[player.Name]map[message.Addr]chan<- message.Message{
				"fred": {},
			},
			playerGames: map[player.Name]map[game.ID]message.Addr{
				"fred": {
					1: "addr1",
				},
			},
		},
	}
	for i, test := range tests {
		log := new(logtest.Logger)
		r := Runner{
			log:           log,
			playerSockets: test.playerSockets,
			playerGames:   test.playerGames,
		}
		ctx := context.Background()
		m := message.Message{
			Game: &game.Info{
				ID: 1,
			},
			PlayerName: "fred",
		}
		r.sendMessageForGame(ctx, m)
		if log.Empty() {
			t.Errorf("Test %v: wanted error logged for bad runner state", i)
		}
	}
}
func TestSendMessageForGameBadRunnerState ( t * testing . T ) { tests := [ ] struct { playerSockets map [ player . Name ] map [ message . Addr ] chan <- message . Message playerGames map [ player . Name ] map [ game . ID ] message . Addr } { { playerGames : map [ player . Name ] map [ game . ID ] message . Addr { " " : { 1 : " " , } , } , } , { playerSockets : map [ player . Name ] map [ message . Addr ] chan <- message . Message { " " : { } , } , playerGames : map [ player . Name ] map [ game . ID ] message . Addr { " " : { 1 : " " , } , } , } , } for i , test := range tests { log := new ( logtest . Logger ) r := Runner { log : log , playerSockets : test . playerSockets , playerGames : test . playerGames , } ctx := context . Background ( ) m := message . Message { Game : & game . Info { ID : 1 , } , PlayerName : " " , } r . sendMessageForGame ( ctx , m ) if log . Empty ( ) { t . Errorf ( " " , i ) } } }
TestSendMessageForGameBadRunnerState adds coverage for some scenarios where playerGames do do not have matching playerSocket entries
TestSendMessageForGameBadRunnerState adds coverage for some scenarios where playerGames do do not have matching playerSocket entries