feat: produce on planets, unload on routes

This commit is contained in:
Ilia Denisov
2026-01-21 23:01:33 +02:00
parent 7e73601bce
commit 9825e05c0e
10 changed files with 319 additions and 60 deletions
+42
View File
@@ -13,3 +13,45 @@ func TestPlanetProduction(t *testing.T) {
assert.Equal(t, 750., game.PlanetProduction(1000., 0.))
assert.Equal(t, 250., game.PlanetProduction(0., 1000.))
}
func TestIncreaseIndustry(t *testing.T) {
HW := &game.Planet{
PlanetReport: game.PlanetReport{
UninhabitedPlanet: game.UninhabitedPlanet{
Size: 1000,
Resources: 10,
},
Population: 1000,
Industry: 1000,
},
}
DW := &game.Planet{
PlanetReport: game.PlanetReport{
UninhabitedPlanet: game.UninhabitedPlanet{
Size: 500,
Resources: 10,
},
Population: 500,
Industry: 500,
},
}
HW.IncreaseIndustry()
assert.InDelta(t, 196.078, HW.Capital, 0.0005)
HW.Capital = 0
HW.Material = 200
HW.IncreaseIndustry()
assert.Equal(t, 200., HW.Capital)
assert.Equal(t, 0., HW.Material)
DW.IncreaseIndustry()
assert.InDelta(t, 98.039, DW.Capital, 0.0003)
DW.Capital = 0
DW.Material = 100
DW.IncreaseIndustry()
assert.Equal(t, 100., DW.Capital)
assert.Equal(t, 0., DW.Material)
}