Skip to content

Commit

Permalink
start of inline tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason committed Mar 2, 2024
1 parent 05accc1 commit 4241102
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/actions/fine_move_action.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import re
import unittest
from unittest.mock import MagicMock

class FineMoveAction:
#for fine move, i need to know who is near me, perception needs to be updated to provide that info or passed into here
@classmethod
Expand Down Expand Up @@ -50,3 +53,22 @@ def act(cls,agent, pre_processed_direction):
new_x, new_y = current_x, current_y
agent.x = new_x
agent.y = new_y

class TestFineMoveAction(unittest.TestCase):
def setUp(self):
self.agent = MagicMock()
self.agent.x = 0
self.agent.y = 0

def test_act_up(self):
FineMoveAction.act(self.agent, "up with random text")
self.assertEqual(self.agent.x, 0)
self.assertEqual(self.agent.y, -1)

def test_act_invalid_direction(self):
FineMoveAction.act(self.agent, "invalid-direction")
self.assertEqual(self.agent.x, 0)
self.assertEqual(self.agent.y, 0)

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

0 comments on commit 4241102

Please sign in to comment.