chess 0.3.0 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +12 -0
- data/.github/workflows/ruby.yml +58 -0
- data/.gitignore +3 -2
- data/.rubocop.yml +10 -142
- data/Gemfile.lock +74 -0
- data/README.md +26 -22
- data/Rakefile +2 -1
- data/chess.gemspec +11 -7
- data/docs/Chess/BadNotationError.html +237 -0
- data/docs/Chess/Board.html +1759 -0
- data/docs/Chess/CGame.html +2296 -0
- data/docs/Chess/Game.html +1277 -0
- data/docs/Chess/Gnuchess.html +366 -0
- data/docs/Chess/IllegalMoveError.html +137 -0
- data/docs/Chess/InvalidFenFormatError.html +237 -0
- data/docs/Chess/InvalidPgnFormatError.html +217 -0
- data/docs/Chess/Pgn.html +1477 -0
- data/docs/Chess/UTF8Notation.html +270 -0
- data/docs/Chess.html +157 -0
- data/docs/_index.html +217 -0
- data/docs/class_list.html +51 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +497 -0
- data/docs/file.README.html +116 -0
- data/docs/file_list.html +56 -0
- data/docs/frames.html +17 -0
- data/docs/index.html +116 -0
- data/docs/js/app.js +314 -0
- data/docs/js/full_list.js +216 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +531 -0
- data/docs/top-level-namespace.html +110 -0
- data/ext/chess.c +1 -1
- data/ext/common.h +7 -3
- data/ext/extconf.rb +1 -1
- data/lib/chess/game.rb +68 -66
- data/lib/chess/gnuchess.rb +49 -53
- data/lib/chess/pgn.rb +13 -15
- data/lib/chess/version.rb +1 -1
- data/test/test_big_pgn_collection.rb +1 -1
- data/test/test_checkmate.rb +4 -4
- data/test/test_errors.rb +22 -0
- data/test/test_fifty_rule_move.rb +2 -2
- data/test/test_game.rb +82 -0
- data/test/test_helper.rb +15 -0
- data/test/test_insufficient_material.rb +4 -4
- data/test/test_move_generator.rb +3 -2
- data/test/test_pgn.rb +35 -0
- data/test/test_pgn_collection.rb +2 -2
- data/test/test_stalemate.rb +1 -1
- data/test/test_threefold_repetition.rb +1 -1
- data/test/test_uci_castling.rb +34 -0
- metadata +118 -1236
data/test/test_stalemate.rb
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class UCICastrlingTest < Minitest::Test
|
4
|
+
def test_uci_white_short_castling
|
5
|
+
game = Chess::Game.new
|
6
|
+
game.moves = %w[e4 c5 c3 d5 exd5 Qxd5 d4 Nf6 Nf3 e6 Be2 Be7 e1h1 Nc6]
|
7
|
+
assert_equal '*', game.result
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_uci_white_long_castling
|
11
|
+
game = Chess::Game.new
|
12
|
+
game.moves = %w[e4 c5 Nf3 Nc6 d4 cxd4 Nxd4 Nf6 Nc3 d6 Bg5 Qb6 Nb3 e6 Qd2 Be7 e1a1]
|
13
|
+
assert_equal '*', game.result
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_uci_black_short_castling
|
17
|
+
game = Chess::Game.new
|
18
|
+
game.moves = %w[d4 d5 c4 dxc4 e4 e5 Nf3 Bb4+ Nc3 exd4 Nxd4 Ne7 Bf4 Bxc3+ bxc3 Ng6 Bg3 Qe7 Bxc4 Qxe4+ Qe2 Qxe2+ Bxe2 Na6 Rb1 e8h8]
|
19
|
+
assert_equal '*', game.result
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_uci_black_long_castling
|
23
|
+
game = Chess::Game.new
|
24
|
+
game.moves = %w[e4 c5 Nf3 d6 d4 cxd4 Qxd4 Nc6 Bb5 Bd7 Bxc6 Bxc6 Bg5 Nf6 Bxf6 gxf6 Nc3 e6 e1c1 Be7 Rhe1 Rg8 Qe3 Rxg2 Rg1 Rg6 Nd4 Qb6 h4 e8a8]
|
25
|
+
assert_equal '*', game.result
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_uci_invalid_white_long_castling
|
29
|
+
game = Chess::Game.new
|
30
|
+
assert_raises(Chess::IllegalMoveError) do
|
31
|
+
game.moves = %w[e4 c5 Nf3 Nc6 d4 cxd4 Nxd4 Nf6 Nc3 d6 Bg5 Qb6 Nb3 e6 Qd2 Be7 e8a8]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|