OSDN Git Service

Improved stability of test results.
[shogi-server/shogi-server.git] / test / TC_login.rb
1 $:.unshift File.join(File.dirname(__FILE__), "..")
2 require 'test/unit'
3 require 'shogi_server'
4 require 'shogi_server/player'
5 require 'shogi_server/login'
6 require 'shogi_server/handicapped_boards'
7
8 class ShogiServer::BasicPlayer
9   attr_accessor :protocol
10 end
11
12
13 class TestLogin < Test::Unit::TestCase 
14   def setup
15     @p_csa = ShogiServer::BasicPlayer.new
16     @p_csa.name = "hoge"
17     @p_x1 = ShogiServer::BasicPlayer.new
18     @p_x1.name = "hoge"
19     @csa = ShogiServer::LoginCSA.new(@p_csa,"floodgate-900-0,xyz")
20     @x1 = ShogiServer::Loginx1.new(@p_x1, "xyz")
21   end
22
23   def test_player_id
24     assert(@p_x1.player_id == @p_csa.player_id)
25   end
26
27   def test_login_factory_x1
28     player = ShogiServer::BasicPlayer.new
29     player.name = "hoge"
30     login = ShogiServer::Login::factory("LOGIN hoge xyz x1", player)
31     assert_equal(@p_x1.player_id, player.player_id)
32   end
33
34   def test_login_factory_csa
35     player = ShogiServer::BasicPlayer.new
36     player.name = "hoge"
37     login = ShogiServer::Login::factory("LOGIN hoge floodagate-900-0,xyz", player)
38     assert_equal(@p_csa.player_id, player.player_id)
39   end
40 end
41