Skip to content
This repository has been archived by the owner on Apr 24, 2019. It is now read-only.

Commit

Permalink
Add test for other win conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
egenard committed Apr 3, 2018
1 parent dc8849e commit 15166c7
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion tic-tac-toe/tic_tac_toe_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Copy link
@medwards1771

medwards1771 Apr 3, 2018

Contributor

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.