X-Git-Url: http://git.sourceforge.jp/view?p=shogi-server%2Fshogi-server.git;a=blobdiff_plain;f=test%2FTC_board.rb;h=b9d54fc2f703ee53b8f38cf141f758de3e33696f;hp=6008af5c05b31dadf25b6dfb4ad62cc554c08005;hb=051a0e7af2694d0dd143541db454b763c1f17482;hpb=22ae63faf229ff217a9569e87665526520498ada diff --git a/test/TC_board.rb b/test/TC_board.rb index 6008af5..b9d54fc 100644 --- a/test/TC_board.rb +++ b/test/TC_board.rb @@ -208,6 +208,255 @@ EOM end +class TestMoveBack < Test::Unit::TestCase + def validate_before_after(board, move) + orig = board.to_s + orig_teban = board.teban + orig_move_count = board.move_count + + assert_equal true, board.move_to(move) + assert_equal !orig_teban, board.teban + assert_equal (orig_move_count+1), board.move_count + + assert_equal true, board.move_back(move) + assert_equal orig_teban, board.teban + assert_equal orig_move_count, board.move_count + assert_equal orig, board.to_s + end + + def test_normal + b = ShogiServer::Board.new + b.set_from_str(<