def testHistorialAllocation(self): faction = Faction() for i in range(4): faction.allocationHistory.append((0, 0, 0)) faction.allocationHistory.append((100, 100, 100)) history = faction.getHistoricalAllocation() self.assertEqual(history[0], 20)
def testFactionStanceListContainsBalanced(self): faction = Faction() faction.setupStanceList() hasBalanced = False for stance in faction.stanceList: if stance.name == 'balanced': hasBalanced = True self.assertTrue(hasBalanced)
def testHistoricalAllocationAndStance(self): faction = Faction() faction.setupStanceList() for i in range(4): faction.allocationHistory.append((0, 0, 0)) faction.allocationHistory.append((100, 100, 100)) history = faction.getHistoricalAllocation() stance = faction.getStance(history[0], history[1], history[2]) self.assertEqual(stance.name, 'conservative')
def testPushingAllocationRemovesOldest(self): faction = Faction() faction.setupHistory() faction.OFF = 30 faction.DEF = 40 faction.ESP = 30 faction.recordCurrentAllocationToHistory() self.assertEqual(len(faction.allocationHistory), faction.historicalDataWindowSize)
def testRecordCurrentAllocationMethodExists(self): faction = Faction() faction.setupHistory() faction.OFF = 30 faction.DEF = 40 faction.ESP = 30 faction.recordCurrentAllocationToHistory() self.assertEqual(faction.allocationHistory[len(faction.allocationHistory) - 1], (30, 40, 30))
def testHistoryInitsFive(self): faction = Faction() faction.setupHistory() self.assertEqual(len(faction.allocationHistory), 5)
def testGetsCorrectStance3(self): faction = Faction() faction.setupStanceList() currentStance = faction.getStance(71, 15, 15) self.assertEqual(currentStance.name, 'bloodthirsty')
def testGetsCorrectStance2(self): faction = Faction() faction.setupStanceList() currentStance = faction.getStance(20, 20, 20) self.assertEqual(currentStance.name, 'conservative')
def testGetsCorrectStance(self): faction = Faction() faction.setupStanceList() currentStance = faction.getStance(33, 33, 33) self.assertEqual(currentStance.name, 'balanced')
def testFactionSetupStanceListPutsSomeElementsInList(self): faction = Faction() faction.setupStanceList() self.assertTrue(len(faction.stanceList) > 0)
def testNewEspionageGoalResets(self): faction = Faction() faction.setNewEspionageGoal() self.assertEqual(faction.espionageGoal['complete'], False)