Skip to content
This repository has been archived by the owner on Jul 11, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
 into main
  • Loading branch information
Thomas-Hopkins committed May 4, 2022
2 parents 3a1b894 + 99d317f commit 61f6d06
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions source/froggame/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,17 +168,40 @@ def __repr__(self) -> str:
g.move_left()
print(g)
g.set_selected_pad(8)
g.move_left()
print(g.move_left())
print(g)

# Test has won
g = Game(3, want_debug_prints=debug)
print(g)
print(g.has_won())
g.set_selected_pad(0)
g.move_left()
print(g.move_left())
print(g.has_won())
g.set_selected_pad(2)
g.move_left()
print(g)
print(g.has_won())


import unittest


class TestGame(unittest.TestCase):
def test_move_right(self):
g = Game(10)
g.set_selected_pad(6)
r = g.move_right()
self.assertEqual(r, 1)

def test_move_left(self):
g = Game(10)
g.set_selected_pad(6)
r = g.move_left()
self.assertEqual(r, 1)
g.set_selected_pad(5)
self.assertEqual(g.move_left(), 2)


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

0 comments on commit 61f6d06

Please sign in to comment.