Add shogi serializer.
[kaya.git] / test / games / shogi / test_shogi_notation.rb
blob85717aa3a69b27c4e424acc8079c7b8c6afe8dc9
1 require 'test/unit'
2 require 'games/all'
4 class TestShogiNotation < Test::Unit::TestCase
5   def setup
6     @game = Game.get(:shogi)
7     @notation = @game.notation
8   end
10   def test_point_to_coord
11     assert_equal '6b', 
12       @notation.point_to_coord(Point.new(3, 1))
13     assert_equal '5e',
14       @notation.point_to_coord(Point.new(4, 4))
15   end
16   
17   def test_point_from_coord
18     assert_equal Point.new(3, 1),
19       @notation.point_from_coord('6b')
20     assert_equal Point.new(4, 4),
21       @notation.point_from_coord('5e')
22   end
23   
24   def test_notation1
25     notation = @notation.from_s('+L-4e')
26     assert_equal :promoted_lance, notation[:type]
27     assert_nil notation[:src]
28     assert ! notation[:drop]
29     assert_equal Point.new(5, 4), notation[:dst]
30   end
31 end