OSDN Git Service

Proposal implementation of a new command called MONITOR2{ON,OFF}.
[shogi-server/shogi-server.git] / test / mock_game.rb
1 class MockGame
2   attr_accessor :finish_flag
3   attr_reader :log
4   attr_accessor :prepared_expire
5   attr_accessor :rejected
6   attr_accessor :is_startable_status
7   attr_accessor :started
8   attr_accessor :game_id
9   attr_accessor :game_name
10
11   def initialize
12     @finish_flag     = false
13     @log             = []
14     @prepared_expire = false
15     @rejected        = false
16     @is_startable_status = false
17     @started             = false
18     @game_id         = "dummy_game_id"
19     @game_name       = "mock_game_name"
20     @monitoron_called = false
21     @monitoroff_called = false
22   end
23
24   def handle_one_move(move, player)
25     return @finish_flag
26   end
27
28   def log_game(str)
29     @log << str
30   end
31
32   def prepared_expire?
33     return @prepared_expire
34   end
35
36   def reject(str)
37     @rejected = true
38   end
39
40   def is_startable_status?
41     return @is_startable_status
42   end
43
44   def start
45     @started = true
46   end
47
48   def show
49     return "dummy_game_show\nline1\nline2\n"
50   end
51
52   def monitoron(player)
53     @monitoron_called = true
54   end
55
56   def monitoroff(player)
57     @monitoroff_called = true
58   end
59 end
60