[GRASS-SVN] r73751 - in sandbox/wenzeslaus/r.mapcalculator: . testsuite
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Dec 3 04:21:18 PST 2018
Author: neteler
Date: 2018-12-03 04:21:18 -0800 (Mon, 03 Dec 2018)
New Revision: 73751
Added:
sandbox/wenzeslaus/r.mapcalculator/testsuite/
sandbox/wenzeslaus/r.mapcalculator/testsuite/test_rmapcalculator.py
Log:
r.mapcalculator addon: minimal test case added
Added: sandbox/wenzeslaus/r.mapcalculator/testsuite/test_rmapcalculator.py
===================================================================
--- sandbox/wenzeslaus/r.mapcalculator/testsuite/test_rmapcalculator.py (rev 0)
+++ sandbox/wenzeslaus/r.mapcalculator/testsuite/test_rmapcalculator.py 2018-12-03 12:21:18 UTC (rev 73751)
@@ -0,0 +1,49 @@
+"""
+Name: r.mapcalculator test
+Purpose: Tests r.mapcalculator and its flags/options.
+
+Author: Markus Neteler
+Copyright: (C) 2018 by Markus Neteler 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 TestReport(TestCase):
+
+ @classmethod
+ def setUpClass(cls):
+ """Use temporary region settings"""
+ map_input = 'elevation'
+ cls.runModule("g.region", raster=map_input)
+ cls.use_temp_region()
+
+ @classmethod
+ def tearDownClass(cls):
+ map_output1 = 'test1'
+ map_output2 = 'test2'
+ cls.runModule("g.remove", flags='f', type='raster', name=map_output1)
+ cls.runModule("g.remove", flags='f', type='raster', name=map_output2)
+ cls.del_temp_region()
+
+ def test_rmapcalculator(self):
+ """Testing r.mapcalculator"""
+ map_input = 'elevation'
+ map_output1 = 'test1'
+ map_output2 = 'test2'
+
+ # test 1
+ self.assertModule('r.mapcalculator', expression='0', output=map_output1)
+ self.assertRasterMinMax(map=map_output1, refmin=0, refmax=0,
+ msg="Result must be 0 for all pixels")
+
+ # test 2
+ formula='if(%s > 2000, 1, 0)' % map_input # expected to be 0
+ self.assertModule('r.mapcalculator', expression=formula, output=map_output2)
+ self.assertRasterMinMax(map=map_output2, refmin=0, refmax=0,
+ msg="Result must be 0 for all pixels")
+
+if __name__ == '__main__':
+ from grass.gunittest.main import test
+ test()
Property changes on: sandbox/wenzeslaus/r.mapcalculator/testsuite/test_rmapcalculator.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