def test_attack_diff_alignment_in_range_zero_torpedoes(self): # Arrange # Act ship = Battle('Nship', 'Battle', 3, 3, 'them') target = Ship('BattleEnemy', 'Battle', 0, 7, 'us') ship._current_health = 90 ship._max_health = 100 ship._torpedoes = 0 target._current_health = 100 target._max_health = 100 print(ship._torpedoes) print(target._current_health) ship.attack(target) print(ship._torpedoes) print(target._current_health) # Assert self.assertEqual(0, ship._torpedoes) self.assertEqual(90, target._current_health)
def test_attack_chaotic_alignment_in_range(self): # Arrange # Act ship = Battle('Nship', 'Battle', 3, 3, 'chaotic') target = Ship('BattleEnemy', 'Battle', 0, 7, 'them') ship._current_health = 90 ship._max_health = 100 ship._torpedoes = 9 target._current_health = 50 target._max_health = 100 print(ship._torpedoes) print(target._current_health) ship.attack(target) print(ship._torpedoes) print(target._current_health) # Assert self.assertEqual(8, ship._torpedoes) self.assertEqual(30, target._current_health)
def test_attack_diff_alignment_out_of_range(self): # Arrange # Act ship = Battle('Nship', 'Battle', 30, 30, 'them') target = Ship('BattleEnemy', 'Battle', 0, 7, 'us') ship._current_health = 90 ship._max_health = 100 ship._torpedoes = 8 target._current_health = 80 target._max_health = 100 print(ship._torpedoes) print(target._current_health) ship.attack(target) print(ship._torpedoes) print(target._current_health) # Assert self.assertEqual(8, ship._torpedoes) self.assertEqual(80, target._current_health)