PostGIS  3.0.6dev-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,
double  accepted_error 
)
static

Definition at line 41 of file cu_measures.c.

47 {
48  LWGEOM *lw1;
49  LWGEOM *lw2;
50  double distance;
51  char *msg1 = "test_mindistance2d_tolerance failed (got %g expected %g) at line %d\n";
52  char *msg2 = "\n\ndo_test_mindistance2d_tolerance: NULL lwgeom generated from WKT\n %s\n\n";
53 
56 
57  if ( ! lw1 )
58  {
59  printf(msg2, in1);
60  exit(1);
61  }
62  if ( ! lw2 )
63  {
64  printf(msg2, in2);
65  exit(1);
66  }
67 
68  FLAGS_SET_SOLID(lw1->flags, 1);
69  FLAGS_SET_SOLID(lw2->flags, 1);
70 
71  distance = distancef(lw1, lw2, 0.0);
72  lwgeom_free(lw1);
73  lwgeom_free(lw2);
74 
75  if ( fabs(distance - expected_res) > accepted_error )
76  {
77  printf(msg1, distance, expected_res, line);
78  CU_FAIL();
79  }
80  else
81  {
82  CU_PASS();
83  }
84 
85 }
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1138
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:2060
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:905
#define FLAGS_SET_SOLID(flags, value)
Definition: liblwgeom.h:191
static double distance(double x1, double y1, double x2, double y2)
Definition: lwtree.c:1032
lwflags_t flags
Definition: liblwgeom.h:447

References distance(), LWGEOM::flags, FLAGS_SET_SOLID, LW_PARSER_CHECK_NONE, lwgeom_free(), and lwgeom_from_wkt().

Here is the call graph for this function: