def test_initialization(self): ship = Ship(10, 20) self.assertEqual(10, ship.x) self.assertEqual(20, ship.y) self.assertEqual(100, ship.health) self.assertEqual(0, ship.cool_down_counter) self.assertEqual(30, ship.COOLDOWN)
def test_get_height(self): ship = Ship(10, 20) ship.ship_img = pygame.image.load("./assets/pixel_ship_yellow.png") self.assertEqual(90, ship.get_height())
def test_shooting(self): ship = Ship(10, 20) ship.laser_img = pygame.image.load("./assets/pixel_laser_yellow.png") ship.shoot() self.assertEqual(1, ship.cool_down_counter)
def test_cooldown_35(self): ship = Ship(10, 20) ship.cool_down_counter = 35 ship.cooldown() self.assertEqual(0, ship.cool_down_counter)
def test_cooldown_1(self): ship = Ship(10, 20) ship.cool_down_counter = 1 ship.cooldown() self.assertEqual(2, ship.cool_down_counter)