forked from alaingilbert/ogame
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fusionReactor_test.go
33 lines (27 loc) · 1.47 KB
/
fusionReactor_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package ogame
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestFusionReactorCapacity(t *testing.T) {
fr := newFusionReactor()
assert.Equal(t, 38*time.Second, fr.ConstructionTime(2, 7, Facilities{RoboticsFactory: 3}, false, false))
}
func TestFusionReactor_IsAvailable(t *testing.T) {
fr := newFusionReactor()
assert.False(t, fr.IsAvailable(PlanetType, ResourcesBuildings{}.Lazy(), Facilities{}.Lazy(), Researches{}.Lazy(), 0))
assert.False(t, fr.IsAvailable(PlanetType, ResourcesBuildings{DeuteriumSynthesizer: 4}.Lazy(), Facilities{ResearchLab: 1}.Lazy(), Researches{EnergyTechnology: 3}.Lazy(), 0))
assert.False(t, fr.IsAvailable(PlanetType, ResourcesBuildings{DeuteriumSynthesizer: 5}.Lazy(), Facilities{ResearchLab: 1}.Lazy(), Researches{EnergyTechnology: 2}.Lazy(), 0))
assert.True(t, fr.IsAvailable(PlanetType, ResourcesBuildings{DeuteriumSynthesizer: 5}.Lazy(), Facilities{ResearchLab: 1}.Lazy(), Researches{EnergyTechnology: 3}.Lazy(), 0))
assert.True(t, fr.IsAvailable(PlanetType, ResourcesBuildings{DeuteriumSynthesizer: 6}.Lazy(), Facilities{ResearchLab: 1}.Lazy(), Researches{EnergyTechnology: 4}.Lazy(), 0))
}
func TestFusionReactor_Production(t *testing.T) {
fr := newFusionReactor()
assert.Equal(t, int64(3002), fr.Production(12, 13))
}
func TestFusionReactor_GetFuelConsumption(t *testing.T) {
fr := newFusionReactor()
assert.Equal(t, int64(1486), fr.GetFuelConsumption(7, 1.0, 9))
assert.Equal(t, int64(1040), fr.GetFuelConsumption(7, 0.7, 9))
}