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[]) {
479 int (*recipe_create) (cpl_plugin *);
480 int (*recipe_exec ) (cpl_plugin *);
481 int (*recipe_deinit) (cpl_plugin *);
483 cpl_boolean is_debug;
486 is_debug = cpl_msg_get_level() <= CPL_MSG_DEBUG ? CPL_TRUE : CPL_FALSE;
489 stream = is_debug ? stdout : fopen(
"/dev/null",
"a");
491 inistate = cpl_errorstate_get();
493 assert( nstr == 0 || astr != NULL );
495 plugin = cpl_pluginlist_get_first(
self);
497 if (plugin == NULL) {
498 cpl_msg_warning(cpl_func,
"With an empty pluginlist, "
499 "no tests can be made");
503 cpl_plugin_dump(plugin, stream);
505 recipe_create = cpl_plugin_get_init(plugin);
506 cpl_test( recipe_create != NULL);
508 recipe_exec = cpl_plugin_get_exec(plugin);
509 cpl_test( recipe_exec != NULL);
511 recipe_deinit = cpl_plugin_get_deinit(plugin);
512 cpl_test( recipe_deinit != NULL);
515 if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
516 cpl_msg_warning(cpl_func,
"This plugin is not of type recipe, "
517 "cannot test further");
521 if (recipe_create != NULL && recipe_exec != NULL && recipe_deinit != NULL) {
523 cpl_error_code error;
526 cpl_test_zero(recipe_create(plugin));
528 recipe = (cpl_recipe *) plugin;
530 cpl_test_nonnull( recipe->parameters );
532 recipe_parameterlist_set(recipe->parameters);
534 cpl_parameterlist_dump(recipe->parameters, stream);
536 recipe->frames = cpl_frameset_new();
538 if (irplib_plugin_has_sof_from_env(plugin,
"RECIPE_SOF_PATH")) {
540 recipe_sof_test_from_env(plugin);
544 const cpl_msg_severity msg_level = cpl_msg_get_level();
548 if (getenv(
"CPL_MSG_LEVEL") == NULL) cpl_msg_set_level(CPL_MSG_OFF);
550 cpl_msg_info(cpl_func,
"Checking handling of pre-existing CPL error "
551 "state - may produce warning(s)/error(s):");
552 cpl_error_set(cpl_func, CPL_ERROR_EOL);
554 cpl_test( recipe_exec(plugin) );
556 cpl_test_error( CPL_ERROR_EOL );
558 cpl_msg_info(cpl_func,
"Checking handling of empty frameset - "
559 "may produce warning(s)/error(s):");
561 cpl_test( recipe_exec(plugin) );
562 error = cpl_error_get_code();
564 cpl_test_error( error );
567 cpl_msg_info(cpl_func,
"Checking handling of dummy frameset - "
568 "may produce warning(s)/error(s):");
570 cpl_frame * f = cpl_frame_new();
571 error = cpl_frame_set_filename(f,
"/dev/null");
572 cpl_test_eq_error(error, CPL_ERROR_NONE);
573 error = cpl_frame_set_tag(f,
"RECIPE_DUMMY_TAG");
574 cpl_test_eq_error(error, CPL_ERROR_NONE);
575 error = cpl_frameset_insert(recipe->frames, f);
576 cpl_test_eq_error(error, CPL_ERROR_NONE);
579 cpl_test( recipe_exec(plugin) );
580 error = cpl_error_get_code();
582 cpl_test_error( error );
585 error = cpl_frameset_erase_frame(recipe->frames, f);
586 cpl_test_eq_error(error, CPL_ERROR_NONE);
590 #ifdef IRPLIB_TEST_RANDOM_SOF
591 recipe_sof_test_devfile(plugin, DEV_RANDOM, nstr, astr);
594 recipe_sof_test_devfile(plugin,
"/dev/null", nstr, astr);
596 recipe_sof_test_devfile(plugin,
".", nstr, astr);
598 recipe_sof_test_image_empty(plugin, nstr, astr);
600 recipe_sof_test_local(plugin);
602 cpl_msg_set_level(msg_level);
606 cpl_frameset_delete(recipe->frames);
608 error = recipe_deinit(plugin);
609 cpl_test_eq_error(error, CPL_ERROR_NONE);
612 if (stream != stdout) fclose(stream);
630 static void recipe_parameterlist_set(cpl_parameterlist *
self)
633 cpl_parameter * p = cpl_parameterlist_get_first(
self);
635 for (; p != NULL; p = cpl_parameterlist_get_next(
self)) {
641 if (cpl_parameter_get_default_flag(p))
continue;
643 cpl_msg_debug(cpl_func, __FILE__
" line %u: OK", __LINE__);
645 envvar = cpl_parameter_get_alias(p, CPL_PARAMETER_MODE_ENV);
646 svalue = envvar ? getenv(envvar) : NULL;
648 switch (cpl_parameter_get_type(p)) {
649 case CPL_TYPE_BOOL: {
651 = svalue ? atoi(svalue) : cpl_parameter_get_default_bool(p);
652 cpl_parameter_set_bool(p, value);
657 = svalue ? atoi(svalue) : cpl_parameter_get_default_int(p);
658 cpl_parameter_set_int(p, value);
661 case CPL_TYPE_DOUBLE: {
663 = svalue ? atof(svalue) : cpl_parameter_get_default_double(p);
664 cpl_parameter_set_double(p, value);
667 case CPL_TYPE_STRING:
669 const char * s_default = cpl_parameter_get_default_string(p);
672 = svalue ? svalue : (s_default ? s_default :
"");
673 cpl_parameter_set_string(p, value);
695 static void recipe_sof_test_devfile(cpl_plugin * plugin,
const char * filename,
696 size_t nstr,
const char *astr[])
698 cpl_recipe * recipe = (cpl_recipe*)plugin;
699 int (*recipe_exec) (cpl_plugin *);
701 cpl_error_code error;
705 if (nstr < 1)
return;
706 if (filename == NULL)
return;
708 cpl_msg_info(cpl_func,
"Testing recipe with %u %s as input ",
709 (
unsigned)nstr, filename);
711 for (i = 0; i < nstr; i++) {
712 cpl_frame * f = cpl_frame_new();
714 error = cpl_frame_set_filename(f, filename);
715 cpl_test_eq_error(error, CPL_ERROR_NONE);
717 error = cpl_frame_set_tag(f, astr[i]);
718 cpl_test_eq_error(error, CPL_ERROR_NONE);
720 error = cpl_frameset_insert(recipe->frames, f);
721 cpl_test_eq_error(error, CPL_ERROR_NONE);
724 copy = cpl_frameset_duplicate(recipe->frames);
726 recipe_exec = cpl_plugin_get_exec(plugin);
727 cpl_test( recipe_exec != NULL);
729 if (recipe_exec != NULL) {
732 cpl_test( recipe_exec(plugin) );
733 error = cpl_error_get_code();
735 cpl_test_error( error );
738 recipe_frameset_test_frameset_diff(recipe->frames, copy);
740 recipe_frameset_empty(recipe->frames);
743 cpl_frameset_delete(copy);
756 static void recipe_sof_test_image_empty(cpl_plugin * plugin,
size_t nstr,
759 cpl_recipe * recipe = (cpl_recipe*)plugin;
760 int (*recipe_exec) (cpl_plugin *);
762 cpl_error_code error;
767 if (nstr < 1)
return;
769 cpl_msg_info(cpl_func,
"Testing recipe with %u empty images as input ",
772 iempty = cpl_image_new(13, 17, CPL_TYPE_FLOAT);
773 cpl_test_nonnull(iempty);
775 for (i = 0; i < nstr; i++) {
776 cpl_frame * f = cpl_frame_new();
777 char * rawname = cpl_sprintf(
"%s-raw%05u.fits",
778 cpl_plugin_get_name(plugin),
781 error = cpl_image_save(iempty, rawname,CPL_BPP_IEEE_FLOAT, NULL,
783 cpl_test_eq_error(error, CPL_ERROR_NONE);
785 error = cpl_frame_set_filename(f, rawname);
786 cpl_test_eq_error(error, CPL_ERROR_NONE);
788 error = cpl_frame_set_tag(f, astr[i]);
789 cpl_test_eq_error(error, CPL_ERROR_NONE);
791 error = cpl_frameset_insert(recipe->frames, f);
792 cpl_test_eq_error(error, CPL_ERROR_NONE);
796 cpl_image_delete(iempty);
798 copy = cpl_frameset_duplicate(recipe->frames);
800 recipe_exec = cpl_plugin_get_exec(plugin);
801 cpl_test(recipe_exec != NULL);
803 if (recipe_exec != NULL) {
804 const cpl_frame * frame;
805 cpl_frameset_iterator * iterator = NULL;
811 retstat = recipe_exec(plugin);
812 error = cpl_error_get_code();
815 cpl_test_zero(retstat);
819 cpl_test_error( error );
821 recipe_frameset_test_frameset_diff(recipe->frames, copy);
823 for (frame = irplib_frameset_get_first_const(&iterator, recipe->frames);
825 frame = irplib_frameset_get_next_const(iterator))
827 cpl_test_zero(
remove(cpl_frame_get_filename(frame)) );
829 cpl_frameset_iterator_delete(iterator);
831 recipe_frameset_empty(recipe->frames);
834 cpl_frameset_delete(copy);
849 cpl_boolean irplib_plugin_has_sof_from_env(
const cpl_plugin * plugin,
850 const char * envname)
852 const char * recipename = cpl_plugin_get_name(plugin);
853 const char * sof_path = envname ? getenv(envname) : NULL;
854 cpl_frameset * frames;
856 const cpl_frame * ffirst;
858 cpl_ensure(plugin != NULL, CPL_ERROR_NULL_INPUT, CPL_FALSE);
859 cpl_ensure(envname != NULL, CPL_ERROR_NULL_INPUT, CPL_FALSE);
860 cpl_ensure(recipename != NULL, CPL_ERROR_DATA_NOT_FOUND, CPL_FALSE);
861 cpl_ensure(!cpl_error_get_code(), cpl_error_get_code(), CPL_FALSE);
863 if (sof_path == NULL)
return CPL_FALSE;
865 sof_name = cpl_sprintf(
"%s/%s.sof", sof_path, recipename);
867 frames = cpl_frameset_new();
868 recipe_frameset_load(frames, sof_name);
870 ffirst = cpl_frameset_get_position_const(frames, 0);
873 cpl_frameset_delete(frames);
875 cpl_ensure(!cpl_error_get_code(), cpl_error_get_code(), CPL_FALSE);
877 return ffirst ? CPL_TRUE : CPL_FALSE;
889 static void recipe_sof_test_from_env(cpl_plugin * plugin)
891 cpl_recipe * recipe = (cpl_recipe*)plugin;
892 const char * recipename = cpl_plugin_get_name(plugin);
893 const char * var_name =
"RECIPE_SOF_PATH";
894 const char * sof_path = getenv(var_name);
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_error_code error;
925 cpl_msg_info(cpl_func,
"Checking handling of SOF: %s", sof_name);
928 cpl_test_zero( recipe_exec(plugin) );
930 cpl_test_error(CPL_ERROR_NONE);
932 error = cpl_dfs_update_product_header(recipe->frames);
933 cpl_test_eq_error(error, CPL_ERROR_NONE);
935 recipe_frameset_test_frameset_diff(recipe->frames, copy);
937 recipe_frameset_empty(recipe->frames);
940 cpl_frameset_delete(copy);
959 static void recipe_sof_test_local(cpl_plugin * plugin)
961 cpl_recipe * recipe = (cpl_recipe*)plugin;
962 const char * recipename = cpl_plugin_get_name(plugin);
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) {
978 cpl_error_code error;
980 cpl_msg_info(cpl_func,
"Checking handling of SOF: %s", sof_name);
983 cpl_test_zero( recipe_exec(plugin) );
985 cpl_test_error(CPL_ERROR_NONE);
987 error = cpl_dfs_update_product_header(recipe->frames);
988 cpl_test_eq_error( error, CPL_ERROR_NONE );
990 recipe_frameset_test_frameset_diff(recipe->frames, copy);
992 recipe_frameset_empty(recipe->frames);
995 cpl_frameset_delete(copy);
1022 static void recipe_frameset_load(cpl_frameset * set,
const char *name)
1026 char line[LINE_LEN_MAX];
1027 char path[LINE_LEN_MAX], group[LINE_LEN_MAX], tag[LINE_LEN_MAX];
1030 assert( set != NULL );
1031 assert( name != NULL );
1033 fp = fopen(name,
"r");
1035 cpl_msg_debug(cpl_func,
"Unable to open SOF file '%s'", name);
1040 for (line_number = 0; fgets(line, LINE_LEN_MAX - 1, fp); line_number++) {
1043 cpl_frame_group grp;
1047 if (line[0] ==
'#')
continue;
1049 snprintf(scan_fmt, 49,
"%%%ds %%%ds %%%ds", LINE_LEN_MAX - 1,
1050 LINE_LEN_MAX - 1, LINE_LEN_MAX - 1);
1051 n = sscanf(line, scan_fmt, path, tag, group);
1054 cpl_msg_warning(cpl_func,
"Spurious line no. %d in %s: %s",
1055 line_number, name, line);
1060 frame = cpl_frame_new();
1063 cpl_frame_set_filename(frame, path);
1066 cpl_frame_set_tag(frame, n == 1 ?
"" : tag);
1068 cpl_frameset_insert(set, frame);
1071 if (n < 3)
continue;
1073 if (!strcmp(group, CPL_FRAME_GROUP_RAW_ID))
1074 grp = CPL_FRAME_GROUP_RAW;
1075 else if (!strcmp(group, CPL_FRAME_GROUP_CALIB_ID))
1076 grp = CPL_FRAME_GROUP_CALIB;
1077 else if (!strcmp(group, CPL_FRAME_GROUP_PRODUCT_ID))
1078 grp = CPL_FRAME_GROUP_PRODUCT;
1080 grp = CPL_FRAME_GROUP_NONE;
1082 cpl_frame_set_group(frame, grp);
1104 const cpl_parameter * irplib_parameterlist_get(
const cpl_parameterlist *
self,
1105 const char * instrume,
1106 const char * recipe,
1107 const char * parameter)
1111 const cpl_parameter * par;
1114 cpl_ensure(instrume != NULL, CPL_ERROR_NULL_INPUT, NULL);
1115 cpl_ensure(recipe != NULL, CPL_ERROR_NULL_INPUT, NULL);
1116 cpl_ensure(parameter != NULL, CPL_ERROR_NULL_INPUT, NULL);
1118 paramname = cpl_sprintf(
"%s.%s.%s", instrume, recipe, parameter);
1120 par = cpl_parameterlist_find_const(
self, paramname);
1122 if (par == NULL) (void)cpl_error_set_message(cpl_func,
1123 cpl_error_get_code()
1124 ? cpl_error_get_code()
1125 : CPL_ERROR_DATA_NOT_FOUND,
1128 cpl_free(paramname);
1162 static void recipe_frameset_empty(cpl_frameset *
self)
1167 cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT);
1171 n = cpl_frameset_get_size(
self);
1172 for (i = 0; i < n; ++i)
1174 cpl_frame * f = cpl_frameset_get_position(
self, n-1-i);
1175 cpl_frameset_erase_frame(
self, f);
1201 static void recipe_frameset_test_frame(
const cpl_frame *
self)
1204 cpl_msg_info(cpl_func,
"Validating new frame: %s",
1205 cpl_frame_get_filename(
self));
1207 cpl_test_nonnull(
self);
1210 cpl_test_nonnull(cpl_frame_get_tag(
self));
1213 cpl_test_eq(cpl_frame_get_group(
self), CPL_FRAME_GROUP_PRODUCT);
1215 if (cpl_frame_get_type(
self) != CPL_FRAME_TYPE_PAF) {
1217 cpl_test_fits(cpl_frame_get_filename(
self));
1220 cpl_test_nonnull(cpl_frame_get_filename(
self));
1246 static void recipe_frameset_test_frameset_diff(
const cpl_frameset *
self,
1247 const cpl_frameset * other)
1250 cpl_frameset_iterator * it1 = NULL;
1251 cpl_frameset_iterator * it2 = NULL;
1252 const cpl_frame * frame = irplib_frameset_get_first_const(&it2, other);
1255 for (;frame != NULL; frame = irplib_frameset_get_next_const(it2)) {
1256 const char * file = cpl_frame_get_filename(frame);
1259 cpl_test_nonnull(cpl_frame_get_filename(frame));
1263 cpl_frameset_iterator_delete(it2);
1265 if (frame != NULL)
return;
1267 frame = irplib_frameset_get_first_const(&it1,
self);
1269 for (;frame != NULL; frame = irplib_frameset_get_next_const(it1)) {
1270 const cpl_frame * cmp;
1271 const char * file = cpl_frame_get_filename(frame);
1274 cpl_test_nonnull(cpl_frame_get_filename(frame));
1278 cmp = irplib_frameset_get_first_const(&it2, other);
1279 for (;cmp != NULL; cmp = irplib_frameset_get_next_const(it2)) {
1280 const char * cfile = cpl_frame_get_filename(cmp);
1282 if (!strcmp(file, cfile))
break;
1285 cpl_frameset_iterator_delete(it2);
1290 cpl_test_eq(cpl_frame_get_group(frame), CPL_FRAME_GROUP_PRODUCT);
1291 recipe_frameset_test_frame(frame);
1295 cpl_frameset_iterator_delete(it1);