Fix bug in housing check and add test
This commit is contained in:
@@ -949,3 +949,27 @@ class TestWorld(unittest.TestCase):
|
||||
100,
|
||||
200],
|
||||
game.world)
|
||||
|
||||
|
||||
def test_production_queue_two_units(self):
|
||||
game = Gameplay()
|
||||
|
||||
game.world._add_building(Buildings.BARRACKS, {}, {})
|
||||
game.world._add_building(Buildings.HOUSE, {}, {})
|
||||
|
||||
training = 21
|
||||
|
||||
game.queue_unit(0, Units.MILITIA)
|
||||
game.queue_unit(0, Units.MILITIA)
|
||||
|
||||
game.play_until(1)
|
||||
self.assertEqual(4, game.world.population)
|
||||
|
||||
game.play_until(training)
|
||||
self.assertEqual(5, game.world.population)
|
||||
|
||||
game.play_until(training + 10)
|
||||
self.assertEqual(5, game.world.population)
|
||||
|
||||
game.play_until(2*training)
|
||||
self.assertEqual(6, game.world.population)
|
||||
|
||||
Reference in New Issue
Block a user