[GRASS-SVN] r61242 - in grass/trunk/lib: . raster3d raster3d/test raster3d/testsuite
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Jul 12 04:33:11 PDT 2014
Author: huhabla
Date: 2014-07-12 04:33:11 -0700 (Sat, 12 Jul 2014)
New Revision: 61242
Added:
grass/trunk/lib/raster3d/testsuite/
grass/trunk/lib/raster3d/testsuite/raster3d_lib_test.py
Modified:
grass/trunk/lib/Makefile
grass/trunk/lib/raster3d/test/test_main.c
Log:
Raster3d library test module is now activated in the library directory Makefile.
Removed obsolete integration test options in test.raster3d.lib
and added a gunittest library test to the raster3d library.
Modified: grass/trunk/lib/Makefile
===================================================================
--- grass/trunk/lib/Makefile 2014-07-12 10:54:28 UTC (rev 61241)
+++ grass/trunk/lib/Makefile 2014-07-12 11:33:11 UTC (rev 61242)
@@ -31,6 +31,7 @@
rst \
lidar \
raster3d \
+ raster3d/test \
gpde \
dspf \
symbol \
Modified: grass/trunk/lib/raster3d/test/test_main.c
===================================================================
--- grass/trunk/lib/raster3d/test/test_main.c 2014-07-12 10:54:28 UTC (rev 61241)
+++ grass/trunk/lib/raster3d/test/test_main.c 2014-07-12 11:33:11 UTC (rev 61242)
@@ -42,13 +42,14 @@
param.unit->options = "coord,putget,large";
param.unit->description = "Choose the unit tests to run";
+/* No integration test for now
param.integration = G_define_option();
param.integration->key = "integration";
param.integration->type = TYPE_STRING;
param.integration->required = NO;
param.integration->options = "";
param.integration->description = "Choose the integration tests to run";
-
+*/
param.depths = G_define_option();
param.depths->key = "depths";
param.depths->type = TYPE_INTEGER;
@@ -81,14 +82,6 @@
param.testunit->key = 'u';
param.testunit->description = "Run all unit tests";
- param.testint = G_define_flag();
- param.testint->key = 'i';
- param.testint->description = "Run all integration tests";
-
- param.full = G_define_flag();
- param.full->key = 'a';
- param.full->description = "Run all unit and integration tests";
-
param.compression = G_define_flag();
param.compression->key = 'l';
param.compression->description = "Switch zip compression on";
@@ -135,43 +128,26 @@
Rast3d_init_defaults();
/*Run the unit tests */
- if (param.testunit->answer || param.full->answer) {
+ if (param.testunit->answer) {
returnstat += unit_test_coordinate_transform();
returnstat += unit_test_put_get_value();
returnstat += unit_test_put_get_value_large_file(depths, rows, cols, tile_size);
}
- /*Run the integration tests */
- if (param.testint->answer || param.full->answer) {
- ;
- }
-
/*Run single tests */
- if (!param.full->answer) {
- /*unit tests */
- if (!param.testunit->answer) {
- i = 0;
- if (param.unit->answers)
- while (param.unit->answers[i]) {
- if (strcmp(param.unit->answers[i], "coord") == 0)
- returnstat += unit_test_coordinate_transform();
- if (strcmp(param.unit->answers[i], "putget") == 0)
- returnstat += unit_test_put_get_value();
- if (strcmp(param.unit->answers[i], "large") == 0)
- returnstat += unit_test_put_get_value_large_file(depths, rows, cols, tile_size);
-
- i++;
- }
- }
- /*integration tests */
- if (!param.testint->answer) {
- i = 0;
- if (param.integration->answers)
- while (param.integration->answers[i]) {
- ;
- }
-
- }
+ if (!param.testunit->answer) {
+ i = 0;
+ if (param.unit->answers)
+ while (param.unit->answers[i]) {
+ if (strcmp(param.unit->answers[i], "coord") == 0)
+ returnstat += unit_test_coordinate_transform();
+ if (strcmp(param.unit->answers[i], "putget") == 0)
+ returnstat += unit_test_put_get_value();
+ if (strcmp(param.unit->answers[i], "large") == 0)
+ returnstat += unit_test_put_get_value_large_file(depths, rows, cols, tile_size);
+
+ i++;
+ }
}
if (returnstat != 0)
Added: grass/trunk/lib/raster3d/testsuite/raster3d_lib_test.py
===================================================================
--- grass/trunk/lib/raster3d/testsuite/raster3d_lib_test.py (rev 0)
+++ grass/trunk/lib/raster3d/testsuite/raster3d_lib_test.py 2014-07-12 11:33:11 UTC (rev 61242)
@@ -0,0 +1,39 @@
+"""Test of raster3d library
+
+ at author Soeren Gebbert
+"""
+from grass.gunittest.case import TestCase
+
+class Raster3dLibraryTest(TestCase):
+
+ @classmethod
+ def setUpClass(cls):
+ cls.runModule("g.gisenv", set="OVERWRITE=1")
+
+ def test_coordinates(self):
+ self.assertModule("test.raster3d.lib", flags="l", unit="coord")
+ self.assertModule("test.raster3d.lib", unit="coord")
+
+ def test_putget(self):
+ self.assertModule("test.raster3d.lib", unit="putget")
+ self.assertModule("test.raster3d.lib", flags="l", unit="putget")
+
+ def test_large_tilesizes(self):
+ """Test for different tile sizes"""
+ self.assertModule("test.raster3d.lib", unit="large", depths=91, rows=89, cols=87)
+ self.assertModule("test.raster3d.lib", unit="large", depths=91, rows=89, cols=87, tile_size=8)
+ self.assertModule("test.raster3d.lib", unit="large", depths=91, rows=89, cols=87, tile_size=512)
+ self.assertModule("test.raster3d.lib", unit="large", depths=91, rows=89, cols=87, tile_size=1024)
+ self.assertModule("test.raster3d.lib", unit="large", depths=91, rows=89, cols=87, tile_size=32768)
+
+ self.assertModule("test.raster3d.lib", flags="l", unit="large", depths=91, rows=89, cols=87)
+ self.assertModule("test.raster3d.lib", flags="l", unit="large", depths=91, rows=89, cols=87, tile_size=8)
+ self.assertModule("test.raster3d.lib", flags="l", unit="large", depths=91, rows=89, cols=87, tile_size=512)
+ self.assertModule("test.raster3d.lib", flags="l", unit="large", depths=91, rows=89, cols=87, tile_size=1024)
+ self.assertModule("test.raster3d.lib", flags="l", unit="large", depths=91, rows=89, cols=87, tile_size=32768)
+
+if __name__ == '__main__':
+ from grass.gunittest.main import test
+ test()
+
+
More information about the grass-commit
mailing list