コード例 #1
0
 def mk_tunnel_recipient(self, agent):
     # Verry hacky...
     medium = agent._get_state().medium
     backend = medium.agency._backends["tunnel"]
     key = agent.get_agent_id()
     route = backend.route
     return recipient.Recipient(key, route, backend.channel_type)
コード例 #2
0
 def testConstructDummyAgent(self):
     agent = self.ball.load(self.instance)
     self.assertIsInstance(agent, DummyAgent)
     self.assertTrue(self.ball.medium is not None)
     state = agent._get_state()
     self.assertIsInstance(state, guard.MutableState)
     self.assertEqual(5, state.value)
     self.assertIsInstance(state.resources, resource.Resources)
コード例 #3
0
ファイル: test_simulation_host.py プロジェクト: f3at/feat
 def testDefaultResources(self):
     agent = self.get_local('agent')
     totals = agent._get_state().resources.get_totals()
     self.assertTrue("host" in totals)
     self.assertTrue("bandwidth" in totals)
     self.assertTrue("epu" in totals)
     self.assertTrue("core" in totals)
     self.assertTrue("mem" in totals)
コード例 #4
0
ファイル: test_simulation_host.py プロジェクト: f3at/feat
 def testDefaultRequeriments(self):
     agent = self.get_local('agent')
     cats = agent._get_state().categories
     self.assertTrue("access" in cats)
     self.assertTrue("storage" in cats)
     self.assertTrue("address" in cats)
     self.assertEqual(cats["access"], Access.private)
     self.assertEqual(cats["address"], Address.fixed)
     self.assertEqual(cats["storage"], Storage.static)
コード例 #5
0
 def testStateChangingFunc(self):
     agent = self.ball.load(self.instance)
     self.assertFalse('var' in agent._get_state().__dict__)
     output, state = self.ball.call(None, agent.define_in_state, 'var', 4)
     self.assertEqual(4, state.var)
     self.assertTrue('var' in agent._get_state().__dict__)
コード例 #6
0
ファイル: test_simulation_host.py プロジェクト: f3at/feat
 def testDefaultRequeriments(self):
     agent = self.get_local('agent')
     cats = agent._get_state().categories
     self.assertTrue("access" in cats)
     self.assertTrue("storage" in cats)
     self.assertTrue("address" in cats)