Permalink
Browse files

Add test for other win conditions

  • Loading branch information...
edgenard committed Apr 3, 2018
1 parent dc8849e commit 15166c7e7fa9d2a69c54ea6d58b6bfa5e72b7bc9
Showing with 22 additions and 1 deletion.
  1. +22 −1 tic-tac-toe/tic_tac_toe_test.rb
@@ -32,10 +32,31 @@ def test_find_winning_move
assert_equal(5, game.best_move_for('X'))
end

def test_win_conditions
def test_win_horizontal_conditions
game = Game.new("---" +
"XXX" +
"---")
assert_equal('X', game.winner())
end

def test_win_vertical_conditions

This comment has been minimized.

@medwards1771

medwards1771 Apr 3, 2018

Collaborator

Cool. I admire that you had the restraint to add these tests after the previous refactor! One line at a time, as we say.

game = Game.new("--O" +
"--O" +
"--O")
assert_equal('O', game.winner())
end

def test_win_left_diagonal_conditions
game = Game.new("X--" +
"-X-" +
"--X")
assert_equal('X', game.winner())
end

def test_win_right_diagonal_conditions
game = Game.new("--O" +
"-O-" +
"O--")
assert_equal('O', game.winner())
end
end

0 comments on commit 15166c7

Please sign in to comment.