-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbitboard_test.go
More file actions
68 lines (64 loc) · 2.14 KB
/
Copy pathbitboard_test.go
File metadata and controls
68 lines (64 loc) · 2.14 KB
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
65
66
67
68
package chester_test
import (
"testing"
"github.com/bluescreen10/chester"
)
func TestBitboardString(t *testing.T) {
tests := []struct {
name string
bb chester.Bitboard
expected string
}{
{
name: "Empty bitboard",
bb: 0,
expected: "+---+---+---+---+---+---+---+---+\n" +
"| | | | | | | | | 8 \n" +
"+---+---+---+---+---+---+---+---+\n" +
"| | | | | | | | | 7 \n" +
"+---+---+---+---+---+---+---+---+\n" +
"| | | | | | | | | 6 \n" +
"+---+---+---+---+---+---+---+---+\n" +
"| | | | | | | | | 5 \n" +
"+---+---+---+---+---+---+---+---+\n" +
"| | | | | | | | | 4 \n" +
"+---+---+---+---+---+---+---+---+\n" +
"| | | | | | | | | 3 \n" +
"+---+---+---+---+---+---+---+---+\n" +
"| | | | | | | | | 2 \n" +
"+---+---+---+---+---+---+---+---+\n" +
"| | | | | | | | | 1 \n" +
"+---+---+---+---+---+---+---+---+\n" +
" a b c d e f g h\n",
},
{
name: "Single bit at a1",
bb: chester.BB_SQ_A1,
expected: "+---+---+---+---+---+---+---+---+\n" +
"| | | | | | | | | 8 \n" +
"+---+---+---+---+---+---+---+---+\n" +
"| | | | | | | | | 7 \n" +
"+---+---+---+---+---+---+---+---+\n" +
"| | | | | | | | | 6 \n" +
"+---+---+---+---+---+---+---+---+\n" +
"| | | | | | | | | 5 \n" +
"+---+---+---+---+---+---+---+---+\n" +
"| | | | | | | | | 4 \n" +
"+---+---+---+---+---+---+---+---+\n" +
"| | | | | | | | | 3 \n" +
"+---+---+---+---+---+---+---+---+\n" +
"| | | | | | | | | 2 \n" +
"+---+---+---+---+---+---+---+---+\n" +
"| X | | | | | | | | 1 \n" +
"+---+---+---+---+---+---+---+---+\n" +
" a b c d e f g h\n",
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
if got := test.bb.String(); got != test.expected {
t.Errorf("Bitboard.String() failed\ngot:\n%s\nwant:\n%s", got, test.expected)
}
})
}
}