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 cpl_error_code test_recipe_fill_parameterlist(cpl_parameterlist *
self);
42 static int test_recipe(cpl_frameset *frames,
const cpl_parameterlist *params);
44 static void test_irplib_recipe_test(
void);
64 cpl_parameterlist * parlist;
67 cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING);
69 parlist = cpl_parameterlist_new();
72 (void)irplib_parameterlist_get_double(parlist,
"INST",
"RECIPE", NULL);
73 cpl_test_error(CPL_ERROR_NULL_INPUT);
75 (void)irplib_parameterlist_get_double(parlist,
"INST", NULL,
"PAR");
76 cpl_test_error(CPL_ERROR_NULL_INPUT);
78 (void)irplib_parameterlist_get_double(parlist, NULL,
"RECIPE",
"PAR");
79 cpl_test_error(CPL_ERROR_NULL_INPUT);
81 (void)irplib_parameterlist_get_double(NULL,
"INST",
"RECIPE",
"PAR");
82 cpl_test_error(CPL_ERROR_NULL_INPUT);
84 (void)irplib_parameterlist_get_double(parlist,
"INST",
"RECIPE",
"PAR");
85 cpl_test_error(CPL_ERROR_DATA_NOT_FOUND);
88 (void)irplib_parameterlist_get_int(parlist,
"INST",
"RECIPE", NULL);
89 cpl_test_error(CPL_ERROR_NULL_INPUT);
91 (void)irplib_parameterlist_get_int(parlist,
"INST", NULL,
"PAR");
92 cpl_test_error(CPL_ERROR_NULL_INPUT);
94 (void)irplib_parameterlist_get_int(parlist, NULL,
"RECIPE",
"PAR");
95 cpl_test_error(CPL_ERROR_NULL_INPUT);
97 (void)irplib_parameterlist_get_int(NULL,
"INST",
"RECIPE",
"PAR");
98 cpl_test_error(CPL_ERROR_NULL_INPUT);
100 (void)irplib_parameterlist_get_int(parlist,
"INST",
"RECIPE",
"PAR");
101 cpl_test_error(CPL_ERROR_DATA_NOT_FOUND);
104 (void)irplib_parameterlist_get_bool(parlist,
"INST",
"RECIPE", NULL);
105 cpl_test_error(CPL_ERROR_NULL_INPUT);
107 (void)irplib_parameterlist_get_bool(parlist,
"INST", NULL,
"PAR");
108 cpl_test_error(CPL_ERROR_NULL_INPUT);
110 (void)irplib_parameterlist_get_bool(parlist, NULL,
"RECIPE",
"PAR");
111 cpl_test_error(CPL_ERROR_NULL_INPUT);
113 (void)irplib_parameterlist_get_bool(NULL,
"INST",
"RECIPE",
"PAR");
114 cpl_test_error(CPL_ERROR_NULL_INPUT);
116 (void)irplib_parameterlist_get_bool(parlist,
"INST",
"RECIPE",
"PAR");
117 cpl_test_error(CPL_ERROR_DATA_NOT_FOUND);
120 (void)irplib_parameterlist_get_string(parlist,
"INST",
"RECIPE", NULL);
121 cpl_test_error(CPL_ERROR_NULL_INPUT);
123 (void)irplib_parameterlist_get_string(parlist,
"INST", NULL,
"PAR");
124 cpl_test_error(CPL_ERROR_NULL_INPUT);
126 (void)irplib_parameterlist_get_string(parlist, NULL,
"RECIPE",
"PAR");
127 cpl_test_error(CPL_ERROR_NULL_INPUT);
129 (void)irplib_parameterlist_get_string(NULL,
"INST",
"RECIPE",
"PAR");
130 cpl_test_error(CPL_ERROR_NULL_INPUT);
132 (void)irplib_parameterlist_get_string(parlist,
"INST",
"RECIPE",
"PAR");
133 cpl_test_error(CPL_ERROR_DATA_NOT_FOUND);
136 cpl_parameterlist_delete(parlist);
138 test_irplib_recipe_test();
140 return cpl_test_end(0);
144 static void test_irplib_recipe_test(
void)
149 const char * tags[] = {
153 cpl_pluginlist * pluginlist;
154 const size_t ntags =
sizeof(tags) /
sizeof(
char*);
155 pluginlist = cpl_pluginlist_new();
156 cpl_test_nonnull(pluginlist);
159 cpl_test_zero(irplib_plugin_test(pluginlist, ntags, tags));
161 cpl_pluginlist_delete(pluginlist);
168 static cpl_error_code test_recipe_fill_parameterlist(cpl_parameterlist *
self)
170 cpl_ensure_code(
self != NULL, CPL_ERROR_NULL_INPUT);
171 return CPL_ERROR_NONE;
178 static int test_recipe(cpl_frameset *frames,
const cpl_parameterlist *params)
180 cpl_frameset_iterator * iterator = NULL;
181 const cpl_frame *
frame;
183 cpl_ensure_code(frames != NULL && params != NULL, CPL_ERROR_NULL_INPUT);
184 cpl_ensure_code(cpl_frameset_get_size(frames) > 0,
185 CPL_ERROR_DATA_NOT_FOUND);
190 for (frame = irplib_frameset_get_first_const(&iterator, frames);
192 frame = irplib_frameset_get_next_const(iterator))
194 const char * name = cpl_frame_get_filename(frame);
195 cpl_propertylist * props = cpl_propertylist_load(name, 0);
197 cpl_frameset_iterator_delete(iterator);
198 return cpl_error_get_code();
200 cpl_propertylist_delete(props);
203 cpl_frameset_iterator_delete(iterator);
204 return CPL_ERROR_NONE;