forked from alaingilbert/ogame
-
Notifications
You must be signed in to change notification settings - Fork 0
/
energyTechnology_test.go
44 lines (36 loc) · 1.5 KB
/
energyTechnology_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
34
35
36
37
38
39
40
41
42
43
44
package ogame
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestEnergyTechnologyConstructionTime(t *testing.T) {
mm := newEnergyTechnology()
universeSpeed := int64(7)
researchSpeed := int64(1)
ct := mm.ConstructionTime(5, universeSpeed*researchSpeed, Facilities{ResearchLab: 3}, false, false)
assert.Equal(t, 1645*time.Second, ct)
researchSpeed = 2
ct = mm.ConstructionTime(5, universeSpeed*researchSpeed, Facilities{ResearchLab: 3}, false, false)
assert.Equal(t, 822*time.Second, ct)
universeSpeed = 6
researchSpeed = 1
ct = mm.ConstructionTime(1, universeSpeed*researchSpeed, Facilities{ResearchLab: 0}, false, false)
assert.Equal(t, 8*time.Minute, ct)
researchSpeed = 2
ct = mm.ConstructionTime(1, universeSpeed*researchSpeed, Facilities{ResearchLab: 0}, false, false)
assert.Equal(t, 4*time.Minute, ct)
universeSpeed = 1
researchSpeed = 1
ct = mm.ConstructionTime(1, universeSpeed*researchSpeed, Facilities{ResearchLab: 10}, false, false)
assert.Equal(t, 261*time.Second, ct)
ct = mm.ConstructionTime(1, universeSpeed*researchSpeed, Facilities{ResearchLab: 10}, true, false)
assert.Equal(t, 196*time.Second, ct)
ct = mm.ConstructionTime(1, universeSpeed*researchSpeed, Facilities{ResearchLab: 10}, true, true)
assert.Equal(t, 147*time.Second, ct)
}
func TestEnergyTechnology_GetLevel(t *testing.T) {
et := newEnergyTechnology()
l := et.GetLevel(ResourcesBuildings{}.Lazy(), Facilities{}.Lazy(), Researches{EnergyTechnology: 4}.Lazy())
assert.Equal(t, int64(4), l)
}