refactor: planet owner

This commit is contained in:
Ilia Denisov
2026-02-04 19:26:17 +02:00
parent 6a603ea9ad
commit c1d397c993
17 changed files with 170 additions and 183 deletions
+24 -48
View File
@@ -16,24 +16,16 @@ func TestPlanetProduction(t *testing.T) {
func TestProduceIndustry(t *testing.T) {
HW := &game.Planet{
PlanetReport: game.PlanetReport{
UninhabitedPlanet: game.UninhabitedPlanet{
Size: 1000,
Resources: 10,
},
Population: 1000,
Industry: 1000,
},
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,
},
Size: 500,
Resources: 10,
Population: 500,
Industry: 500,
}
HW.ProduceIndustry()
assert.InDelta(t, 196.078, HW.Capital.F(), 0.0005)
@@ -58,14 +50,10 @@ func TestProduceIndustry(t *testing.T) {
func TestProduceMaterial(t *testing.T) {
HW := &game.Planet{
PlanetReport: game.PlanetReport{
UninhabitedPlanet: game.UninhabitedPlanet{
Size: 1000,
Resources: 10,
},
Population: 1000,
Industry: 1000,
},
Size: 1000,
Resources: 10,
Population: 1000,
Industry: 1000,
}
assert.Equal(t, 0., HW.Material.F())
@@ -84,14 +72,10 @@ func TestProduceMaterial(t *testing.T) {
func TestUnpackCapital(t *testing.T) {
HW := &game.Planet{
PlanetReport: game.PlanetReport{
UninhabitedPlanet: game.UninhabitedPlanet{
Size: 1000,
Resources: 10,
},
Population: 1000,
Industry: 1000,
},
Size: 1000,
Resources: 10,
Population: 1000,
Industry: 1000,
}
assert.Equal(t, 0., HW.Capital.F())
@@ -119,14 +103,10 @@ func TestUnpackCapital(t *testing.T) {
func TestUnpackColonists(t *testing.T) {
HW := &game.Planet{
PlanetReport: game.PlanetReport{
UninhabitedPlanet: game.UninhabitedPlanet{
Size: 1000,
Resources: 10,
},
Population: 1000,
Industry: 1000,
},
Size: 1000,
Resources: 10,
Population: 1000,
Industry: 1000,
}
assert.Equal(t, 0., HW.Colonists.F())
@@ -152,14 +132,10 @@ func TestUnpackColonists(t *testing.T) {
func TestProducePopulation(t *testing.T) {
HW := &game.Planet{
PlanetReport: game.PlanetReport{
UninhabitedPlanet: game.UninhabitedPlanet{
Size: 1000,
Resources: 10,
},
Population: 500,
Industry: 1000,
},
Size: 1000,
Resources: 10,
Population: 500,
Industry: 1000,
}
assert.Equal(t, 500., HW.Population.F())
assert.Equal(t, 0., HW.Colonists.F())