blob: 7e2fefa934b9a2e92ca2d09d2aae78abb44547e3 (
plain)
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
|
package game
import (
"errors"
"reflect"
"testing"
)
func TestLoadingAllCards(t *testing.T) {
v := reflect.ValueOf(Sets)
for i := range v.NumField() {
set := v.Field(i).Interface().(SetIdentifier)
NewDeckFromCardPaths(set.CardPaths()).Cards()
}
}
func TestLoadingUnknownCard(t *testing.T) {
_, err := NewCardSafe("foo/bar")
if !errors.Is(err, ErrUnknownCardPath) {
t.Fatal("expected urlErr:", err)
}
}
func TestCardReporters(t *testing.T) {
archer := NewCard("base/archer")
recruit := NewCard("base/recruit")
ritual := NewCard("magic/ritual!")
sword := NewCard("base/sword")
palisade := NewCard("base/palisade")
if !archer.IsBuyable() || !ritual.IsBuyable() || !recruit.IsBuyable() || !sword.IsBuyable() || !palisade.IsBuyable() {
t.Fatal("unexpected buyability result")
}
if !archer.IsPermanent() || ritual.IsPermanent() || !recruit.IsPermanent() || !sword.IsPermanent() || !palisade.IsPermanent() {
t.Fatal("unexpected permanent result")
}
if archer.Type.IsArtifact() || !sword.Type.IsArtifact() {
t.Fatal("unexpected IsArtifact result")
}
if archer.IsToken() || !recruit.IsToken() {
t.Fatal("unexpected IsToken result")
}
if archer.hasEffect("crew") {
t.Fatal("archer has no crew effect")
}
if archer.hasPlacementConstrain("swimmming") {
t.Fatal("archer is not swimming")
}
x, err := palisade.getXEffect("solid")
if err != nil {
t.Fatal("xEffect error returned")
}
if x.x != 6 || !x.set {
t.Fatal("invalid palisade solid effect")
}
}
|