14 #define _CU_TESTER_H 1
18 #define MAX_CUNIT_ERROR_LENGTH 512
20 #define PG_ADD_TEST(suite, testfunc) CU_add_test(suite, #testfunc, testfunc)
31 #define ASSERT_DOUBLE_EQUAL(o,e) do { \
33 fprintf(stderr, "[%s:%d]\n Expected: %g\n Obtained: %g\n", __FILE__, __LINE__, (double)(e), (o)); \
34 CU_ASSERT_EQUAL(o,(double)e); \
37 #define ASSERT_INT_EQUAL(o,e) do { \
39 fprintf(stderr, "[%s:%d]\n Expected: %d\n Obtained: %d\n", __FILE__, __LINE__, (e), (o)); \
40 CU_ASSERT_EQUAL(o,e); \
43 #define ASSERT_STRING_EQUAL(o,e) do { \
44 if ( strcmp(o,e) != 0 ) \
45 fprintf(stderr, "[%s:%d]\n Expected: %s\n Obtained: %s\n", __FILE__, __LINE__, (e), (o)); \
46 CU_ASSERT_STRING_EQUAL(o,e); \
49 #define ASSERT_LWGEOM_EQUAL(o, e) do { \
50 if ( !lwgeom_same(o, e) ) { \
51 char* wkt_o = lwgeom_to_ewkt(o); \
52 char* wkt_e = lwgeom_to_ewkt(e); \
53 fprintf(stderr, "[%s:%d]\n Expected: %s\n Obtained: %s\n", __FILE__, __LINE__, (wkt_o), (wkt_e)); \
57 CU_ASSERT_TRUE(lwgeom_same(o, e)); \
60 #define ASSERT_INTARRAY_EQUAL(o, e, n) do { \
62 for (i = 0; i < n; i++) { \
64 fprintf(stderr, "[%s:%d]", __FILE__, __LINE__); \
65 fprintf(stderr, "\nExpected: ["); \
66 for (i = 0; i < n; i++) \
67 fprintf(stderr, " %d", e[i]); \
68 fprintf(stderr, " ]\nObtained: ["); \
69 for (i = 0; i < n; i++) \
70 fprintf(stderr, " %d", o[i]); \
71 fprintf(stderr, " ]\n"); \
79 #define ASSERT_POINT2D_EQUAL(o, e, eps) do { \
80 CU_ASSERT_DOUBLE_EQUAL(o.x, e.x, eps); \
81 CU_ASSERT_DOUBLE_EQUAL(o.y, e.y, eps); \
84 #define ASSERT_POINT4D_EQUAL(o, e, eps) do { \
85 CU_ASSERT_DOUBLE_EQUAL(o.x, e.x, eps); \
86 CU_ASSERT_DOUBLE_EQUAL(o.y, e.y, eps); \
87 CU_ASSERT_DOUBLE_EQUAL(o.z, e.z, eps); \
88 CU_ASSERT_DOUBLE_EQUAL(o.m, e.m, eps); \
void(* PG_SuiteSetup)(void)
void do_fn_test(LWGEOM *(*transfn)(LWGEOM *), char *input_wkt, char *expected_wkt)
void cu_error_msg_reset(void)
This library is the generic geometry handling section of PostGIS.