X-Git-Url: http://git.sourceforge.jp/view?p=shogi-server%2Fshogi-server.git;a=blobdiff_plain;f=test%2FTC_command.rb;h=5e231fa39bb56d827d979f4493ecaa83aa270477;hp=012ec821ef64cc6897339b121e247b6fa2bf38d0;hb=aee61c65df8564b76867252f9f299eb205676bfc;hpb=7b9ccc1df11dcc6f9dca7d5b07534d9fcdf305de diff --git a/test/TC_command.rb b/test/TC_command.rb index 012ec82..5e231fa 100644 --- a/test/TC_command.rb +++ b/test/TC_command.rb @@ -2,8 +2,8 @@ $:.unshift File.join(File.dirname(__FILE__), "..") $topdir = File.expand_path File.dirname(__FILE__) require 'test/unit' require 'tempfile' -require 'mock_game' -require 'mock_log_message' +require 'test/mock_game' +require 'test/mock_log_message' require 'test/mock_player' require 'shogi_server/login' require 'shogi_server/player' @@ -842,7 +842,7 @@ class TestSetBuoyCommand < BaseTestBuoyCommand assert @buoy.is_new_game?("buoy_hoge-1500-0") cmd = ShogiServer::SetBuoyCommand.new "%%SETBUOY", @p, "buoy_hoge-1500-0", "+7776FU", 2 rt = cmd.call - assert :continue, rt + assert_equal :continue, rt assert !@buoy.is_new_game?("buoy_hoge-1500-0") assert !$p1.out.empty? assert !$p2.out.empty? @@ -854,7 +854,7 @@ class TestSetBuoyCommand < BaseTestBuoyCommand assert @buoy.is_new_game?("buoy_hoge-1500-0") cmd = ShogiServer::SetBuoyCommand.new "%%SETBUOY", @p, "buoy_hoge-1500-0", "+7776FU", 1 rt = cmd.call - assert :continue, rt + assert_equal :continue, rt assert @buoy.is_new_game?("buoy_hoge-1500-0") assert !$p1.out.empty? assert !$p2.out.empty? @@ -864,7 +864,7 @@ class TestSetBuoyCommand < BaseTestBuoyCommand assert @buoy.is_new_game?("buoy_hoge-1500-0") cmd = ShogiServer::SetBuoyCommand.new "%%SETBUOY", @p, "buoyhoge-1500-0", "+7776FU", 1 rt = cmd.call - assert :continue, rt + assert_equal :continue, rt assert $p1.out.empty? assert $p2.out.empty? assert @buoy.is_new_game?("buoy_hoge-1500-0") @@ -878,7 +878,7 @@ class TestSetBuoyCommand < BaseTestBuoyCommand cmd = ShogiServer::SetBuoyCommand.new "%%SETBUOY", @p, "buoy_duplicated-1500-0", "+7776FU", 1 rt = cmd.call - assert :continue, rt + assert_equal :continue, rt assert $p1.out.empty? assert $p2.out.empty? assert !@buoy.is_new_game?("buoy_duplicated-1500-0") @@ -888,7 +888,7 @@ class TestSetBuoyCommand < BaseTestBuoyCommand assert @buoy.is_new_game?("buoy_badmoves-1500-0") cmd = ShogiServer::SetBuoyCommand.new "%%SETBUOY", @p, "buoy_badmoves-1500-0", "+7776FU+8786FU", 1 rt = cmd.call - assert :continue, rt + assert_equal :continue, rt assert $p1.out.empty? assert $p2.out.empty? assert @buoy.is_new_game?("buoy_badmoves-1500-0") @@ -898,7 +898,7 @@ class TestSetBuoyCommand < BaseTestBuoyCommand assert @buoy.is_new_game?("buoy_badcounter-1500-0") cmd = ShogiServer::SetBuoyCommand.new "%%SETBUOY", @p, "buoy_badcounter-1500-0", "+7776FU", 0 rt = cmd.call - assert :continue, rt + assert_equal :continue, rt assert $p1.out.empty? assert $p2.out.empty? assert @buoy.is_new_game?("buoy_badcounter-1500-0") @@ -916,7 +916,7 @@ class TestDeleteBuoyCommand < BaseTestBuoyCommand assert !@buoy.is_new_game?(buoy_game.game_name) cmd = ShogiServer::DeleteBuoyCommand.new "%%DELETEBUOY", @p, buoy_game.game_name rt = cmd.call - assert :continue, rt + assert_equal :continue, rt assert $p1.out.empty? assert $p2.out.empty? assert @buoy.is_new_game?(buoy_game.game_name) @@ -927,7 +927,7 @@ class TestDeleteBuoyCommand < BaseTestBuoyCommand assert @buoy.is_new_game?(buoy_game.game_name) cmd = ShogiServer::DeleteBuoyCommand.new "%%DELETEBUOY", @p, buoy_game.game_name rt = cmd.call - assert :continue, rt + assert_equal :continue, rt assert $p1.out.empty? assert $p2.out.empty? assert @buoy.is_new_game?(buoy_game.game_name) @@ -941,7 +941,7 @@ class TestDeleteBuoyCommand < BaseTestBuoyCommand cmd = ShogiServer::DeleteBuoyCommand.new "%%DELETEBUOY", @p, buoy_game.game_name rt = cmd.call - assert :continue, rt + assert_equal :continue, rt assert_equal "##[ERROR] you are not allowed to delete a buoy game that you did not set: buoy_anotherplayer-1500-0\n", @p.out.first assert !@buoy.is_new_game?(buoy_game.game_name) end @@ -960,6 +960,13 @@ class TestForkCommand < Test::Unit::TestCase c.decide_new_buoy_game_name assert_equal "buoy_denou_13-14400-60", c.new_buoy_game end + + def test_new_buoy_game_name2 + src = "%%FORK server+denou-14400-060+p1+p2+20130223185013" + c = ShogiServer::ForkCommand.new src, @player, "server+denou-14400-060+p1+p2+20130223185013", nil, 13 + c.decide_new_buoy_game_name + assert_equal "buoy_denou_13-14400-060", c.new_buoy_game + end end # @@ -972,7 +979,7 @@ class TestGetBuoyCountCommand < BaseTestBuoyCommand assert !@buoy.is_new_game?(buoy_game.game_name) cmd = ShogiServer::GetBuoyCountCommand.new "%%GETBUOYCOUNT", @p, buoy_game.game_name rt = cmd.call - assert :continue, rt + assert_equal :continue, rt assert_equal ["##[GETBUOYCOUNT] 1\n", "##[GETBUOYCOUNT] +OK\n"], @p.out end @@ -981,7 +988,7 @@ class TestGetBuoyCountCommand < BaseTestBuoyCommand assert @buoy.is_new_game?(buoy_game.game_name) cmd = ShogiServer::GetBuoyCountCommand.new "%%GETBUOYCOUNT", @p, buoy_game.game_name rt = cmd.call - assert :continue, rt + assert_equal :continue, rt assert_equal ["##[GETBUOYCOUNT] -1\n", "##[GETBUOYCOUNT] +OK\n"], @p.out end end