[GRASS-SVN] r54799 - grass-addons/grass7/raster/r.agent/tests
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Jan 27 15:14:24 PST 2013
Author: mic
Date: 2013-01-27 15:14:24 -0800 (Sun, 27 Jan 2013)
New Revision: 54799
Modified:
grass-addons/grass7/raster/r.agent/tests/test_playground.py
grass-addons/grass7/raster/r.agent/tests/test_world.py
Log:
add tests
Modified: grass-addons/grass7/raster/r.agent/tests/test_playground.py
===================================================================
--- grass-addons/grass7/raster/r.agent/tests/test_playground.py 2013-01-27 23:13:52 UTC (rev 54798)
+++ grass-addons/grass7/raster/r.agent/tests/test_playground.py 2013-01-27 23:14:24 UTC (rev 54799)
@@ -67,5 +67,17 @@
#TODO better test manually?
pass
+ def test_getrandomposition(self):
+ n = self.pg.region["n"]
+ s = self.pg.region["s"]
+ w = self.pg.region["w"]
+ e = self.pg.region["e"]
+
+ position = self.pg.getrandomposition()
+ self.assertTrue(position[0] >= s)
+ self.assertTrue(position[0] < n)
+ self.assertTrue(position[1] >= w)
+ self.assertTrue(position[1] < e)
+
# def tearDown(self):
Modified: grass-addons/grass7/raster/r.agent/tests/test_world.py
===================================================================
--- grass-addons/grass7/raster/r.agent/tests/test_world.py 2013-01-27 23:13:52 UTC (rev 54798)
+++ grass-addons/grass7/raster/r.agent/tests/test_world.py 2013-01-27 23:14:24 UTC (rev 54799)
@@ -9,16 +9,24 @@
self.world = world.World()
def test_addlayertopg(self):
- pass
+ self.world.addlayertopg("foo")
+ self.assertTrue(len(self.world.playground.layers["foo"]) > 0)
def test_removelayerfrompg(self):
- pass
+ self.world.addlayertopg("foo")
+ self.assertTrue(self.world.playground.layers.has_key("foo"))
+ self.world.removelayerfrompg("foo")
+ self.assertFalse(self.world.playground.layers.has_key("foo"))
def test_getlayer(self):
- pass
+ self.world.addlayertopg("foo")
+ self.assertIs(self.world.getlayer("foo"),
+ self.world.playground.layers["foo"])
def test_bear(self):
- pass
+ agent = self.world.bear(1, [1,1])
+ self.assertIsInstance(agent, self.world.agenttype)
+ self.assertIs(agent, self.world.agents.pop())
def test_getnextagent(self):
pass
More information about the grass-commit
mailing list