Browse files

added test for replay bot

  • Loading branch information...
1 parent 41d0cc3 commit fff2f47e81c48b6e03184b02293c262d1d2e4bca Gabriel committed Sep 30, 2011
Showing with 17 additions and 5 deletions.
  1. +2 −2 bot/bots/replay_bot.rb
  2. +1 −3 bot/kaya_bot.rb
  3. +14 −0 bot/tests/kaya_bot_test.rb
View
4 bot/bots/replay_bot.rb
@@ -8,9 +8,9 @@ def initialize
@move_number = 0
end
- def input(move)
+ def input(move="")
@move_number += 1
- return @sgf.split(";")[@move_number]
+ return ";"+@sgf.split(";")[@move_number]
end
def load_sgf(filename)
View
4 bot/kaya_bot.rb
@@ -19,9 +19,7 @@ def initialize(server_url, bot_class)
#connect to server
- #open game(same action as before? )
- #check for challenge every time_lapse seconds
- #accept
+ #open game(unify to previous action?)
#read bot_url every time_lapse seconds
#parse and pass to bot
#read response and post
View
14 bot/tests/kaya_bot_test.rb
@@ -18,3 +18,17 @@
assert @kaya_bot.status == "connected"
assert @kaya_bot.move == ";B[aa]"
end
+
+test "should give me the correct move according to the order" do
+
+ replay_bot = ReplayBot.new
+ replay_bot.sgf = ";B[aa];W[bb];B[cc];W[dd]"
+
+ assert_equal replay_bot.input, ";B[aa]"
+ assert_equal replay_bot.move_number, 1
+ assert_equal replay_bot.input, ";W[bb]"
+ assert_equal replay_bot.move_number, 2
+ assert_equal replay_bot.input, ";B[cc]"
+ assert_equal replay_bot.move_number, 3
+
+end

0 comments on commit fff2f47

Please sign in to comment.