Skip to content

Commit

Permalink
Add nanobot tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bboonstra committed Sep 29, 2024
1 parent f4a3a53 commit 95686c8
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions tests/test_data.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
import unittest
from idlegame.data import AutosavedPlayer
from idlegame.nanobots import Nanobot, Nanotype

class TestAutosavedPlayer(unittest.TestCase):
class TestNanobots(unittest.TestCase):

def setUp(self):
"""Set up a fresh AutosavedPlayer instance before each test."""
self.player = AutosavedPlayer()
self.nb = Nanobot("testbot", "idle mine", Nanotype.NORMAL)

def test_initial_gold(self):
"""Test that a new player starts with 0 gold."""
self.assertEqual(self.player.gold, 0)
def test_setup(self):
"""Test that a the Nanobot was setup properly."""
self.assertEqual(self.nb.name, "testbot")

def test_add_gold(self):
"""Test adding gold to the player."""
self.player.gold += 50
self.assertEqual(self.player.gold, 50)

# Add more tests here for other functionalities
def test_scripting(self):
"""Test that the scripting was correctly interpreted."""
self.assertEqual(self.nb.idle_action, "mine")

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

0 comments on commit 95686c8

Please sign in to comment.