-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexaustive_strategy_test.go
47 lines (38 loc) · 1.03 KB
/
exaustive_strategy_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
package main
import (
"testing"
)
func TestNoDisard(t *testing.T) {
testStrategyInstance := exaustiveStrat{}
noDiscardPs := PlayerState{
hand: []string{"a", "a", "a", "a", "a", "a", "a"},
graveyard: []string{},
}
result := testStrategyInstance.DiscardPhase(&noDiscardPs)
if len(result) != 1 {
t.Log("Mutation of state occured at discard step with hand less than 7.")
t.Fail()
}
if len(result[0].hand) != 7 || len(result[0].graveyard) != 0 {
t.Log("Card were moved around unecessarily")
t.Fail()
}
}
func TestDisard(t *testing.T) {
testStrategyInstance := exaustiveStrat{}
noDiscardPs := PlayerState{
hand: []string{"a", "a", "a", "a", "a", "a", "b", "c", "d"},
graveyard: []string{},
}
result := testStrategyInstance.DiscardPhase(&noDiscardPs)
// combinations:
// aa, ab, ac, ad, bc, bd, cd,
if len(result) != 7 {
t.Log("Wrong number of discard combinations")
t.Fail()
}
if len(result[0].hand) != 7 || len(result[0].graveyard) != 2 {
t.Log("Wrong number of cards discarded / kept")
t.Fail()
}
}