-
Notifications
You must be signed in to change notification settings - Fork 14
/
position_exchange_test.go
29 lines (24 loc) · 1.12 KB
/
position_exchange_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
// Copyright (c) 2014-2018 by Michael Dvorkin. All Rights Reserved.
// Use of this source code is governed by a MIT-style license that can
// be found in the LICENSE file.
//
// I am making my contributions/submissions to this project solely in my
// personal capacity and am not conveying any rights to any intellectual
// property of any third parties.
package donna
import(`github.com/michaeldv/donna/expect`; `testing`)
func TestExchange000(t *testing.T) { // c4,d4 vs. d5,e6 (protected).
p := NewGame(`Kg1,c4,d4`, `Kg8,d5,e6`).start()
exchange := p.exchange(NewMove(p, C4, D5))
expect.Eq(t, exchange, 0)
}
func TestExchange010(t *testing.T) { // c4,d4,e4 vs. c6,d5,e6 (protected).
p := NewGame(`Kg1,Qb3,Nc3,a2,b2,c4,d4,e4,f2,g2,h2`, `Kg8,Qd8,Nf6,a7,b6,c6,d5,e6,f7,g7,h7`).start()
exchange := p.exchange(NewMove(p, E4, D5))
expect.Eq(t, exchange, 0)
}
func TestExchange020(t *testing.T) { // c4,d4,e4 vs. c6,d5,e6 (white wins a pawn).
p := NewGame(`Kg1,Qb3,Nc3,Nf3,a2,b2,c4,d4,e4,f2,g2,h2`, `Kg8,Qd8,Nd7,Nf6,a7,b6,c6,d5,e6,f7,g7,h7`).start()
exchange := p.exchange(NewMove(p, E4, D5))
expect.Eq(t, exchange, valuePawn.midgame)
}