PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ do_dbscan_test()

static void do_dbscan_test ( struct dbscan_test_info  test)
static

Definition at line 267 of file cu_geos_cluster.c.

268 {
269  LWGEOM** geoms = WKTARRAY2LWGEOM(test.wkt_inputs, test.num_geoms);
270  UNIONFIND* uf = UF_create(test.num_geoms);
271  uint32_t* ids;
272  char* in_a_cluster;
273  uint32_t i;
274 
275  union_dbscan(geoms, test.num_geoms, uf, test.eps, test.min_points, &in_a_cluster);
276  ids = UF_get_collapsed_cluster_ids(uf, in_a_cluster);
277 
278  for (i = 0; i < test.num_geoms; i++)
279  {
280  ASSERT_INT_EQUAL(in_a_cluster[i], test.expected_in_cluster[i]);
281  if (in_a_cluster[i])
282  ASSERT_INT_EQUAL(ids[i], test.expected_ids[i]);
283  }
284 
285  UF_destroy(uf);
286  for (i = 0; i < test.num_geoms; i++)
287  {
288  lwgeom_free(geoms[i]);
289  }
290  lwfree(geoms);
291  lwfree(in_a_cluster);
292  lwfree(ids);
293 }
static LWGEOM ** WKTARRAY2LWGEOM(char **wkt_array, size_t num_geoms)
#define ASSERT_INT_EQUAL(o, e)
int union_dbscan(LWGEOM **geoms, uint32_t num_geoms, UNIONFIND *uf, double eps, uint32_t min_points, char **is_in_cluster_ret)
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1144
void lwfree(void *mem)
Definition: lwutil.c:244
uint32_t * UF_get_collapsed_cluster_ids(UNIONFIND *uf, const char *is_in_cluster)
Definition: lwunionfind.c:145
void UF_destroy(UNIONFIND *uf)
Definition: lwunionfind.c:53
UNIONFIND * UF_create(uint32_t N)
Definition: lwunionfind.c:34
uint32_t * expected_ids
unsigned int uint32_t
Definition: uthash.h:78

References ASSERT_INT_EQUAL, dbscan_test_info::eps, dbscan_test_info::expected_ids, dbscan_test_info::expected_in_cluster, lwfree(), lwgeom_free(), dbscan_test_info::min_points, dbscan_test_info::num_geoms, UF_create(), UF_destroy(), UF_get_collapsed_cluster_ids(), union_dbscan(), dbscan_test_info::wkt_inputs, and WKTARRAY2LWGEOM().

Referenced by dbscan_test(), dbscan_test_3612a(), dbscan_test_3612b(), and dbscan_test_3612c().

Here is the call graph for this function:
Here is the caller graph for this function: