Example #1
0
 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)
Example #2
0
 def testFactionStanceListContainsBalanced(self):
     faction = Faction()
     faction.setupStanceList()
     hasBalanced = False
     for stance in faction.stanceList:
         if stance.name == 'balanced':
             hasBalanced = True
     self.assertTrue(hasBalanced)
Example #3
0
 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')
Example #4
0
 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)
Example #5
0
 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))
Example #6
0
 def testHistoryInitsFive(self):
     faction = Faction()
     faction.setupHistory()
     self.assertEqual(len(faction.allocationHistory), 5)
Example #7
0
 def testGetsCorrectStance3(self):
     faction = Faction()
     faction.setupStanceList()
     currentStance = faction.getStance(71, 15, 15)
     self.assertEqual(currentStance.name, 'bloodthirsty')
Example #8
0
 def testGetsCorrectStance2(self):
     faction = Faction()
     faction.setupStanceList()
     currentStance = faction.getStance(20, 20, 20)
     self.assertEqual(currentStance.name, 'conservative')
Example #9
0
 def testGetsCorrectStance(self):
     faction = Faction()
     faction.setupStanceList()
     currentStance = faction.getStance(33, 33, 33)
     self.assertEqual(currentStance.name, 'balanced')
Example #10
0
 def testFactionSetupStanceListPutsSomeElementsInList(self):
     faction = Faction()
     faction.setupStanceList()
     self.assertTrue(len(faction.stanceList) > 0)
Example #11
0
 def testNewEspionageGoalResets(self):
     faction = Faction()
     faction.setNewEspionageGoal()
     self.assertEqual(faction.espionageGoal['complete'], False)