forked from alaingilbert/ogame
-
Notifications
You must be signed in to change notification settings - Fork 0
/
facilities_test.go
64 lines (60 loc) · 1.61 KB
/
facilities_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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package ogame
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestFacilities_ByID(t *testing.T) {
f := Facilities{
RoboticsFactory: 1,
Shipyard: 2,
ResearchLab: 3,
AllianceDepot: 4,
MissileSilo: 5,
NaniteFactory: 6,
Terraformer: 7,
SpaceDock: 8,
LunarBase: 9,
SensorPhalanx: 10,
JumpGate: 11,
}
assert.Equal(t, int64(1), f.ByID(RoboticsFactoryID))
assert.Equal(t, int64(2), f.ByID(ShipyardID))
assert.Equal(t, int64(3), f.ByID(ResearchLabID))
assert.Equal(t, int64(4), f.ByID(AllianceDepotID))
assert.Equal(t, int64(5), f.ByID(MissileSiloID))
assert.Equal(t, int64(6), f.ByID(NaniteFactoryID))
assert.Equal(t, int64(7), f.ByID(TerraformerID))
assert.Equal(t, int64(8), f.ByID(SpaceDockID))
assert.Equal(t, int64(9), f.ByID(LunarBaseID))
assert.Equal(t, int64(10), f.ByID(SensorPhalanxID))
assert.Equal(t, int64(11), f.ByID(JumpGateID))
assert.Equal(t, int64(0), f.ByID(ID(12345)))
}
func TestFacilities_String(t *testing.T) {
f := Facilities{
RoboticsFactory: 1,
Shipyard: 2,
ResearchLab: 3,
AllianceDepot: 4,
MissileSilo: 5,
NaniteFactory: 6,
Terraformer: 7,
SpaceDock: 8,
LunarBase: 9,
SensorPhalanx: 10,
JumpGate: 11,
}
expected := "\n" +
"RoboticsFactory: 1\n" +
" Shipyard: 2\n" +
" Research Lab: 3\n" +
" Alliance Depot: 4\n" +
" Missile Silo: 5\n" +
" Nanite Factory: 6\n" +
" Terraformer: 7\n" +
" Space Dock: 8\n" +
" Lunar Base: 9\n" +
" Sensor Phalanx: 10\n" +
" Jump Gate: 11"
assert.Equal(t, expected, f.String())
}