Add licence and installation instructions.
[kaya.git] / test / games / shogi / test_shogi_piece.rb
blob9f8b1a76f1def3594dd78b4778755f8e1a7edf47
1 # Copyright (c) 2009 Paolo Capriotti <p.capriotti@gmail.com>
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 require 'test/unit'
9 require 'games/shogi/piece'
11 class TestShogiPiece < Test::Unit::TestCase
12   def test_type_from_symbol
13     assert_equal :lance, Shogi::Piece.type_from_symbol('L')
14     assert_equal :promoted_silver, Shogi::Piece.type_from_symbol('+S')
15     assert_equal :gold, Shogi::Piece.type_from_symbol('G')
16   end
17   
18   def test_symbol
19     assert_equal 'R', Shogi::Piece.symbol(:rook)
20     assert_equal '+B', Shogi::Piece.symbol(:promoted_bishop)
21     assert_equal '+N', Shogi::Piece.symbol(:promoted_horse)
22     assert_equal 'G', Shogi::Piece.symbol(:gold)
23   end
24   
25   def test_equality
26     assert Shogi::Piece.new(:white, :rook).eql?(
27       Shogi::Piece.new(:white, :rook))
28   end
29 end