예제 #1
0
파일: game.go 프로젝트: netracker/netracker
func New() *Game {
	return &Game{
		ActivePlayer:   player.NewCorp(),
		InactivePlayer: player.NewRunner(),
		CorpCredits:    5,
		RunnerCredits:  5,
		Clicks:         0,
	}
}
예제 #2
0
func TestToJson(t *testing.T) {
	game := &Game{
		ActivePlayer:   player.NewCorp(),
		InactivePlayer: player.NewRunner(),
		CorpCredits:    5,
		RunnerCredits:  5,
		Clicks:         0,
	}

	expectedJson := "{\"ActivePlayer\":{\"Role\":\"corp\"},\"InactivePlayer\":{\"Role\":\"runner\"},\"CorpCredits\":5,\"RunnerCredits\":5,\"Clicks\":0}"
	assert.Equal(t, game.ToJson(), expectedJson)
}