OSDN Git Service

[shogi-server] A player, attempting to login with the current live player
[shogi-server/shogi-server.git] / test / TC_uchifuzume.rb
1 $:.unshift File.join(File.dirname(__FILE__), "..")
2 $topdir = File.expand_path File.dirname(__FILE__)
3 require "test/baseclient"
4 include Socket::Constants
5
6 class UchifuzumeTest < ReadFileClient
7   def test_uchifuzume
8     csa = File.open(filepath("uchifuzume.csa"), "r+:shift_jis"){|f| f.read}
9     handshake(csa)
10     @p2.puts "-0064FU"
11     @p1.puts "%TORYO"
12     wait_finish
13     assert_match(/#ILLEGAL_MOVE.*#WIN/m, @p1.message)
14     assert_match(/#ILLEGAL_MOVE.*#LOSE/m, @p2.message)
15     logout12
16   end
17
18   def test_not_uchifuzume
19     csa = File.open(filepath("not_uchifuzume.csa"), "r+:shift_jis"){|f| f.read}
20     handshake(csa)
21     @p2.puts "-0092FU"
22     @p1.puts "%TORYO"
23     wait_finish
24     assert_no_match(/#ILLEGAL_MOVE/, @p1.message)
25     assert_no_match(/#ILLEGAL_MOVE/, @p2.message)
26     logout12
27   end
28 end # Client class
29