28 #include <irplib_plugin.h>
38 cpl_recipe_define(test_recipe, 123,
"Some Author",
"someone@local.org",
"2014",
39 "For testing.",
"Simple recipe for testing.");
41 static void test_irplib_recipe_test(
void);
61 cpl_parameterlist * parlist;
64 cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING);
66 parlist = cpl_parameterlist_new();
69 (void)irplib_parameterlist_get_double(parlist,
"INST",
"RECIPE", NULL);
70 cpl_test_error(CPL_ERROR_NULL_INPUT);
72 (void)irplib_parameterlist_get_double(parlist,
"INST", NULL,
"PAR");
73 cpl_test_error(CPL_ERROR_NULL_INPUT);
75 (void)irplib_parameterlist_get_double(parlist, NULL,
"RECIPE",
"PAR");
76 cpl_test_error(CPL_ERROR_NULL_INPUT);
78 (void)irplib_parameterlist_get_double(NULL,
"INST",
"RECIPE",
"PAR");
79 cpl_test_error(CPL_ERROR_NULL_INPUT);
81 (void)irplib_parameterlist_get_double(parlist,
"INST",
"RECIPE",
"PAR");
82 cpl_test_error(CPL_ERROR_DATA_NOT_FOUND);
85 (void)irplib_parameterlist_get_int(parlist,
"INST",
"RECIPE", NULL);
86 cpl_test_error(CPL_ERROR_NULL_INPUT);
88 (void)irplib_parameterlist_get_int(parlist,
"INST", NULL,
"PAR");
89 cpl_test_error(CPL_ERROR_NULL_INPUT);
91 (void)irplib_parameterlist_get_int(parlist, NULL,
"RECIPE",
"PAR");
92 cpl_test_error(CPL_ERROR_NULL_INPUT);
94 (void)irplib_parameterlist_get_int(NULL,
"INST",
"RECIPE",
"PAR");
95 cpl_test_error(CPL_ERROR_NULL_INPUT);
97 (void)irplib_parameterlist_get_int(parlist,
"INST",
"RECIPE",
"PAR");
98 cpl_test_error(CPL_ERROR_DATA_NOT_FOUND);
101 (void)irplib_parameterlist_get_bool(parlist,
"INST",
"RECIPE", NULL);
102 cpl_test_error(CPL_ERROR_NULL_INPUT);
104 (void)irplib_parameterlist_get_bool(parlist,
"INST", NULL,
"PAR");
105 cpl_test_error(CPL_ERROR_NULL_INPUT);
107 (void)irplib_parameterlist_get_bool(parlist, NULL,
"RECIPE",
"PAR");
108 cpl_test_error(CPL_ERROR_NULL_INPUT);
110 (void)irplib_parameterlist_get_bool(NULL,
"INST",
"RECIPE",
"PAR");
111 cpl_test_error(CPL_ERROR_NULL_INPUT);
113 (void)irplib_parameterlist_get_bool(parlist,
"INST",
"RECIPE",
"PAR");
114 cpl_test_error(CPL_ERROR_DATA_NOT_FOUND);
117 (void)irplib_parameterlist_get_string(parlist,
"INST",
"RECIPE", NULL);
118 cpl_test_error(CPL_ERROR_NULL_INPUT);
120 (void)irplib_parameterlist_get_string(parlist,
"INST", NULL,
"PAR");
121 cpl_test_error(CPL_ERROR_NULL_INPUT);
123 (void)irplib_parameterlist_get_string(parlist, NULL,
"RECIPE",
"PAR");
124 cpl_test_error(CPL_ERROR_NULL_INPUT);
126 (void)irplib_parameterlist_get_string(NULL,
"INST",
"RECIPE",
"PAR");
127 cpl_test_error(CPL_ERROR_NULL_INPUT);
129 (void)irplib_parameterlist_get_string(parlist,
"INST",
"RECIPE",
"PAR");
130 cpl_test_error(CPL_ERROR_DATA_NOT_FOUND);
133 cpl_parameterlist_delete(parlist);
135 test_irplib_recipe_test();
137 return cpl_test_end(0);
141 static void test_irplib_recipe_test(
void)
146 const char * tags[] = {
150 cpl_pluginlist * pluginlist;
151 const size_t ntags =
sizeof(tags) /
sizeof(
char*);
152 pluginlist = cpl_pluginlist_new();
153 cpl_test_nonnull(pluginlist);
155 cpl_test_zero(cpl_plugin_get_info(pluginlist));
156 cpl_test_zero(irplib_plugin_test(pluginlist, ntags, tags));
158 cpl_pluginlist_delete(pluginlist);
165 static cpl_error_code test_recipe_fill_parameterlist(cpl_parameterlist *
self)
167 cpl_ensure_code(
self != NULL, CPL_ERROR_NULL_INPUT);
168 return CPL_ERROR_NONE;
175 static int test_recipe(cpl_frameset *frames,
const cpl_parameterlist *params)
177 cpl_frameset_iterator * iterator = NULL;
178 const cpl_frame * frame;
180 cpl_ensure_code(frames != NULL && params != NULL, CPL_ERROR_NULL_INPUT);
181 cpl_ensure_code(cpl_frameset_get_size(frames) > 0,
182 CPL_ERROR_DATA_NOT_FOUND);
187 for (frame = irplib_frameset_get_first_const(&iterator, frames);
189 frame = irplib_frameset_get_next_const(iterator))
191 const char * name = cpl_frame_get_filename(frame);
192 cpl_propertylist * props = cpl_propertylist_load(name, 0);
194 cpl_frameset_iterator_delete(iterator);
195 return cpl_error_get_code();
197 cpl_propertylist_delete(props);
200 cpl_frameset_iterator_delete(iterator);
201 return CPL_ERROR_NONE;
int main(void)
Find a plugin and submit it to some tests.