OSDN Git Service

Moved TestPairing class to test/TC_pairing.rb.
authorbeatles <beatles@b8c68f68-1e22-0410-b08e-880e1f8202b4>
Sat, 26 Dec 2009 01:40:17 +0000 (01:40 +0000)
committerbeatles <beatles@b8c68f68-1e22-0410-b08e-880e1f8202b4>
Sat, 26 Dec 2009 01:40:17 +0000 (01:40 +0000)
Refactoring.

test/TC_floodgate.rb
test/TC_pairing.rb

index c019a68..8831e54 100644 (file)
@@ -43,47 +43,6 @@ class TestFloodgate < Test::Unit::TestCase
 
 end
 
-class TestPairing < Test::Unit::TestCase  
-  def setup
-    @pairing= ShogiServer::Pairing.new
-    $pairs = []
-    def @pairing.start_game(p1,p2)
-      $pairs << [p1,p2]
-    end
-    @a = ShogiServer::BasicPlayer.new
-    @a.name = "a"
-    @a.win  = 1
-    @a.loss = 2
-    @a.rate = 0
-    @a.last_game_win = false
-    @b = ShogiServer::BasicPlayer.new
-    @b.name = "b"
-    @b.win  = 10
-    @b.loss = 20
-    @b.rate = 1500
-    @b.last_game_win = true
-    @c = ShogiServer::BasicPlayer.new
-    @c.name = "c"
-    @c.win  = 100
-    @c.loss = 200
-    @c.rate = 1000
-    @c.last_game_win = true
-    @d = ShogiServer::BasicPlayer.new
-    @d.name = "d"
-    @d.win  = 1000
-    @d.loss = 2000
-    @d.rate = 1800
-    @d.last_game_win = true
-  end
-
-  def test_include_newbie
-    assert(@pairing.include_newbie?([@a]))
-    assert(!@pairing.include_newbie?([@b]))
-    assert(@pairing.include_newbie?([@b,@a]))
-    assert(!@pairing.include_newbie?([@b,@c]))
-  end
-end
-
 class TestDeleteMostPlayingPlayer < Test::Unit::TestCase
   def setup
     @pairing= ShogiServer::DeleteMostPlayingPlayer.new
index 77f0522..0f8e7c4 100644 (file)
@@ -33,6 +33,47 @@ def same_pair?(a, b)
   return true if [a.first, a.last] == b || [a.last, a.first] == b
 end
 
+class TestPairing < Test::Unit::TestCase  
+  def setup
+    @pairing= ShogiServer::Pairing.new
+    $pairs = []
+    def @pairing.start_game(p1,p2)
+      $pairs << [p1,p2]
+    end
+    @a = ShogiServer::BasicPlayer.new
+    @a.name = "a"
+    @a.win  = 1
+    @a.loss = 2
+    @a.rate = 0
+    @a.last_game_win = false
+    @b = ShogiServer::BasicPlayer.new
+    @b.name = "b"
+    @b.win  = 10
+    @b.loss = 20
+    @b.rate = 1500
+    @b.last_game_win = true
+    @c = ShogiServer::BasicPlayer.new
+    @c.name = "c"
+    @c.win  = 100
+    @c.loss = 200
+    @c.rate = 1000
+    @c.last_game_win = true
+    @d = ShogiServer::BasicPlayer.new
+    @d.name = "d"
+    @d.win  = 1000
+    @d.loss = 2000
+    @d.rate = 1800
+    @d.last_game_win = true
+  end
+
+  def test_include_newbie
+    assert(@pairing.include_newbie?([@a]))
+    assert(!@pairing.include_newbie?([@b]))
+    assert(@pairing.include_newbie?([@b,@a]))
+    assert(!@pairing.include_newbie?([@b,@c]))
+  end
+end
+
 class TestStartGame < Test::Unit::TestCase
   def setup
     @pairing= ShogiServer::StartGame.new