[GRASS-SVN] r72546 - in grass/trunk/raster/r.basins.fill: . testsuite

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Mar 24 02:04:40 PDT 2018


Author: lucadelu
Date: 2018-03-24 02:04:40 -0700 (Sat, 24 Mar 2018)
New Revision: 72546

Added:
   grass/trunk/raster/r.basins.fill/testsuite/
   grass/trunk/raster/r.basins.fill/testsuite/testrbf.py
Log:
r.basin.fill: added testsuite provided by Sunveer Singh

Added: grass/trunk/raster/r.basins.fill/testsuite/testrbf.py
===================================================================
--- grass/trunk/raster/r.basins.fill/testsuite/testrbf.py	                        (rev 0)
+++ grass/trunk/raster/r.basins.fill/testsuite/testrbf.py	2018-03-24 09:04:40 UTC (rev 72546)
@@ -0,0 +1,63 @@
+"""
+Name:       r.basins.fill
+Purpose:    Tests r.basins.fill and its flags/options.
+	
+Author:     Sunveer Singh
+Copyright:  (C) 2017 by Sunveer Singh and the GRASS Development Team
+Licence:    This program is free software under the GNU General Public
+	    License (>=v2). Read the file COPYING that comes with GRASS
+	    for details.
+"""
+from grass.gunittest.case import TestCase
+
+class TestRasterbasin(TestCase):
+    celevation='elevation'
+    tgeology='geology'
+    output='basinsoutput'
+    input="lakes"
+
+    @classmethod
+    def setUpClass(cls):
+        seed = 500
+        cls.use_temp_region()
+        cls.runModule('g.region', raster=cls.tgeology, flags='p')
+        cls.runModule('r.watershed', elevation='elevation', stream=cls.celevation, threshold='50000', overwrite=True)
+        cls.runModule('r.geomorphon', elevation=cls.celevation, forms=cls.tgeology, overwrite=True)
+        cls.runModule('r.mapcalc', seed=seed, expression='rand_cell = rand(1, 200)', overwrite=True)
+        cls.runModule('r.thin', input=cls.input, output=cls.output)
+        
+
+    @classmethod
+    def tearDownClass(cls):
+        cls.del_temp_region()
+        
+    def tearDown(cls):
+        cls.runModule('g.remove', flags='f', type='raster', name=cls.output)
+
+    def test_no1(self):
+        lakes='lakes'
+        self.assertModule('r.basins.fill', cnetwork=self.celevation, tnetwork=self.tgeology, output=self.output, number='1', overwrite=True)
+        self.assertRasterMinMax(map=lakes, refmin=34300, refmax=43600,
+	                        msg="lakes in degrees must be between 34300 and 43600")
+
+    def test_no2(self):
+        soils='soils'
+        self.assertModule('r.basins.fill', cnetwork=self.celevation, tnetwork=self.tgeology, output=self.output, number='3')
+        self.assertRasterMinMax(map=soils, refmin=18683, refmax=46555,
+	                        msg="soils in degrees must be between 18683 and 46555")
+
+    def test_no3(self):
+        landuse='landuse'
+        self.assertModule('r.basins.fill', cnetwork=self.celevation, tnetwork=self.tgeology, output=self.output, number='4')
+        self.assertRasterMinMax(map=landuse, refmin=1, refmax=7,
+	                        msg="landuse in degrees must be between 1 and 7")
+
+    def test_no4(self):
+        rand_cell='rand_cell'
+        self.assertModule('r.basins.fill', cnetwork=self.celevation, tnetwork=self.tgeology, output=self.output, number='5')
+        self.assertRasterMinMax(map=rand_cell, refmin=1, refmax=199,
+	                        msg="rand_cell in degrees must be between 1 and 199")
+
+if __name__ == '__main__':
+    from grass.gunittest.main import test
+    test()


Property changes on: grass/trunk/raster/r.basins.fill/testsuite/testrbf.py
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/x-python
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property


More information about the grass-commit mailing list