63 CU_pSuite suite_to_run;
66 CU_ErrorCode errCode = 0;
67 CU_pTestRegistry registry;
85 if (CUE_SUCCESS != CU_initialize_registry())
87 errCode = CU_get_error();
88 printf(
" Error attempting to initialize registry: %d. See CUError.h for error code list.\n", errCode);
100 CU_basic_set_mode(CU_BRM_VERBOSE);
103 errCode = CU_basic_run_tests();
110 registry = CU_get_registry();
111 for (index = 1; index < argc; index++)
113 suite_name = argv[index];
115 suite_to_run = CU_get_suite_by_name(suite_name, registry);
116 if (NULL == suite_to_run)
119 suite_to_run = registry->pSuite;
120 while (suite_to_run != NULL)
122 test_to_run = CU_get_test_by_name(suite_name, suite_to_run);
123 if (test_to_run != NULL)
126 test_name = suite_name;
127 suite_name = suite_to_run->pName;
130 suite_to_run = suite_to_run->pNext;
133 if (suite_to_run == NULL)
135 printf(
"\n'%s' does not appear to be either a suite name or a test name.\n\n", suite_name);
139 if (test_name != NULL)
142 printf(
"\nRunning test '%s' in suite '%s'.\n", test_name, suite_name);
146 errCode = CU_run_test(suite_to_run, test_to_run);
147 if (errCode != CUE_SUCCESS)
149 printf(
" Error attempting to run tests: %d. See CUError.h for error code list.\n", errCode);
153 num_run = CU_get_number_of_asserts();
154 num_failed = CU_get_number_of_failures();
155 printf(
"\n %s - asserts - %3d passed, %3d failed, %3d total.\n\n",
156 (0 == num_failed ?
"PASSED" :
"FAILED"), (num_run - num_failed), num_failed, num_run);
162 printf(
"\nRunning all tests in suite '%s'.\n", suite_name);
166 errCode = CU_run_suite(suite_to_run);
167 if (errCode != CUE_SUCCESS)
169 printf(
" Error attempting to run tests: %d. See CUError.h for error code list.\n", errCode);
173 num_run = CU_get_number_of_tests_run();
174 num_failed = CU_get_number_of_tests_failed();
175 printf(
"\n %s - tests - %3d passed, %3d failed, %3d total.\n",
176 (0 == num_failed ?
"PASSED" :
"FAILED"), (num_run - num_failed), num_failed, num_run);
177 num_run = CU_get_number_of_asserts();
178 num_failed = CU_get_number_of_failures();
179 printf(
" - asserts - %3d passed, %3d failed, %3d total.\n\n",
180 (num_run - num_failed), num_failed, num_run);
186 CU_basic_show_failures(CU_get_failure_list());
189 num_failed = CU_get_number_of_failures();
190 CU_cleanup_registry();
static void cu_error_reporter(const char *fmt, va_list ap)
CUnit error handler Log message in a global var instead of printing in stderr.
void default_rt_info_handler(const char *fmt, va_list ap)
void rt_set_handlers(rt_allocator allocator, rt_reallocator reallocator, rt_deallocator deallocator, rt_message_handler error_handler, rt_message_handler info_handler, rt_message_handler warning_handler)
This function is called when the PostgreSQL backend is taking care of the memory and we want to use p...
void * default_rt_reallocator(void *mem, size_t size)
PG_SuiteSetup setupfuncs[]
void default_rt_warning_handler(const char *fmt, va_list ap)
void(* PG_SuiteSetup)(void)
void default_rt_deallocator(void *mem)
void * default_rt_allocator(size_t size)
The default memory/logging handlers installed by lwgeom_install_default_allocators() ...
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...