PostGIS  2.5.0beta1dev-r@@SVN_REVISION@@

◆ do_test_mindistance2d_tolerance()

static void do_test_mindistance2d_tolerance ( char *  in1,
char *  in2,
double  expected_res,
int  line 
)
static

Definition at line 34 of file cu_measures.c.

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

35 {
36  LWGEOM *lw1;
37  LWGEOM *lw2;
38  double distance;
39  char *msg1 = "test_mindistance2d_tolerance failed (got %g expected %g) at line %d\n";
40  char *msg2 = "\n\ndo_test_mindistance2d_tolerance: NULL lwgeom generated from WKT\n %s\n\n";
41 
44 
45  if ( ! lw1 )
46  {
47  printf(msg2, in1);
48  exit(1);
49  }
50  if ( ! lw2 )
51  {
52  printf(msg2, in2);
53  exit(1);
54  }
55 
56  distance = lwgeom_mindistance2d_tolerance(lw1, lw2, 0.0);
57  lwgeom_free(lw1);
58  lwgeom_free(lw2);
59 
60  if ( fabs(distance - expected_res) > 0.00001 )
61  {
62  printf(msg1, distance, expected_res, line);
63  CU_FAIL();
64  }
65  else
66  {
67  CU_PASS();
68  }
69 
70 }
double lwgeom_mindistance2d_tolerance(const LWGEOM *lw1, const LWGEOM *lw2, double tolerance)
Function handling min distance calculations and dwithin calculations.
Definition: measures.c:213
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1144
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:904
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:2004
Datum distance(PG_FUNCTION_ARGS)
Here is the call graph for this function: