-
Notifications
You must be signed in to change notification settings - Fork 7
/
constants_test.go
65 lines (62 loc) · 1.4 KB
/
constants_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
65
package dragontoothmg
import (
"testing"
)
func TestRookMovesFromBlockers(t *testing.T) {
// Blockers:
// 00010000
// 00000000
// 00010000
// 000R0010
// 00000000
// 00010000
// 00010000
// 00000000
// Bitstring: 0000100000000000000010000100000000000000000010000000100000000000
// Bitstring: 0x800084000080800
// Rook at D5 = 35
// Moves:
// 00000000
// 00000000
// 00010000
// 11101110
// 00010000
// 00010000
// 00000000
// 00000000
// Bitstring: 0000000000000000000010000111011100001000000010000000000000000000
// Bitstring: 0x87708080000
moves := rookMovesFromBlockers(35, 0x800084000080800)
if moves != 0x87708080000 {
t.Error("Failed to generate rook moves from blocker board. Output:", moves)
}
}
func TestBishopMovesFromBlockers(t *testing.T) {
// Blockers:
// 00000000
// 00000010
// 00000100
// 00000000
// 00000000
// 00B00000
// 00010000
// 10000000
// Bitstring: 0000000001000000001000000000000000000000000000000000100000000001
// Bitstring: 0x40200000000801
// Bishop at C3 = 18
// Moves:
// 00000000
// 00000000
// 00000100
// 10001000
// 01010000
// 00000000
// 01010000
// 10000000
// Bitstring: 0000000000000000001000000001000100001010000000000000101000000001
// Bitstring: 0x20110A000A01
moves := bishopMovesFromBlockers(18, 0x40200000000801)
if moves != 0x20110A000A01 {
t.Error("Failed to generate bishop moves from blocker board. Output:", moves)
}
}