PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ perform_cluster_intersecting_test()

static void perform_cluster_intersecting_test ( char **  wkt_inputs,
uint32_t  num_inputs,
char **  wkt_outputs,
uint32_t  num_outputs 
)
static

Definition at line 79 of file cu_geos_cluster.c.

References assert_all_results_found(), cluster_intersecting(), GEOSARRAY2LWGEOM(), lwfree(), lwgeom_free(), LWGEOMARRAY2GEOS(), and WKTARRAY2LWGEOM().

Referenced by basic_test(), empty_inputs_test(), multipoint_test(), nonsequential_test(), and single_input_test().

80 {
81  GEOSGeometry** geos_results;
82  LWGEOM** lw_results;
83  uint32_t num_clusters;
84 
85  LWGEOM** expected_outputs = WKTARRAY2LWGEOM(wkt_outputs, num_outputs);
86  LWGEOM** lw_inputs = WKTARRAY2LWGEOM(wkt_inputs, num_inputs);
87  GEOSGeometry** geos_inputs = LWGEOMARRAY2GEOS(lw_inputs, num_inputs);
88 
89  cluster_intersecting(geos_inputs, num_inputs, &geos_results, &num_clusters);
90  CU_ASSERT_EQUAL(num_outputs, num_clusters);
91 
92  lw_results = GEOSARRAY2LWGEOM(geos_results, num_clusters);
93 
94  assert_all_results_found(lw_results, num_clusters, expected_outputs, num_outputs);
95 
96  /* Cleanup */
97  uint32_t i;
98  for(i = 0; i < num_clusters; i++)
99  {
100  GEOSGeom_destroy(geos_results[i]);
101  }
102  lwfree(geos_inputs);
103  lwfree(geos_results);
104 
105  for(i = 0; i < num_outputs; i++)
106  {
107  lwgeom_free(expected_outputs[i]);
108  lwgeom_free(lw_results[i]);
109  }
110  lwfree(expected_outputs);
111  lwfree(lw_results);
112 
113  for(i = 0; i < num_inputs; i++)
114  {
115  lwgeom_free(lw_inputs[i]);
116  }
117  lwfree(lw_inputs);
118 }
static LWGEOM ** GEOSARRAY2LWGEOM(GEOSGeometry **geos_array, size_t num_geoms)
void lwfree(void *mem)
Definition: lwutil.c:244
int cluster_intersecting(GEOSGeometry **geoms, uint32_t num_geoms, GEOSGeometry ***clusterGeoms, uint32_t *num_clusters)
Takes an array of GEOSGeometry* and constructs an array of GEOSGeometry*, where each element in the c...
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1099
static LWGEOM ** WKTARRAY2LWGEOM(char **wkt_array, size_t num_geoms)
unsigned int uint32_t
Definition: uthash.h:78
static void assert_all_results_found(LWGEOM **results, size_t num_outputs, LWGEOM **expected, size_t num_expected_outputs)
static GEOSGeometry ** LWGEOMARRAY2GEOS(LWGEOM **lw_array, size_t num_geoms)
Here is the call graph for this function:
Here is the caller graph for this function: