Files
galaxy-game/internal/model/game/planet_test.go
T
2026-01-04 19:22:06 +02:00

23 lines
750 B
Go

package game_test
import (
"testing"
"github.com/iliadenisov/galaxy/internal/model/game"
"github.com/stretchr/testify/assert"
)
func TestPlanetProduction(t *testing.T) {
assert.Equal(t, 1000., game.PlanetProduction(1000., 1000.))
assert.Equal(t, 750., game.PlanetProduction(1000., 0.))
assert.Equal(t, 250., game.PlanetProduction(0., 1000.))
}
func TestPlanetProductionCapacity(t *testing.T) {
g := newGame()
assert.NoError(t, g.CreateShips(Race_0_idx, ShipType_Cruiser, R0_Planet_0_num, 1))
assert.Equal(t, 100., game.PlanetProductionCapacity(g, R0_Planet_0_num))
g.ShipGroups[0] = game.UpgradeGroupPreference(g.ShipGroups[0], Cruiser, game.TechDrive, 1.6)
assert.Equal(t, 53.125, game.PlanetProductionCapacity(g, R0_Planet_0_num))
}