def test_damage(self): self.assertEqual(task2.damage("fexxxx"), 0) self.assertEquals(task2.damage("aaa"), 0) self.assertEquals(task2.damage('feeai'), 2) self.assertEquals(task2.damage('feaineain'), 7) self.assertEquals(task2.damage('jee'), 0) self.assertEquals(task2.damage('fdafafeajain)'), 1) self.assertEquals(task2.damage('fexxxxxxxxxxai'), 0) self.assertEquals(task2.damage('fedaiai'), 8) self.assertEquals(task2.damage('feainjeeai'), 9) self.assertEquals(task2.damage('feainjeeainai'), 12) print("damage OK")
def test_damage_one(self): inStr = 'fedaineai' # pomylili sie w instrukcji # policzyli 'fe' jako 2, a powinno byc 1 # dlatego expected_result to 10, a nie 11 expected_result = 10 self.assertEqual(damage(inStr), expected_result)
def testSpells(self): spell_points = { 'feeai': 2, 'feaineain': 7, 'jee': 0, 'fefefefefeaiaiaiaiai': 0, 'fdafafeajain': 1, 'fexxxxxxxxxxai': 0, 'fedaineai': 10, 'jejeai': 0, 'jejefeai': 3, 'dadsafeokokok': 0, 'aioooofe': 0 } # dict of some spells and their damage points for i, spell in enumerate(spell_points.keys()): with self.subTest(spell=spell): self.assertEqual(damage(spell), spell_points[spell])
def test_damage_M_eight(self): inStr = 'fedaidaidaiai' expected_result = 18 self.assertEqual(damage(inStr), expected_result)
def test_damage_incorrect_spell_no_fe(self): inStr = 'jejeai' expected_result = 0 self.assertEqual(damage(inStr), expected_result)
def test_damage_M_seven(self): inStr = 'fejneeeai' expected_result = 2 self.assertEqual(damage(inStr), expected_result)
def test_damage_six(self): inStr = 'fexxxxxxxxxxai' expected_result = 0 self.assertEqual(damage(inStr), expected_result)
def test_damage_five(self): inStr = 'fdafafeajain' expected_result = 1 self.assertEqual(damage(inStr), expected_result)
def test_damage_four(self): inStr = 'jee' expected_result = 0 self.assertEqual(damage(inStr), expected_result)
def test_damage_three(self): inStr = 'feaineain' expected_result = 7 self.assertEqual(damage(inStr), expected_result)
def test_damage_two(self): inStr = 'feeai' expected_result = 2 self.assertEqual(damage(inStr), expected_result)
def test_damage_multiple_fe(self): inStr = 'fedaifeneai' expected_result = 0 self.assertEqual(damage(inStr), expected_result)
def test_damage_incorrect_spell_ai_before_fe(self): inStr = 'aioooofe' expected_result = 0 self.assertEqual(damage(inStr), expected_result)
def test_damage_incorrect_spell_no_ai(self): inStr = 'dadsafeokokok' expected_result = 0 self.assertEqual(damage(inStr), expected_result)
def damage_test(): print(damage('xxxxxfejejeeaindaiyaiaixxxxxx') == 17) print(damage('feeai') == 2) print(damage('feaineain') == 7) print(damage('jee') == 0) print(damage('fefefefefeaiaiaiaiai') == 0) print(damage('fdafafeajain') == 1) print(damage('fexxxxxxxxxxai') == 0) print(damage('fejejeeaindaineai') == 18) print(damage('fedaineai') == 1 + 5 + 2 + 2) print(damage('fedaineiai') == 1 + 5 + 2 + 2 - 1) print(damage('feaineiai') == 1 + 2 + 2 + 2 - 1)