OSDN Git Service

Added some test cases.
authordaigo <beatles@users.sourceforge.jp>
Sun, 5 Sep 2010 13:27:55 +0000 (22:27 +0900)
committerDaigo Moriwaki <daigo@debian.org>
Sun, 5 Sep 2010 13:27:55 +0000 (22:27 +0900)
test/TC_login.rb

index 4742753..e79bf37 100644 (file)
@@ -28,6 +28,8 @@ class TestLogin < Test::Unit::TestCase
     player = ShogiServer::BasicPlayer.new
     player.name = "hoge"
     login = ShogiServer::Login::factory("LOGIN hoge xyz x1", player)
     player = ShogiServer::BasicPlayer.new
     player.name = "hoge"
     login = ShogiServer::Login::factory("LOGIN hoge xyz x1", player)
+    assert_instance_of(ShogiServer::Loginx1, login)
+    assert_equal("xyz", player.password)
     assert_equal(@p_x1.player_id, player.player_id)
   end
 
     assert_equal(@p_x1.player_id, player.player_id)
   end
 
@@ -35,7 +37,18 @@ class TestLogin < Test::Unit::TestCase
     player = ShogiServer::BasicPlayer.new
     player.name = "hoge"
     login = ShogiServer::Login::factory("LOGIN hoge floodagate-900-0,xyz", player)
     player = ShogiServer::BasicPlayer.new
     player.name = "hoge"
     login = ShogiServer::Login::factory("LOGIN hoge floodagate-900-0,xyz", player)
+    assert_instance_of(ShogiServer::LoginCSA, login)
+    assert_equal("xyz", player.password)
     assert_equal(@p_csa.player_id, player.player_id)
   end
     assert_equal(@p_csa.player_id, player.player_id)
   end
+
+  def test_login_factory_csa_without_trip
+    player = ShogiServer::BasicPlayer.new
+    player.name = "hoge"
+    login = ShogiServer::Login::factory("LOGIN hoge floodagate-900-0", player)
+    assert_instance_of(ShogiServer::LoginCSA, login)
+    assert_nil(player.password)
+    assert_equal(nil, player.player_id)
+  end
 end
 
 end