def test__conduct_combat(self): t1 = Army() t2 = Army() battle = Battle() formation = 1 # Test if combat is conducted correctly and if it returns # appropriate result for all Archer p1 army and empty p2 army # Assumes __assign_army is working correctly t1._Army__assign_army("", 0, 10, 0, formation) t2._Army__assign_army("", 0, 0, 0, formation) try: self.assertTrue( battle._Battle__conduct_combat(t1, t2, formation) == 1, "Fairer 0,10,0 0,0,0 failed") except AssertionError as e: self.verificationErrors.append(str(e)) # Tests combat is conducted correctly and if it # returns appropriate result for 1 Soldier p1 army and 1 Archer p2 army # Assumes __assign_army is working correctly t1._Army__assign_army("", 1, 0, 0, formation) t2._Army__assign_army("", 0, 1, 0, formation) try: self.assertTrue( battle._Battle__conduct_combat(t1, t2, formation) == 2, "Fairer 1,0,0 0,1,0 failed") except AssertionError as e: self.verificationErrors.append(str(e)) try: self.assertEqual(str(t1.force), "", msg="Army 1 wrong for Fairer 1,0,0 0,1,0") except AssertionError as e: self.verificationErrors.append(str(e)) try: self.assertEqual(str(t2.force), "Archer's life = 1 and experience = 1", msg="Army 2 wrong for Fairer 1,0,0 0") except AssertionError as e: self.verificationErrors.append(str(e))
def test___conduct_combat(self): t1 = Army() t2 = Army() t3 = Army() t4 = Army() battle = Battle() formation = 0 # Test if combat is conducted correctly and returns appropriate result for empty p1 army and all Archer p2 army # Assumes __assign_army is working correctly t1._Army__assign_army("", 0, 0, 0, formation) t2._Army__assign_army("", 0, 10, 0, formation) t3._Army__assign_army("", 0, 4, 0, formation) t4._Army__assign_army("", 0, 0, 0, formation) try: self.assertTrue( battle._Battle__conduct_combat(t1, t2, formation) == 2, "Gladiatorial 0,0,0 0,10,0 failed") except AssertionError as e: self.verificationErrors.append(str(e)) # Checking if t1 is an instance of Army try: self.assertEqual(isinstance(t1, Army), True, msg="Object is not an instance of Army") except AssertionError as e: self.verificationErrors.append(str(e)) # Testing __conduct_combat try: self.assertTrue( battle._Battle__conduct_combat(t3, t4, formation) == 1, "Gladiatorial 0,4,0 0,0,0 failed") except AssertionError as e: self.verificationErrors.append(str(e))
def test___conduct_combat(self): t1 = Army() t2 = Army() battle = Battle() formation = 0 # Test if combat is conducted correctly and returns appropriate result for empty p1 army and all Archer p2 army # Assumes __assign_army is working correctly t1._Army__assign_army("", 0, 0, 0, formation) t2._Army__assign_army("", 0, 10, 0, formation) try: self.assertTrue( battle._Battle__conduct_combat(t1, t2, formation) == 2, "Gladiatorial 0,0,0 0,10,0 failed") except AssertionError as e: self.verificationErrors.append(str(e))
def test__conduct_combat(self): t1 = Army() t2 = Army() t3 = Army() t4 = Army() battle = Battle() formation = 1 # Test if combat is conducted correctly and if it returns # appropriate result for all Archer p1 army and empty p2 army # Assumes __assign_army is working correctly t1._Army__assign_army("", 0, 10, 0, formation) t2._Army__assign_army("", 0, 0, 0, formation) t3._Army__assign_army("", 0, 4, 0, formation) t4._Army__assign_army("", 0, 0, 0, formation) try: self.assertTrue( battle._Battle__conduct_combat(t1, t2, formation) == 1, "Fairer 0,10,0 0,0,0 failed") except AssertionError as e: self.verificationErrors.append(str(e)) # Tests combat is conducted correctly and if it # returns appropriate result for 1 Soldier p1 army and 1 Archer p2 army # Assumes __assign_army is working correctly t1._Army__assign_army("", 1, 0, 0, formation) t2._Army__assign_army("", 0, 1, 0, formation) try: self.assertTrue( battle._Battle__conduct_combat(t1, t2, formation) == 0, "Fairer 1,0,0 0,1,0 failed") except AssertionError as e: self.verificationErrors.append(str(e)) try: self.assertEqual(str(t1.force), "", msg="Army 1 wrong for Fairer 1,0,0 0,1,0") except AssertionError as e: self.verificationErrors.append(str(e)) try: self.assertEqual(str(t2.force), "", msg="Army 2 wrong for Fairer 1,0,0 0") except AssertionError as e: self.verificationErrors.append(str(e)) # Checking if t1 is an instance of Army try: self.assertEqual(isinstance(t3, Army), True, msg="Object is not an instance of Army") except AssertionError as e: self.verificationErrors.append(str(e)) # Testing __conduct_combat method try: self.assertTrue( battle._Battle__conduct_combat(t3, t4, formation) == 1, "Fairer 0,4,0 0,0,0 failed") except AssertionError as e: self.verificationErrors.append(str(e))