-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdeck_test.go
64 lines (44 loc) · 1.09 KB
/
deck_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 boardgame
import (
"testing"
)
type testShadowValues struct {
c Component
Message string
}
func (t *testShadowValues) ContainingComponent() Component {
return t.c
}
func (t *testShadowValues) SetContainingComponent(c Component) {
t.c = c
}
func (t *testShadowValues) Reader() PropertyReader {
return getDefaultReader(t)
}
func TestDeckShadowComponent(t *testing.T) {
manager := newTestGameManger(t)
deck := manager.Chest().Deck("test")
if deck == nil {
t.Fatal("Couldn't find test deck")
}
c := deck.ComponentAt(emptyIndexSentinel)
if c != nil {
t.Error("ComponentAt didn't give nil for empty index sentitel", c)
}
c = deck.ComponentAt(-2)
if c == nil {
t.Error("Negative value gave nil")
}
c = deck.ComponentAt(0)
if c != deck.Components()[0] {
t.Error("Deck.componenAt didn't return correct component for normal component")
}
c = deck.GenericComponent()
if c == nil {
t.Error("Generic Component returned nil")
}
altC := deck.GenericComponent()
if c != altC {
t.Error("Repated calls to generic component didn't return the same thign.")
}
}