OSDN Git Service

* The counter of a buoy game is decremented before the game is started.
[shogi-server/shogi-server.git] / test / TC_buoy.rb
index 6311ff4..1c15ca0 100644 (file)
@@ -70,85 +70,3 @@ class TestBuoy < Test::Unit::TestCase
   end
 end
 
   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