コード例 #1
0
 def test_removeconqueredcountry(self):
     paux = HumanPlayers("Pepe", 35, "orange", [])
     c1 = Country("Europa del sur", paux)
     c2 = Country("Francia", paux)
     c3 = Country("Italia", paux)
     paux.addconqueredcountry(c1)
     conqueredCountries = paux.getconqueredcountries()
     paux.addconqueredcountry(c2)
     conqueredCountries = paux.getconqueredcountries()
     paux.addconqueredcountry(c3)
     conqueredCountries = paux.getconqueredcountries()
     paux.removeconqueredcountry(c2)
     conqueredCountries = paux.getconqueredcountries()
     self.assertEqual(c1.isequal(conqueredCountries[0]), True)
     self.assertEqual(c3.isequal(conqueredCountries[1]), True)
コード例 #2
0
 def test_distributebattalions(self):
     paux = HumanPlayers("Pepe", 35, "orange", [])
     country1 = Country("Europa del sur", paux)
     country2 = Country("Francia", paux)
     country3 = Country("Italia", paux)
     country1.changebattalions(7)
     country2.changebattalions(1)
     country3.changebattalions(5)
     paux.addconqueredcountry(country1)
     paux.addconqueredcountry(country2)
     paux.addconqueredcountry(country3)
     paux.distributebatallions()
     self.assertEqual(paux.getusedbattalions(), 35)
     conqueredCountries = paux.getconqueredcountries()
     self.assertEqual(conqueredCountries[0].tostring(),
                      "Europa del sur 15:Pepe 35 orange")
     self.assertEqual(conqueredCountries[1].tostring(),
                      "Francia 8:Pepe 35 orange")
     self.assertEqual(conqueredCountries[2].tostring(),
                      "Italia 12:Pepe 35 orange")