14 #include "CUnit/Basic.h"
17 #include "../postgis_config.h"
135 #define MAX_CUNIT_MSG_LENGTH 256
142 int main(
int argc,
char *argv[])
146 CU_pSuite suite_to_run;
148 CU_pTest test_to_run = NULL;
149 CU_ErrorCode errCode = 0;
150 CU_pTestRegistry registry;
160 if (CUE_SUCCESS != CU_initialize_registry())
162 errCode = CU_get_error();
163 printf(
" Error attempting to initialize registry: %d. See CUError.h for error code list.\n", errCode);
175 CU_basic_set_mode(CU_BRM_VERBOSE);
178 errCode = CU_basic_run_tests();
185 registry = CU_get_registry();
186 for (index = 1; index < argc; index++)
188 suite_name = argv[index];
190 suite_to_run = CU_get_suite_by_name(suite_name, registry);
191 if (NULL == suite_to_run)
194 suite_to_run = registry->pSuite;
195 while (suite_to_run != NULL)
197 test_to_run = CU_get_test_by_name(suite_name, suite_to_run);
198 if (test_to_run != NULL)
201 test_name = suite_name;
202 suite_name = suite_to_run->pName;
205 suite_to_run = suite_to_run->pNext;
208 if (suite_to_run == NULL)
210 printf(
"\n'%s' does not appear to be either a suite name or a test name.\n\n", suite_name);
214 if (test_name != NULL && test_to_run != NULL)
217 printf(
"\nRunning test '%s' in suite '%s'.\n", test_name, suite_name);
221 errCode = CU_run_test(suite_to_run, test_to_run);
222 if (errCode != CUE_SUCCESS)
224 printf(
" Error attempting to run tests: %d. See CUError.h for error code list.\n", errCode);
228 num_run = CU_get_number_of_asserts();
229 num_failed = CU_get_number_of_failures();
230 printf(
"\n %s - asserts - %3d passed, %3d failed, %3d total.\n\n",
231 (0 == num_failed ?
"PASSED" :
"FAILED"), (num_run - num_failed), num_failed, num_run);
237 printf(
"\nRunning all tests in suite '%s'.\n", suite_name);
241 errCode = CU_run_suite(suite_to_run);
242 if (errCode != CUE_SUCCESS)
244 printf(
" Error attempting to run tests: %d. See CUError.h for error code list.\n", errCode);
248 num_run = CU_get_number_of_tests_run();
249 num_failed = CU_get_number_of_tests_failed();
250 printf(
"\n %s - tests - %3d passed, %3d failed, %3d total.\n",
251 (0 == num_failed ?
"PASSED" :
"FAILED"), (num_run - num_failed), num_failed, num_run);
252 num_run = CU_get_number_of_asserts();
253 num_failed = CU_get_number_of_failures();
254 printf(
" - asserts - %3d passed, %3d failed, %3d total.\n\n",
255 (num_run - num_failed), num_failed, num_run);
261 CU_basic_show_failures(CU_get_failure_list());
264 num_failed = CU_get_number_of_failures();
265 CU_cleanup_registry();
288 fprintf(stderr,
"NOTICE: %s\n", buf);
297 fprintf(stderr,
"DEBUG%d: %s\n", level, buf);
318 LWGEOM* observed = transfn(input);
void sfcgal_suite_setup(void)
void out_x3d_suite_setup(void)
void in_encoded_polyline_suite_setup(void)
void clip_by_rect_suite_setup()
int main(int argc, char *argv[])
#define MAX_CUNIT_MSG_LENGTH
void out_encoded_polyline_suite_setup(void)
void geos_cluster_suite_setup(void)
void force_sfs_suite_setup(void)
void buildarea_suite_setup()
static void cu_debuglogger(int level, const char *fmt, va_list ap)
void unionfind_suite_setup(void)
void do_fn_test(LWGEOM *(*transfn)(LWGEOM *), char *input_wkt, char *expected_wkt)
void wkt_out_suite_setup(void)
void twkb_in_suite_setup(void)
void homogenize_suite_setup(void)
void misc_suite_setup(void)
void measures_suite_setup(void)
void wrapx_suite_setup(void)
void cu_error_msg_reset()
PG_SuiteSetup setupfuncs[]
void iterator_suite_setup(void)
void triangulate_suite_setup(void)
void stringbuffer_suite_setup(void)
void chaikin_suite_setup(void)
void split_suite_setup(void)
void libgeom_suite_setup(void)
void tree_suite_setup(void)
void out_gml_suite_setup(void)
static void cu_errorreporter(const char *fmt, va_list ap)
CUnit error handler Log message in a global var instead of printing in stderr.
void twkb_out_suite_setup(void)
void out_svg_suite_setup(void)
void geos_suite_setup(void)
void effectivearea_suite_setup(void)
void in_geojson_suite_setup(void)
void wkb_in_suite_setup(void)
char cu_error_msg[MAX_CUNIT_ERROR_LENGTH+1]
void wkb_out_suite_setup(void)
void geodetic_suite_setup(void)
void ptarray_suite_setup(void)
void node_suite_setup(void)
void out_kml_suite_setup(void)
void surface_suite_setup(void)
void varint_suite_setup(void)
void out_geojson_suite_setup(void)
void wkt_in_suite_setup(void)
void algorithms_suite_setup()
void minimum_bounding_circle_suite_setup(void)
void filterm_suite_setup(void)
static void cu_noticereporter(const char *fmt, va_list ap)
void lwstroke_suite_setup(void)
void(* PG_SuiteSetup)(void)
#define MAX_CUNIT_ERROR_LENGTH
#define ASSERT_LWGEOM_EQUAL(o, e)
void(*) typedef void(*) voi lwgeom_set_handlers)(lwallocator allocator, lwreallocator reallocator, lwfreeor freeor, lwreporter errorreporter, lwreporter noticereporter)
Install custom memory management and error handling functions you want your application to use.
void lwgeom_free(LWGEOM *geom)
#define LW_PARSER_CHECK_NONE
void lwgeom_set_debuglogger(lwdebuglogger debuglogger)
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)