43 #include "irplib_plugin.h"
63 #define LINE_LEN_MAX 1024
67 #define DEV_RANDOM "/dev/urandom"
70 #define recipe_assert(bool) \
71 ((bool) ? (cpl_msg_debug(cpl_func, \
72 "OK in " __FILE__ " line %d (CPL-error state: '%s' in %s): %s",__LINE__, \
73 cpl_error_get_message(), cpl_error_get_where(), #bool), 0) \
74 : (cpl_msg_error(cpl_func, \
75 "Failure in " __FILE__ " line %d (CPL-error state: '%s' in %s): %s", \
76 __LINE__, cpl_error_get_message(), cpl_error_get_where(), #bool), 1))
84 static const cpl_parameter * irplib_parameterlist_get(
const cpl_parameterlist *,
89 static void recipe_parameterlist_set(cpl_parameterlist *);
90 static cpl_boolean irplib_plugin_has_sof_from_env(
const cpl_plugin *,
93 static void recipe_frameset_load(cpl_frameset *,
const char *);
95 static void recipe_sof_test_devfile(cpl_plugin *,
const char *,
size_t,
97 static void recipe_sof_test_image_empty(cpl_plugin *,
size_t,
const char *[]);
98 static void recipe_sof_test_local(cpl_plugin *);
99 static void recipe_sof_test_from_env(cpl_plugin *);
100 static void recipe_frameset_empty(cpl_frameset *);
101 static void recipe_frameset_test_frame(
const cpl_frame *);
102 static void recipe_frameset_test_frameset_diff(
const cpl_frameset *,
103 const cpl_frameset *);
105 static cpl_errorstate inistate;
124 const char * irplib_parameterlist_get_string(
const cpl_parameterlist *
self,
125 const char * instrume,
127 const char * parameter)
129 const cpl_parameter * par = irplib_parameterlist_get(
self, instrume,
134 (void)cpl_error_set_where(cpl_func);
138 const char * value = cpl_parameter_get_string(par);
140 if (value == NULL) (void)cpl_error_set_where(cpl_func);
157 cpl_boolean irplib_parameterlist_get_bool(
const cpl_parameterlist *
self,
158 const char * instrume,
160 const char * parameter)
162 const cpl_parameter * par = irplib_parameterlist_get(
self, instrume,
167 (void)cpl_error_set_where(cpl_func);
171 cpl_errorstate prestate = cpl_errorstate_get();
172 const cpl_boolean value = cpl_parameter_get_bool(par);
174 if (!cpl_errorstate_is_equal(prestate))
175 (void)cpl_error_set_where(cpl_func);
193 int irplib_parameterlist_get_int(
const cpl_parameterlist *
self,
194 const char * instrume,
196 const char * parameter)
198 const cpl_parameter * par = irplib_parameterlist_get(
self, instrume,
203 (void)cpl_error_set_where(cpl_func);
207 cpl_errorstate prestate = cpl_errorstate_get();
208 const int value = cpl_parameter_get_int(par);
210 if (!cpl_errorstate_is_equal(prestate))
211 (void)cpl_error_set_where(cpl_func);
228 double irplib_parameterlist_get_double(
const cpl_parameterlist *
self,
229 const char * instrume,
231 const char * parameter)
233 const cpl_parameter * par = irplib_parameterlist_get(
self, instrume,
238 (void)cpl_error_set_where(cpl_func);
242 cpl_errorstate prestate = cpl_errorstate_get();
243 const double value = cpl_parameter_get_double(par);
245 if (!cpl_errorstate_is_equal(prestate))
246 (void)cpl_error_set_where(cpl_func);
267 cpl_error_code irplib_parameterlist_set_string(cpl_parameterlist *
self,
268 const char * instrume,
270 const char * parameter,
271 const char * defvalue,
273 const char * context,
277 cpl_error_code error;
279 char * paramname = cpl_sprintf(
"%s.%s.%s", instrume, recipe,
282 cpl_ensure_code(paramname != NULL, cpl_error_get_code());
284 par = cpl_parameter_new_value(paramname, CPL_TYPE_STRING, man, context,
288 cpl_ensure_code(par != NULL, cpl_error_get_code());
290 error = cpl_parameter_set_alias(par, CPL_PARAMETER_MODE_CLI,
291 alias ? alias : parameter);
292 cpl_ensure_code(!error, error);
294 error = cpl_parameter_disable(par, CPL_PARAMETER_MODE_ENV);
295 cpl_ensure_code(!error, error);
297 error = cpl_parameterlist_append(
self, par);
298 cpl_ensure_code(!error, error);
300 return CPL_ERROR_NONE;
319 cpl_error_code irplib_parameterlist_set_bool(cpl_parameterlist *
self,
320 const char * instrume,
322 const char * parameter,
323 cpl_boolean defvalue,
325 const char * context,
329 cpl_error_code error;
331 char * paramname = cpl_sprintf(
"%s.%s.%s", instrume, recipe,
334 cpl_ensure_code(paramname != NULL, cpl_error_get_code());
336 par = cpl_parameter_new_value(paramname, CPL_TYPE_BOOL, man, context,
340 cpl_ensure_code(par != NULL, cpl_error_get_code());
342 error = cpl_parameter_set_alias(par, CPL_PARAMETER_MODE_CLI,
343 alias ? alias : parameter);
344 cpl_ensure_code(!error, error);
346 error = cpl_parameter_disable(par, CPL_PARAMETER_MODE_ENV);
347 cpl_ensure_code(!error, error);
349 error = cpl_parameterlist_append(
self, par);
350 cpl_ensure_code(!error, error);
352 return CPL_ERROR_NONE;
372 cpl_error_code irplib_parameterlist_set_int(cpl_parameterlist *
self,
373 const char * instrume,
375 const char * parameter,
378 const char * context,
382 cpl_error_code error;
384 char * paramname = cpl_sprintf(
"%s.%s.%s", instrume, recipe,
387 cpl_ensure_code(paramname != NULL, cpl_error_get_code());
389 par = cpl_parameter_new_value(paramname, CPL_TYPE_INT, man, context,
393 cpl_ensure_code(par != NULL, cpl_error_get_code());
395 error = cpl_parameter_set_alias(par, CPL_PARAMETER_MODE_CLI,
396 alias ? alias : parameter);
397 cpl_ensure_code(!error, error);
399 error = cpl_parameter_disable(par, CPL_PARAMETER_MODE_ENV);
400 cpl_ensure_code(!error, error);
402 error = cpl_parameterlist_append(
self, par);
403 cpl_ensure_code(!error, error);
405 return CPL_ERROR_NONE;
424 cpl_error_code irplib_parameterlist_set_double(cpl_parameterlist *
self,
425 const char * instrume,
427 const char * parameter,
430 const char * context,
434 cpl_error_code error;
436 char * paramname = cpl_sprintf(
"%s.%s.%s", instrume, recipe,
439 cpl_ensure_code(paramname != NULL, cpl_error_get_code());
441 par = cpl_parameter_new_value(paramname, CPL_TYPE_DOUBLE, man, context,
445 cpl_ensure_code(par != NULL, cpl_error_get_code());
447 error = cpl_parameter_set_alias(par, CPL_PARAMETER_MODE_CLI,
448 alias ? alias : parameter);
449 cpl_ensure_code(!error, error);
451 error = cpl_parameter_disable(par, CPL_PARAMETER_MODE_ENV);
452 cpl_ensure_code(!error, error);
454 error = cpl_parameterlist_append(
self, par);
455 cpl_ensure_code(!error, error);
457 return CPL_ERROR_NONE;
476 int irplib_plugin_test(cpl_pluginlist *
self,
size_t nstr,
const char *astr[]) {
480 int (*recipe_create) (cpl_plugin *);
481 int (*recipe_exec ) (cpl_plugin *);
482 int (*recipe_deinit) (cpl_plugin *);
483 cpl_error_code error;
485 cpl_boolean is_debug;
488 is_debug = cpl_msg_get_level() <= CPL_MSG_DEBUG ? CPL_TRUE : CPL_FALSE;
491 stream = is_debug ? stdout : fopen(
"/dev/null",
"a");
493 inistate = cpl_errorstate_get();
495 assert( nstr == 0 || astr != NULL );
497 plugin = cpl_pluginlist_get_first(
self);
499 if (plugin == NULL) {
500 cpl_msg_warning(cpl_func,
"With an empty pluginlist, "
501 "no tests can be made");
505 cpl_plugin_dump(plugin, stream);
507 recipe_create = cpl_plugin_get_init(plugin);
508 cpl_test( recipe_create != NULL);
510 recipe_exec = cpl_plugin_get_exec(plugin);
511 cpl_test( recipe_exec != NULL);
513 recipe_deinit = cpl_plugin_get_deinit(plugin);
514 cpl_test( recipe_deinit != NULL);
517 if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
518 cpl_msg_warning(cpl_func,
"This plugin is not of type recipe, "
519 "cannot test further");
523 if (recipe_create != NULL && recipe_exec != NULL && recipe_deinit != NULL) {
525 cpl_test_zero(recipe_create(plugin));
527 recipe = (cpl_recipe *) plugin;
529 cpl_test_nonnull( recipe->parameters );
531 recipe_parameterlist_set(recipe->parameters);
533 cpl_parameterlist_dump(recipe->parameters, stream);
535 recipe->frames = cpl_frameset_new();
537 if (irplib_plugin_has_sof_from_env(plugin,
"RECIPE_SOF_PATH")) {
539 recipe_sof_test_from_env(plugin);
543 const cpl_msg_severity msg_level = cpl_msg_get_level();
547 if (getenv(
"CPL_MSG_LEVEL") == NULL) cpl_msg_set_level(CPL_MSG_OFF);
549 cpl_msg_info(cpl_func,
"Checking handling of pre-existing CPL error "
550 "state - may produce warning(s)/error(s):");
551 cpl_error_set(cpl_func, CPL_ERROR_EOL);
553 cpl_test( recipe_exec(plugin) );
555 cpl_test_error( CPL_ERROR_EOL );
557 cpl_msg_info(cpl_func,
"Checking handling of empty frameset - "
558 "may produce warning(s)/error(s):");
560 cpl_test( recipe_exec(plugin) );
561 error = cpl_error_get_code();
563 cpl_test_error( error );
566 cpl_msg_info(cpl_func,
"Checking handling of dummy frameset - "
567 "may produce warning(s)/error(s):");
569 cpl_frame * f = cpl_frame_new();
570 error = cpl_frame_set_filename(f,
"/dev/null");
571 cpl_test_eq_error(error, CPL_ERROR_NONE);
572 error = cpl_frame_set_tag(f,
"RECIPE_DUMMY_TAG");
573 cpl_test_eq_error(error, CPL_ERROR_NONE);
574 error = cpl_frameset_insert(recipe->frames, f);
575 cpl_test_eq_error(error, CPL_ERROR_NONE);
578 cpl_test( recipe_exec(plugin) );
579 error = cpl_error_get_code();
581 cpl_test_error( error );
584 error = cpl_frameset_erase_frame(recipe->frames, f);
585 cpl_test_eq_error(error, CPL_ERROR_NONE);
589 #ifdef IRPLIB_TEST_RANDOM_SOF
590 recipe_sof_test_devfile(plugin, DEV_RANDOM, nstr, astr);
593 recipe_sof_test_devfile(plugin,
"/dev/null", nstr, astr);
595 recipe_sof_test_devfile(plugin,
".", nstr, astr);
597 recipe_sof_test_image_empty(plugin, nstr, astr);
599 recipe_sof_test_local(plugin);
601 cpl_msg_set_level(msg_level);
605 cpl_frameset_delete(recipe->frames);
607 error = recipe_deinit(plugin);
608 cpl_test_eq_error(error, CPL_ERROR_NONE);
611 if (stream != stdout) fclose(stream);
629 static void recipe_parameterlist_set(cpl_parameterlist *
self)
632 cpl_parameter * p = cpl_parameterlist_get_first(
self);
634 for (; p != NULL; p = cpl_parameterlist_get_next(
self)) {
640 if (cpl_parameter_get_default_flag(p))
continue;
642 cpl_msg_debug(cpl_func, __FILE__
" line %u: OK", __LINE__);
644 envvar = cpl_parameter_get_alias(p, CPL_PARAMETER_MODE_ENV);
645 svalue = envvar ? getenv(envvar) : NULL;
647 switch (cpl_parameter_get_type(p)) {
648 case CPL_TYPE_BOOL: {
650 = svalue ? atoi(svalue) : cpl_parameter_get_default_bool(p);
651 cpl_parameter_set_bool(p, value);
656 = svalue ? atoi(svalue) : cpl_parameter_get_default_int(p);
657 cpl_parameter_set_int(p, value);
660 case CPL_TYPE_DOUBLE: {
662 = svalue ? atof(svalue) : cpl_parameter_get_default_double(p);
663 cpl_parameter_set_double(p, value);
666 case CPL_TYPE_STRING:
668 const char * s_default = cpl_parameter_get_default_string(p);
671 = svalue ? svalue : (s_default ? s_default :
"");
672 cpl_parameter_set_string(p, value);
694 static void recipe_sof_test_devfile(cpl_plugin * plugin,
const char * filename,
695 size_t nstr,
const char *astr[])
697 cpl_recipe * recipe = (cpl_recipe*)plugin;
698 int (*recipe_exec) (cpl_plugin *);
700 cpl_error_code error;
704 if (nstr < 1)
return;
705 if (filename == NULL)
return;
707 cpl_msg_info(cpl_func,
"Testing recipe with %u %s as input ",
708 (
unsigned)nstr, filename);
710 for (i = 0; i < nstr; i++) {
711 cpl_frame * f = cpl_frame_new();
713 error = cpl_frame_set_filename(f, filename);
714 cpl_test_eq_error(error, CPL_ERROR_NONE);
716 error = cpl_frame_set_tag(f, astr[i]);
717 cpl_test_eq_error(error, CPL_ERROR_NONE);
719 error = cpl_frameset_insert(recipe->frames, f);
720 cpl_test_eq_error(error, CPL_ERROR_NONE);
723 copy = cpl_frameset_duplicate(recipe->frames);
725 recipe_exec = cpl_plugin_get_exec(plugin);
726 cpl_test( recipe_exec != NULL);
728 if (recipe_exec != NULL) {
731 cpl_test( recipe_exec(plugin) );
732 error = cpl_error_get_code();
734 cpl_test_error( error );
737 recipe_frameset_test_frameset_diff(recipe->frames, copy);
739 recipe_frameset_empty(recipe->frames);
742 cpl_frameset_delete(copy);
755 static void recipe_sof_test_image_empty(cpl_plugin * plugin,
size_t nstr,
758 cpl_recipe * recipe = (cpl_recipe*)plugin;
759 int (*recipe_exec) (cpl_plugin *);
761 cpl_error_code error;
763 const cpl_frame * frame;
768 if (nstr < 1)
return;
770 cpl_msg_info(cpl_func,
"Testing recipe with %u empty images as input ",
773 iempty = cpl_image_new(13, 17, CPL_TYPE_FLOAT);
774 cpl_test_nonnull(iempty);
776 for (i = 0; i < nstr; i++) {
777 cpl_frame * f = cpl_frame_new();
778 char * rawname = cpl_sprintf(
"%s-raw%05u.fits",
779 cpl_plugin_get_name(plugin),
782 error = cpl_image_save(iempty, rawname,CPL_BPP_IEEE_FLOAT, NULL,
784 cpl_test_eq_error(error, CPL_ERROR_NONE);
786 error = cpl_frame_set_filename(f, rawname);
787 cpl_test_eq_error(error, CPL_ERROR_NONE);
789 error = cpl_frame_set_tag(f, astr[i]);
790 cpl_test_eq_error(error, CPL_ERROR_NONE);
792 error = cpl_frameset_insert(recipe->frames, f);
793 cpl_test_eq_error(error, CPL_ERROR_NONE);
797 cpl_image_delete(iempty);
799 copy = cpl_frameset_duplicate(recipe->frames);
801 recipe_exec = cpl_plugin_get_exec(plugin);
802 cpl_test(recipe_exec != NULL);
804 if (recipe_exec != NULL) {
805 cpl_frameset_iterator * iterator = NULL;
810 retstat = recipe_exec(plugin);
811 error = cpl_error_get_code();
814 cpl_test_zero(retstat);
818 cpl_test_error( error );
820 recipe_frameset_test_frameset_diff(recipe->frames, copy);
822 for (frame = irplib_frameset_get_first_const(&iterator, recipe->frames);
824 frame = irplib_frameset_get_next_const(iterator))
826 cpl_test_zero(
remove(cpl_frame_get_filename(frame)) );
828 cpl_frameset_iterator_delete(iterator);
830 recipe_frameset_empty(recipe->frames);
833 cpl_frameset_delete(copy);
848 cpl_boolean irplib_plugin_has_sof_from_env(
const cpl_plugin * plugin,
849 const char * envname)
851 const char * recipename = cpl_plugin_get_name(plugin);
852 const char * sof_path = envname ? getenv(envname) : NULL;
853 cpl_frameset * frames;
855 const cpl_frame * ffirst;
857 cpl_ensure(plugin != NULL, CPL_ERROR_NULL_INPUT, CPL_FALSE);
858 cpl_ensure(envname != NULL, CPL_ERROR_NULL_INPUT, CPL_FALSE);
859 cpl_ensure(recipename != NULL, CPL_ERROR_DATA_NOT_FOUND, CPL_FALSE);
860 cpl_ensure(!cpl_error_get_code(), cpl_error_get_code(), CPL_FALSE);
862 if (sof_path == NULL)
return CPL_FALSE;
864 sof_name = cpl_sprintf(
"%s/%s.sof", sof_path, recipename);
866 frames = cpl_frameset_new();
867 recipe_frameset_load(frames, sof_name);
869 ffirst = cpl_frameset_get_position_const(frames, 0);
872 cpl_frameset_delete(frames);
874 cpl_ensure(!cpl_error_get_code(), cpl_error_get_code(), CPL_FALSE);
876 return ffirst ? CPL_TRUE : CPL_FALSE;
888 static void recipe_sof_test_from_env(cpl_plugin * plugin)
890 cpl_recipe * recipe = (cpl_recipe*)plugin;
891 const char * recipename = cpl_plugin_get_name(plugin);
892 const char * var_name =
"RECIPE_SOF_PATH";
893 const char * sof_path = getenv(var_name);
894 cpl_error_code error;
898 if (sof_path == NULL) {
899 cpl_msg_warning(cpl_func,
"Environment variable %s is unset: "
900 "No SOFs to check", var_name);
904 cpl_msg_debug(cpl_func,
"Checking for SOFs in %s", sof_path);
906 cpl_test_nonnull( recipename );
907 if (recipename == NULL)
return;
909 sof_name = cpl_sprintf(
"%s/%s.sof", sof_path, recipename);
911 cpl_msg_debug(cpl_func,
"Checking for SOF %s", sof_name);
913 recipe_frameset_load(recipe->frames, sof_name);
915 if (!cpl_frameset_is_empty(recipe->frames)) {
917 int (*recipe_exec ) (cpl_plugin *);
918 cpl_frameset * copy = cpl_frameset_duplicate(recipe->frames);
920 recipe_exec = cpl_plugin_get_exec(plugin);
921 cpl_test(recipe_exec != NULL);
923 if (recipe_exec != NULL) {
924 cpl_msg_info(cpl_func,
"Checking handling of SOF: %s", sof_name);
927 cpl_test_zero( recipe_exec(plugin) );
929 cpl_test_error(CPL_ERROR_NONE);
931 error = cpl_dfs_update_product_header(recipe->frames);
932 cpl_test_eq_error(error, CPL_ERROR_NONE);
934 recipe_frameset_test_frameset_diff(recipe->frames, copy);
936 recipe_frameset_empty(recipe->frames);
939 cpl_frameset_delete(copy);
958 static void recipe_sof_test_local(cpl_plugin * plugin)
960 cpl_recipe * recipe = (cpl_recipe*)plugin;
961 const char * recipename = cpl_plugin_get_name(plugin);
962 cpl_error_code error;
963 char * sof_name = cpl_sprintf(
"%s.sof", recipename);
965 cpl_msg_debug(cpl_func,
"Checking for SOF %s", sof_name);
967 recipe_frameset_load(recipe->frames, sof_name);
969 if (!cpl_frameset_is_empty(recipe->frames)) {
971 int (*recipe_exec ) (cpl_plugin *);
972 cpl_frameset * copy = cpl_frameset_duplicate(recipe->frames);
974 recipe_exec = cpl_plugin_get_exec(plugin);
975 cpl_test(recipe_exec != NULL);
977 if (recipe_exec != NULL) {
979 cpl_msg_info(cpl_func,
"Checking handling of SOF: %s", sof_name);
982 cpl_test_zero( recipe_exec(plugin) );
984 cpl_test_error(CPL_ERROR_NONE);
986 error = cpl_dfs_update_product_header(recipe->frames);
987 cpl_test_eq_error( error, CPL_ERROR_NONE );
989 recipe_frameset_test_frameset_diff(recipe->frames, copy);
991 recipe_frameset_empty(recipe->frames);
994 cpl_frameset_delete(copy);
1021 static void recipe_frameset_load(cpl_frameset * set,
const char *name)
1025 char line[LINE_LEN_MAX];
1026 char path[LINE_LEN_MAX], group[LINE_LEN_MAX], tag[LINE_LEN_MAX];
1029 assert( set != NULL );
1030 assert( name != NULL );
1032 fp = fopen(name,
"r");
1034 cpl_msg_debug(cpl_func,
"Unable to open SOF file '%s'", name);
1039 for (line_number = 0; fgets(line, LINE_LEN_MAX - 1, fp); line_number++) {
1042 cpl_frame_group grp;
1046 if (line[0] ==
'#')
continue;
1048 snprintf(scan_fmt, 49,
"%%%ds %%%ds %%%ds", LINE_LEN_MAX - 1,
1049 LINE_LEN_MAX - 1, LINE_LEN_MAX - 1);
1050 n = sscanf(line, scan_fmt, path, tag, group);
1053 cpl_msg_warning(cpl_func,
"Spurious line no. %d in %s: %s",
1054 line_number, name, line);
1059 frame = cpl_frame_new();
1062 cpl_frame_set_filename(frame, path);
1065 cpl_frame_set_tag(frame, n == 1 ?
"" : tag);
1067 cpl_frameset_insert(set, frame);
1070 if (n < 3)
continue;
1072 if (!strcmp(group, CPL_FRAME_GROUP_RAW_ID))
1073 grp = CPL_FRAME_GROUP_RAW;
1074 else if (!strcmp(group, CPL_FRAME_GROUP_CALIB_ID))
1075 grp = CPL_FRAME_GROUP_CALIB;
1076 else if (!strcmp(group, CPL_FRAME_GROUP_PRODUCT_ID))
1077 grp = CPL_FRAME_GROUP_PRODUCT;
1079 grp = CPL_FRAME_GROUP_NONE;
1081 cpl_frame_set_group(frame, grp);
1103 const cpl_parameter * irplib_parameterlist_get(
const cpl_parameterlist *
self,
1104 const char * instrume,
1105 const char * recipe,
1106 const char * parameter)
1110 const cpl_parameter * par;
1113 cpl_ensure(instrume != NULL, CPL_ERROR_NULL_INPUT, NULL);
1114 cpl_ensure(recipe != NULL, CPL_ERROR_NULL_INPUT, NULL);
1115 cpl_ensure(parameter != NULL, CPL_ERROR_NULL_INPUT, NULL);
1117 paramname = cpl_sprintf(
"%s.%s.%s", instrume, recipe, parameter);
1119 par = cpl_parameterlist_find_const(
self, paramname);
1121 if (par == NULL) (void)cpl_error_set_message(cpl_func,
1122 cpl_error_get_code()
1123 ? cpl_error_get_code()
1124 : CPL_ERROR_DATA_NOT_FOUND,
1127 cpl_free(paramname);
1161 static void recipe_frameset_empty(cpl_frameset *
self)
1166 cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT);
1170 n = cpl_frameset_get_size(
self);
1171 for (i = 0; i < n; ++i)
1173 cpl_frame * f = cpl_frameset_get_position(
self, n-1-i);
1174 cpl_frameset_erase_frame(
self, f);
1200 static void recipe_frameset_test_frame(
const cpl_frame *
self)
1203 cpl_msg_info(cpl_func,
"Validating new frame: %s",
1204 cpl_frame_get_filename(
self));
1206 cpl_test_nonnull(
self);
1209 cpl_test_nonnull(cpl_frame_get_tag(
self));
1212 cpl_test_eq(cpl_frame_get_group(
self), CPL_FRAME_GROUP_PRODUCT);
1214 if (cpl_frame_get_type(
self) != CPL_FRAME_TYPE_PAF) {
1216 cpl_test_fits(cpl_frame_get_filename(
self));
1219 cpl_test_nonnull(cpl_frame_get_filename(
self));
1245 static void recipe_frameset_test_frameset_diff(
const cpl_frameset *
self,
1246 const cpl_frameset * other)
1249 cpl_frameset_iterator * it1 = NULL;
1250 cpl_frameset_iterator * it2 = NULL;
1251 const cpl_frame * frame = irplib_frameset_get_first_const(&it2, other);
1254 for (;frame != NULL; frame = irplib_frameset_get_next_const(it2)) {
1255 const char * file = cpl_frame_get_filename(frame);
1258 cpl_test_nonnull(cpl_frame_get_filename(frame));
1262 cpl_frameset_iterator_delete(it2);
1264 if (frame != NULL)
return;
1266 frame = irplib_frameset_get_first_const(&it1,
self);
1268 for (;frame != NULL; frame = irplib_frameset_get_next_const(it1)) {
1269 const cpl_frame * cmp;
1270 const char * file = cpl_frame_get_filename(frame);
1273 cpl_test_nonnull(cpl_frame_get_filename(frame));
1277 cmp = irplib_frameset_get_first_const(&it2, other);
1278 for (;cmp != NULL; cmp = irplib_frameset_get_next_const(it2)) {
1279 const char * cfile = cpl_frame_get_filename(cmp);
1281 if (!strcmp(file, cfile))
break;
1284 cpl_frameset_iterator_delete(it2);
1289 cpl_test_eq(cpl_frame_get_group(frame), CPL_FRAME_GROUP_PRODUCT);
1290 recipe_frameset_test_frame(frame);
1294 cpl_frameset_iterator_delete(it1);