1 /**************************************************************************** 2 * 3 * MODULE: test.rtree.lib 4 * 5 * AUTHOR(S): Original author 6 * Soeren Gebbert soerengebbert <at> gmx <dot> de 7 * 05 Sep 2007 Berlin 8 * 9 * PURPOSE: Unit test for the vector rtree implementation 10 * 11 * COPYRIGHT: (C) 2007 by the GRASS Development Team 12 * 13 * This program is free software under the GNU General Public 14 * License (>=v2). Read the file COPYING that comes with GRASS 15 * for details. 16 * 17 *****************************************************************************/ 18 #include <stdlib.h> 19 #include <string.h> 20 #include <grass/gis.h> 21 #include <grass/glocale.h> 22 #include "test_rtree_lib.h" 23 24 /*- Parameters and global variables -----------------------------------------*/ 25 typedef struct { 26 struct Option *unit; 27 } paramType; 28 29 paramType param; /*Parameters */ 30 31 /*- prototypes --------------------------------------------------------------*/ 32 static void set_params(void); /*Fill the paramType structure */ 33 34 /* ************************************************************************* */ 35 /* Set up the arguments we are expecting ********************************** */ 36 37 /* ************************************************************************* */ set_params(void)38void set_params(void) { 39 param.unit = G_define_option(); 40 param.unit->key = "unit"; 41 param.unit->type = TYPE_STRING; 42 param.unit->required = YES; 43 param.unit->options = "basic"; 44 param.unit->description = _("Choose the unit tests to run"); 45 } 46 47 /* ************************************************************************* */ 48 /* ************************************************************************* */ 49 50 /* ************************************************************************* */ main(int argc,char * argv[])51int main(int argc, char *argv[]) { 52 struct GModule *module; 53 int returnstat = 0, i; 54 55 56 /* Initialize GRASS */ 57 G_gisinit(argv[0]); 58 59 module = G_define_module(); 60 module->description 61 = _("Unit tests for the vector rtree library"); 62 63 /* Get parameters from user */ 64 set_params(); 65 66 if (G_parser(argc, argv)) 67 exit(EXIT_FAILURE); 68 69 /*unit tests */ 70 i = 0; 71 if (param.unit->answers) { 72 while (param.unit->answers[i]) { 73 if (strcmp(param.unit->answers[i], "basic") == 0) 74 returnstat += unit_test_basics(); 75 i++; 76 } 77 } 78 79 80 81 if (returnstat != 0) 82 G_warning("Errors detected while testing the vector rtree lib"); 83 else 84 G_message("\n-- vector rtree lib tests finished successfully --"); 85 86 return (returnstat); 87 } 88