OSDN Git Service

Fixed assertions.
authorDaigo Moriwaki <beatles@users.sourceforge.jp>
Sun, 4 Dec 2011 05:57:14 +0000 (14:57 +0900)
committerDaigo Moriwaki <daigo@debian.org>
Sun, 4 Dec 2011 05:57:14 +0000 (14:57 +0900)
Fixed 'require' path for Ruby 1.9.3.
Added rate property for MoclPlayer.

test/TC_command.rb
test/mock_player.rb

index f23062b..18f971b 100644 (file)
@@ -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'
@@ -832,7 +832,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?
@@ -844,7 +844,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?
@@ -854,7 +854,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")
@@ -868,7 +868,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")
@@ -878,7 +878,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")
@@ -888,7 +888,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")
@@ -906,7 +906,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)
@@ -917,7 +917,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)
@@ -931,7 +931,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
@@ -947,7 +947,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
 
@@ -956,7 +956,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
index 55319fd..fa20abf 100644 (file)
@@ -6,6 +6,7 @@ class MockPlayer < ShogiServer::BasicPlayer
   attr_accessor :game, :status, :protocol
   attr_accessor :game_name
   attr_reader :socket_buffer
+  attr_reader :rate
 
   def initialize
     @name     = "mock_player"
@@ -15,6 +16,7 @@ class MockPlayer < ShogiServer::BasicPlayer
     @protocol = nil
     @game_name = "dummy_game_name"
     @socket_buffer = []
+    @rate = 1500
   end
 
   def write_safe(str)