OSDN Git Service

[shogi-server] Enhance capability of Floodgate configuration file
[shogi-server/shogi-server.git] / test / TC_buoy.rb
index 6311ff4..03a18d2 100644 (file)
@@ -2,9 +2,9 @@ $:.unshift File.join(File.dirname(__FILE__), "..")
 $topdir = File.expand_path File.dirname(__FILE__)
 require 'test/unit'
 require 'shogi_server/buoy'
-require 'mock_game'
-require 'mock_player'
-require 'mock_log_message'
+require 'test/mock_game'
+require 'test/mock_player'
+require 'test/mock_log_message'
 
 
 class TestBuoyGame < Test::Unit::TestCase
@@ -70,85 +70,3 @@ class TestBuoy < Test::Unit::TestCase
   end
 end
 
-
-class TestBuoyObserver < Test::Unit::TestCase
-  def setup
-    @dir = File.dirname(__FILE__)
-    @filename = File.join(@dir, "buoy.yaml")
-    @conf = {:topdir => @dir}
-    @buoy = ShogiServer::Buoy.new @conf
-  end
-  
-  def teardown
-    if File.exist? @filename
-      File.delete @filename
-    end
-  end
-
-  def test_update_game_result_win
-    p1 = MockPlayer.new
-    p1.sente = true
-    p2 = MockPlayer.new
-    p2.sente = false
-
-    buoy_game = ShogiServer::BuoyGame.new("buoy_1234-900-0", [], "p1", 2)
-    assert @buoy.is_new_game?(buoy_game.game_name)
-    @buoy.add_game buoy_game
-    assert !@buoy.is_new_game?(buoy_game.game_name)
-
-    game = MockGame.new
-    game.game_name = buoy_game.game_name
-    gr = ShogiServer::GameResultWin.new game, p1, p2
-    
-    observer = ShogiServer::BuoyObserver.new
-    observer.update(gr)
-
-    assert !@buoy.is_new_game?(buoy_game.game_name)
-    buoy_game2 = @buoy.get_game(buoy_game.game_name)
-    assert_equal 1, buoy_game2.count
-  end
-
-  def test_update_game_result_win_zero
-    p1 = MockPlayer.new
-    p1.sente = true
-    p2 = MockPlayer.new
-    p2.sente = false
-
-    buoy_game = ShogiServer::BuoyGame.new("buoy_1234-900-0", [], "p1", 1)
-    assert @buoy.is_new_game?(buoy_game.game_name)
-    @buoy.add_game buoy_game
-    assert !@buoy.is_new_game?(buoy_game.game_name)
-
-    game = MockGame.new
-    game.game_name = buoy_game.game_name
-    gr = ShogiServer::GameResultWin.new game, p1, p2
-    
-    observer = ShogiServer::BuoyObserver.new
-    observer.update(gr)
-
-    assert @buoy.is_new_game?(buoy_game.game_name)
-  end
-
-  def test_update_game_result_draw
-    p1 = MockPlayer.new
-    p1.sente = true
-    p2 = MockPlayer.new
-    p2.sente = false
-
-    buoy_game = ShogiServer::BuoyGame.new("buoy_1234-900-0", [], "p1", 2)
-    assert @buoy.is_new_game?(buoy_game.game_name)
-    @buoy.add_game buoy_game
-    assert !@buoy.is_new_game?(buoy_game.game_name)
-
-    game = MockGame.new
-    game.game_name = buoy_game.game_name
-    gr = ShogiServer::GameResultDraw.new game, p1, p2
-    
-    observer = ShogiServer::BuoyObserver.new
-    observer.update(gr)
-
-    assert !@buoy.is_new_game?(buoy_game.game_name)
-    buoy_game2 = @buoy.get_game(buoy_game.game_name)
-    assert_equal 2, buoy_game2.count
-  end
-end