X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=test%2FTC_pairing.rb;fp=test%2FTC_pairing.rb;h=94274fafd55b8ee246cbff5d6a7e564698b6f282;hb=99086c8a519ee1080be05c6122fbef94fe36afc9;hp=30f353eb0612aed85812cf312b12e191ffe38f12;hpb=cf2de9ee2d6df9b55f12973146399e4079a589ae;p=shogi-server%2Fshogi-server.git diff --git a/test/TC_pairing.rb b/test/TC_pairing.rb index 30f353e..94274fa 100644 --- a/test/TC_pairing.rb +++ b/test/TC_pairing.rb @@ -411,6 +411,19 @@ class TestLeastDiff < Test::Unit::TestCase @x.player_id = "x" @x.name = "x" + @abcdefg1 = ShogiServer::BasicPlayer.new + @abcdefg1.player_id = "abcdefg1" + @abcdefg1.name = "abcdefg1" + @abcdefg1.rate = 2100 + @abcdefg2 = ShogiServer::BasicPlayer.new + @abcdefg2.player_id = "abcdefg2" + @abcdefg2.name = "abcdefg2" + @abcdefg2.rate = 2200 + @abcdxyz = ShogiServer::BasicPlayer.new + @abcdxyz.player_id = "abcdxyz" + @abcdxyz.name = "abcdxyz" + @abcdxyz.rate = 2300 + $league.add(@a) $league.add(@b) $league.add(@c) @@ -420,6 +433,9 @@ class TestLeastDiff < Test::Unit::TestCase $league.add(@g) $league.add(@h) $league.add(@x) + $league.add(@abcdefg1) + $league.add(@abcdefg2) + $league.add(@abcdxyz) end def teardown @@ -548,6 +564,16 @@ class TestLeastDiff < Test::Unit::TestCase assert_equal(@b.rate-@a.rate+400+@h.rate-@g.rate+400, @pairing.calculate_diff_with_penalty(players, @history)) end + def test_calculate_diff_with_kin_4_players + players = [@abcdefg1, @abcdxyz] + assert_equal(@abcdxyz.rate - @abcdefg1.rate + 400, @pairing.calculate_diff_with_penalty(players,nil)) + end + + def test_calculate_diff_with_kin_7_players + players = [@abcdefg1, @abcdefg2] + assert_equal(@abcdefg2.rate - @abcdefg1.rate + 800, @pairing.calculate_diff_with_penalty(players,nil)) + end + def test_get_player_rate_0 assert_equal(2150, @pairing.get_player_rate(@x, @history))