-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathvisitor_test.go
More file actions
47 lines (30 loc) · 856 Bytes
/
Copy pathvisitor_test.go
File metadata and controls
47 lines (30 loc) · 856 Bytes
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
package visitor
import "testing"
func TestSingleVisitor(t *testing.T) {
//汽油提供给,制衣工厂
g := gas{density: 100}
//柴油,提供给军工厂
d := diesel{energy: 897}
//购买石油的客户
m := &militaryFactory{}
c := &clothFactory{}
g.Accept(c)
d.Accept(m)
}
func TestGameVisitorsList(t *testing.T) {
retriveSetting := SettingVisitor{}
attacker := Attacker{}
pA := Player{"snow dance", 100} //角色名名:snow dance 100级
pB := Player{"fire dragon", 120}
npc := NPC{"groceries", true} //卖杂货的NPC,是能被打死的
env := SystemEnv{"made by china", "v1.2.11"}
//游戏对象
gameObjects := []IGameObject{pA, npc, env, pB}
for _, v := range gameObjects {
v.Accept(retriveSetting)
}
t.Log("\n---- !!!attack!!!- --")
for _, v := range gameObjects {
v.Accept(attacker)
}
}