OSDN Git Service

Initial file
[shogi-server/shogi-server.git] / test / TC_usi.rb
1 $:.unshift File.join(File.dirname(__FILE__), "..")
2
3 require 'test/unit'
4 require 'shogi_server'
5 require 'shogi_server/board'
6 require 'shogi_server/piece_ky'
7 require 'shogi_server/piece'
8
9 class TestUsi < Test::Unit::TestCase
10   def setup
11     @usi = ShogiServer::Usi.new
12   end
13
14   def test_hirate
15     hirate_sfen = "lnsgkgsnl/1r5b1/ppppppppp/9/9/9/PPPPPPPPP/1B5R1/LNSGKGSNL";
16     board = ShogiServer::Board.new
17     assert_equal @usi.parseBoard(hirate_sfen, board), 0
18
19     hirate = ShogiServer::Board.new
20     hirate.initial
21     hirate.teban = nil
22
23     assert_equal hirate.to_s, board.to_s
24   end
25
26   def test_hirate_board
27     board = ShogiServer::Board.new
28     board.initial
29     hirate_sfen = "lnsgkgsnl/1r5b1/ppppppppp/9/9/9/PPPPPPPPP/1B5R1/LNSGKGSNL b -";
30     assert_equal hirate_sfen, @usi.board2usi(board, board.teban)
31   end
32 end
33