Skip to content

Commit

Permalink
added test for invalid direction change
Browse files Browse the repository at this point in the history
  • Loading branch information
mapra99 committed Nov 5, 2019
1 parent e323d84 commit 60fafa2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/actions_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,17 @@ def test_move_snake
actual_state = Actions::move_snake(@initial_state)
assert_equal actual_state, expected_state
end

def test_invalid_change_direction
expected_state = Model::State.new(
Model::Snake.new([Model::Coord.new(1, 1),
Model::Coord.new(0, 1)]),
Model::Food.new(4, 4),
Model::Grid.new(8, 12),
Model::Direction::DOWN,
false
)
actual_state = Actions::change_direction(@initial_state, Model::Direction::UP)
assert_equal actual_state, expected_state
end
end

0 comments on commit 60fafa2

Please sign in to comment.