OSDN Git Service

- shogi_server/command.rb:
authordaigo <beatles@users.sourceforge.jp>
Tue, 13 Apr 2010 13:50:11 +0000 (22:50 +0900)
committerDaigo Moriwaki <daigo at debian dot org>
Tue, 13 Apr 2010 13:50:11 +0000 (22:50 +0900)
  Equality of MonitorHandler class was wrong. %%MONITOROFF and
  %%MONITOR2OFF may cause unexpected behavior. This issue has been
  fixed. Thanks to Kota Fujiwara for reporting.

changelog
shogi_server/command.rb
test/TC_command.rb

index 6129633..c35379e 100644 (file)
--- a/changelog
+++ b/changelog
@@ -1,3 +1,11 @@
+2010-04-13  Daigo Moriwaki <daigo at debian dot org>
+
+       * [shogi-server]
+         - shogi_server/command.rb:
+           Equality of MonitorHandler class was wrong. %%MONITOROFF and
+           %%MONITOR2OFF may cause unexpected behavior. This issue has been
+           fixed. Thanks to Kota Fujiwara for reporting.
+
 2010-03-07  Daigo Moriwaki <daigo at debian dot org>
 
        * [shogi-server]
 2010-03-07  Daigo Moriwaki <daigo at debian dot org>
 
        * [shogi-server]
index 403d5b9..571a18d 100644 (file)
@@ -288,8 +288,8 @@ module ShogiServer
     def ==(rhs)
       return rhs != nil &&
              rhs.is_a?(MonitorHandler) &&
     def ==(rhs)
       return rhs != nil &&
              rhs.is_a?(MonitorHandler) &&
-             @player = rhs.player &&
-             @type   = rhs.type
+             @player == rhs.player &&
+             @type   == rhs.type
     end
 
     def write_safe(game_id, str)
     end
 
     def write_safe(game_id, str)
index 63d88e4..973eea6 100644 (file)
@@ -885,6 +885,26 @@ class TestGetBuoyCountCommand < BaseTestBuoyCommand
   end
 end
 
   end
 end
 
+#
+#
+class TestMonitorHandler < Test::Unit::TestCase
+  def test_not_equal
+    @player1 = MockPlayer.new
+    @handler1 = ShogiServer::MonitorHandler1.new @player1
+    @player2 = MockPlayer.new
+    @handler2 = ShogiServer::MonitorHandler1.new @player2
+
+    assert_not_equal(@handler1, @handler2)
+  end
+
+  def test_equal
+    @player1 = MockPlayer.new
+    @handler1 = ShogiServer::MonitorHandler1.new @player1
+    @handler2 = ShogiServer::MonitorHandler1.new @player1
+
+    assert_equal(@handler1, @handler2)
+  end
+end
 
 #
 #
 
 #
 #