OSDN Git Service

* The counter of a buoy game is decremented before the game is started.
[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     cmd2 "-0064FU"
9     cmd  "%TORYO"
10     sleep 1
11     result1 = read_nonblock(@socket1)
12     result2 = read_nonblock(@socket2)
13     logout12
14     assert_match(/#ILLEGAL_MOVE.*#WIN/m, result1)
15     assert_match(/#ILLEGAL_MOVE.*#LOSE/m, result2)
16   end
17
18   def est_not_uchifuzume
19     csa = File.open(filepath("not_uchifuzume.csa")) {|f| f.read}
20     handshake(csa)
21     cmd2 "-0092FU"
22     cmd  "%TORYO"
23     sleep 1
24     result1 = read_nonblock(@socket1)
25     result2 = read_nonblock(@socket2)
26     logout12
27     assert_match(/#LOSE/m, result1)
28     assert_match(/#WIN/m, result2)
29   end
30 end # Client class
31