OSDN Git Service

Corrected the expected 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
7 class ShogiServer::BasicPlayer
8   attr_accessor :protocol
9 end
10
11
12 class TestLogin < Test::Unit::TestCase 
13   def setup
14     @p_csa = ShogiServer::BasicPlayer.new
15     @p_csa.name = "hoge"
16     @p_x1 = ShogiServer::BasicPlayer.new
17     @p_x1.name = "hoge"
18     @csa = ShogiServer::LoginCSA.new(@p_csa,"floodgate-900-0,xyz")
19     @x1 = ShogiServer::Loginx1.new(@p_x1, "xyz")
20   end
21
22   def test_player_id
23     assert(@p_x1.player_id == @p_csa.player_id)
24   end
25
26   def test_login_factory_x1
27     player = ShogiServer::BasicPlayer.new
28     player.name = "hoge"
29     login = ShogiServer::Login::factory("LOGIN hoge xyz x1", player)
30     assert_equal(@p_x1.player_id, player.player_id)
31   end
32
33   def test_login_factory_csa
34     player = ShogiServer::BasicPlayer.new
35     player.name = "hoge"
36     login = ShogiServer::Login::factory("LOGIN hoge floodagate-900-0,xyz", player)
37     assert_equal(@p_csa.player_id, player.player_id)
38   end
39
40 end