OSDN Git Service

shogi_server/{game,time_clock}.rb: Adds variations of thinking time calculation:...
[shogi-server/shogi-server.git] / test / TC_uchifuzume.rb
1 require "baseclient"
2 include Socket::Constants
3
4 class UchifuzumeTest < ReadFileClient
5   def test_uchifuzume
6     csa = File.open(filepath("uchifuzume.csa")) {|f| f.read}
7     handshake(csa)
8     @p2.puts "-0064FU"
9     @p1.puts "%TORYO"
10     wait_finish
11     assert_match(/#ILLEGAL_MOVE.*#WIN/m, @p1.message)
12     assert_match(/#ILLEGAL_MOVE.*#LOSE/m, @p2.message)
13     logout12
14   end
15
16   def test_not_uchifuzume
17     csa = File.open(filepath("not_uchifuzume.csa")) {|f| f.read}
18     handshake(csa)
19     @p2.puts "-0092FU"
20     @p1.puts "%TORYO"
21     wait_finish
22     assert_no_match(/#ILLEGAL_MOVE/, @p1.message)
23     assert_no_match(/#ILLEGAL_MOVE/, @p2.message)
24     logout12
25   end
26 end # Client class
27