OSDN Git Service

- shogi_server/command.rb: Commands specific to 81Dojo, startig with '%%%', are just...
[shogi-server/shogi-server.git] / test / TC_player.rb
1 $:.unshift File.join(File.dirname(__FILE__), "..")
2 require 'test/unit'
3 require 'shogi_server'
4 require 'shogi_server/player'
5
6 class TestPlayer < Test::Unit::TestCase
7   def setup
8     @p = ShogiServer::BasicPlayer.new
9   end
10
11   def test_without_password
12     @p.name = "hoge"
13     @p.set_password(nil)
14     assert_nil(@p.player_id)
15   end
16   
17   def test_set_password
18     @p.name = "hoge"
19     @p.set_password("abc")
20     assert(@p.player_id)
21   end
22
23   def test_name_atmark
24     @p.name = "hoge@p1"
25     @p.set_password("abc")
26     assert_match(/@/, @p.player_id)
27   end
28
29   def test_rating_group
30     assert_nothing_raised {@p.rating_group = 1}
31   end
32
33   def test_human1
34     @p.name = "hoge_human"
35     assert(@p.is_human?)
36     assert(!@p.is_computer?)
37   end
38
39   def test_human2
40     @p.name = "hoge_human@p1"
41     assert(@p.is_human?)
42     assert(!@p.is_computer?)
43   end
44 end
45