PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ do_test_mindistance_tolerance()

static void do_test_mindistance_tolerance ( char *  in1,
char *  in2,
double  expected_res,
int  line,
double(*)(const LWGEOM *, const LWGEOM *, double)  distancef 
)
static

Definition at line 40 of file cu_measures.c.

References distance(), LW_PARSER_CHECK_NONE, lwgeom_free(), and lwgeom_from_wkt().

45 {
46  LWGEOM *lw1;
47  LWGEOM *lw2;
48  double distance;
49  char *msg1 = "test_mindistance2d_tolerance failed (got %g expected %g) at line %d\n";
50  char *msg2 = "\n\ndo_test_mindistance2d_tolerance: NULL lwgeom generated from WKT\n %s\n\n";
51 
54 
55  if ( ! lw1 )
56  {
57  printf(msg2, in1);
58  exit(1);
59  }
60  if ( ! lw2 )
61  {
62  printf(msg2, in2);
63  exit(1);
64  }
65 
66  distance = distancef(lw1, lw2, 0.0);
67  lwgeom_free(lw1);
68  lwgeom_free(lw2);
69 
70  if ( fabs(distance - expected_res) > 0.00001 )
71  {
72  printf(msg1, distance, expected_res, line);
73  CU_FAIL();
74  }
75  else
76  {
77  CU_PASS();
78  }
79 
80 }
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1099
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:904
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:2013
Datum distance(PG_FUNCTION_ARGS)
Here is the call graph for this function: