OSDN Git Service

* [shogi-server]
[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'
7
8 class TestUsi < Test::Unit::TestCase
9   def setup
10     @usi = ShogiServer::Usi.new
11   end
12
13   def test_hirate
14     hirate_sfen = "lnsgkgsnl/1r5b1/ppppppppp/9/9/9/PPPPPPPPP/1B5R1/LNSGKGSNL";
15     board = ShogiServer::Board.new
16     assert_equal @usi.parseBoard(hirate_sfen, board), 0
17
18     hirate = ShogiServer::Board.new
19     hirate.initial
20     hirate.teban = nil
21
22     assert_equal hirate.to_s, board.to_s
23   end
24
25   def test_hirate_board
26     board = ShogiServer::Board.new
27     board.initial
28     hirate_sfen = "lnsgkgsnl/1r5b1/ppppppppp/9/9/9/PPPPPPPPP/1B5R1/LNSGKGSNL b -";
29     assert_equal hirate_sfen, @usi.board2usi(board, board.teban)
30   end
31 end
32