[GRASS-SVN] r54847 - in grass-addons/grass7/raster/r.agent: libagent tests

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Feb 2 11:17:21 PST 2013


Author: mic
Date: 2013-02-02 11:17:20 -0800 (Sat, 02 Feb 2013)
New Revision: 54847

Modified:
   grass-addons/grass7/raster/r.agent/libagent/world.py
   grass-addons/grass7/raster/r.agent/tests/test_world.py
Log:
implement killing agents

Modified: grass-addons/grass7/raster/r.agent/libagent/world.py
===================================================================
--- grass-addons/grass7/raster/r.agent/libagent/world.py	2013-02-02 18:41:01 UTC (rev 54846)
+++ grass-addons/grass7/raster/r.agent/libagent/world.py	2013-02-02 19:17:20 UTC (rev 54847)
@@ -113,5 +113,5 @@
         Remove the agent from the list
         @param agent to be terminated
         """
-        pass
+        self.agents.remove(agent)
 

Modified: grass-addons/grass7/raster/r.agent/tests/test_world.py
===================================================================
--- grass-addons/grass7/raster/r.agent/tests/test_world.py	2013-02-02 18:41:01 UTC (rev 54846)
+++ grass-addons/grass7/raster/r.agent/tests/test_world.py	2013-02-02 19:17:20 UTC (rev 54847)
@@ -48,7 +48,10 @@
         pass
 
     def test_kill(self):
-        pass
+        agent = self.world.bear(1, [0,0])
+        self.assertTrue(len(self.world.agents) > 0)
+        self.world.kill(agent)
+        self.assertTrue(len(self.world.agents) == 0)
 
 #    def tearDown(self):
 



More information about the grass-commit mailing list