Skip to content

Commit

Permalink
Added a test for state-action pairs
Browse files Browse the repository at this point in the history
  • Loading branch information
david-istvan committed Apr 5, 2024
1 parent c1b7fc0 commit d85a547
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/grid_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ def testSequenceNumber(self):
row = cell[0]
col = cell[1]
self.assertEqual(self._grid.get_cell_by_coordinates(row, col).get_sequence_number_in_grid(), row*self._size+col)

def testActionsToMeFromNeighborsCorrespondToTheOppositeDirection(self):
middle_cell = self._grid.get_cell_by_coordinates(random.randint(1, self._size-2), random.randint(1, self._size-2))

self.assertEqual(middle_cell.get_action_to_me_from_neighbor(Direction.UP), Direction.DOWN)
self.assertEqual(middle_cell.get_action_to_me_from_neighbor(Direction.DOWN), Direction.UP)
self.assertEqual(middle_cell.get_action_to_me_from_neighbor(Direction.LEFT), Direction.RIGHT)
self.assertEqual(middle_cell.get_action_to_me_from_neighbor(Direction.RIGHT), Direction.LEFT)


if __name__ == "__main__":
unittest.main()

0 comments on commit d85a547

Please sign in to comment.