/* $Id: cpl_recipeconfig-test.c,v 1.4 2007/07/16 14:20:09 rpalsa Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2006 European Southern Observatory * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* * $Author: rpalsa $ * $Date: 2007/07/16 14:20:09 $ * $Revision: 1.4 $ * $Name: $ */ #undef CX_DISABLE_ASSERT #undef CX_LOG_DOMAIN #include #include #include #include #include "cpl_init.h" #include "cpl_recipeconfig.h" int main(void) { cxchar** tags = NULL; cxint status = 0; cpl_recipeconfig* config = NULL; const cpl_framedata frames[] = { {"frameA", 1, 5}, {"frameB", 0, -1}, {NULL, 0, 0} }; const cpl_framedata _frames[] = { {"frameA", 1, 5}, {"frameB", 0, -1}, {NULL, 0, 0} }; const cpl_framedata inputs[] = { {"inputA", 1, -1}, {"inputB", 0, -1}, {"inputC", -1, -1}, {NULL, 0, 0} }; const cpl_framedata _inputs[] = { {"inputD", 0, 3}, {"inputE", 1, 1}, {"inputF", 1, -1}, {NULL, 0, 0} }; const cxchar* outputs[] = {"outputA", "outputB", "outputC", NULL}; const cpl_framedata bad[] = { {"", 1, 3}, {NULL, 0, 0} }; const cxchar* _bad[] = {"outputA", "", "outputC", NULL}; cpl_init(CPL_INIT_DEFAULT); /* * Test 1: Create a recipe configuration object, check its * validity and destroy it again. */ config = cpl_recipeconfig_new(); cx_assert(config != NULL); tags = cpl_recipeconfig_get_tags(config); cx_assert(tags != NULL); cx_assert(tags[0] == NULL); cx_strfreev((cxchar**)tags); tags = NULL; cpl_recipeconfig_delete(config); config = NULL; /* * Test 2: Create a recipe configuration object, add a configuration * tag check its validity and destroy it again. */ config = cpl_recipeconfig_new(); cx_assert(config != NULL); status = cpl_recipeconfig_set_tag(config, frames[0].tag, 1, -1); cx_assert(status == 0); tags = cpl_recipeconfig_get_tags(config); cx_assert(tags != NULL); cx_assert(strcmp(tags[0], frames[0].tag) == 0); cx_assert(tags[1] == NULL); cx_assert(cpl_recipeconfig_get_min_count(config, frames[0].tag, frames[0].tag) == 1); cx_assert(cpl_recipeconfig_get_max_count(config, frames[0].tag, frames[0].tag) == -1); cx_assert(cpl_recipeconfig_is_required(config, frames[0].tag, frames[0].tag) == 1); cx_strfreev((cxchar**)tags); tags = NULL; cpl_recipeconfig_delete(config); config = NULL; /* * Test 3: Create a recipe configuration object, add a configuration * tag, clear it and destroy it again. */ config = cpl_recipeconfig_new(); cx_assert(config != NULL); status = cpl_recipeconfig_set_tag(config, frames[0].tag, 1, -1); cx_assert(status == 0); cpl_recipeconfig_clear(config); tags = cpl_recipeconfig_get_tags(config); cx_assert(tags != NULL); cx_assert(tags[0] == NULL); cx_strfreev((cxchar**)tags); tags = NULL; cpl_recipeconfig_delete(config); config = NULL; /* * Test 4: Create a recipe configuration object, add a configuration * tag, an input configuration, and an output configuration. * Verify the object and destroy it again. */ config = cpl_recipeconfig_new(); cx_assert(config != NULL); status = cpl_recipeconfig_set_tag(config, frames[0].tag, 1, -1); cx_assert(status == 0); status = cpl_recipeconfig_set_input(config, frames[0].tag, inputs[0].tag, 2, 5); cx_assert(status == 0); status = cpl_recipeconfig_set_input(config, frames[0].tag, inputs[1].tag, 0, -1); cx_assert(status == 0); status = cpl_recipeconfig_set_output(config, frames[0].tag, outputs[0]); cx_assert(status == 0); status = cpl_recipeconfig_set_output(config, frames[0].tag, outputs[1]); cx_assert(status == 0); status = cpl_recipeconfig_set_output(config, frames[0].tag, outputs[2]); cx_assert(status == 0); tags = cpl_recipeconfig_get_inputs(config, frames[0].tag); cx_assert(tags != NULL); cx_assert(strcmp(tags[0], inputs[0].tag) == 0); cx_assert(cpl_recipeconfig_get_min_count(config, frames[0].tag, inputs[0].tag) == 2); cx_assert(cpl_recipeconfig_get_max_count(config, frames[0].tag, inputs[0].tag) == 5); cx_assert(cpl_recipeconfig_is_required(config, frames[0].tag, inputs[0].tag) == 1); cx_assert(strcmp(tags[1], inputs[1].tag) == 0); cx_assert(cpl_recipeconfig_get_min_count(config, frames[0].tag, inputs[1].tag) == 0); cx_assert(cpl_recipeconfig_get_max_count(config, frames[0].tag, inputs[1].tag) == -1); cx_assert(cpl_recipeconfig_is_required(config, frames[0].tag, inputs[1].tag) == 0); cx_strfreev((cxchar**)tags); tags = NULL; tags = cpl_recipeconfig_get_outputs(config, frames[0].tag); cx_assert(tags != NULL); cx_assert(strcmp(tags[0], outputs[0]) == 0); cx_assert(strcmp(tags[1], outputs[1]) == 0); cx_assert(strcmp(tags[2], outputs[2]) == 0); cx_strfreev((cxchar**)tags); tags = NULL; cpl_recipeconfig_delete(config); config = NULL; /* * Test 5: Create a recipe configuration object, add a configuration * tag, and check that adding the same tag propertly replaces * the previous settings. */ config = cpl_recipeconfig_new(); cx_assert(config != NULL); status = cpl_recipeconfig_set_tag(config, frames[0].tag, 1, -1); cx_assert(status == 0); cx_assert(cpl_recipeconfig_get_min_count(config, frames[0].tag, frames[0].tag) == 1); cx_assert(cpl_recipeconfig_get_max_count(config, frames[0].tag, frames[0].tag) == -1); cx_assert(cpl_recipeconfig_is_required(config, frames[0].tag, frames[0].tag) == 1); status = cpl_recipeconfig_set_input(config, frames[0].tag, inputs[0].tag, 0, 5); cx_assert(status == 0); cx_assert(cpl_recipeconfig_get_min_count(config, frames[0].tag, inputs[0].tag) == 0); cx_assert(cpl_recipeconfig_get_max_count(config, frames[0].tag, inputs[0].tag) == 5); cx_assert(cpl_recipeconfig_is_required(config, frames[0].tag, inputs[0].tag) == 0); status = cpl_recipeconfig_set_tag(config, frames[0].tag, 2, 5); cx_assert(status == 0); cx_assert(cpl_recipeconfig_get_min_count(config, frames[0].tag, frames[0].tag) == 2); cx_assert(cpl_recipeconfig_get_max_count(config, frames[0].tag, frames[0].tag) == 5); cx_assert(cpl_recipeconfig_is_required(config, frames[0].tag, frames[0].tag) == 1); status = cpl_recipeconfig_set_input(config, frames[0].tag, inputs[0].tag, 1, -1); cx_assert(status == 0); cx_assert(cpl_recipeconfig_get_min_count(config, frames[0].tag, inputs[0].tag) == 1); cx_assert(cpl_recipeconfig_get_max_count(config, frames[0].tag, inputs[0].tag) == -1); cx_assert(cpl_recipeconfig_is_required(config, frames[0].tag, inputs[0].tag) == 1); cpl_recipeconfig_delete(config); config = NULL; /* * Test 6: Create a recipe configuration object, add multiple * configurations. Check the object. */ config = cpl_recipeconfig_new(); cx_assert(config != NULL); status = cpl_recipeconfig_set_tags(config, frames); cx_assert(status == 0); tags = cpl_recipeconfig_get_tags(config); cx_assert(tags != NULL); cx_assert(strcmp(tags[0], frames[0].tag) == 0); cx_assert(strcmp(tags[1], frames[1].tag) == 0); cx_assert(tags[2] == NULL); cx_assert(cpl_recipeconfig_get_min_count(config, frames[0].tag, frames[0].tag) == frames[0].min_count); cx_assert(cpl_recipeconfig_get_max_count(config, frames[0].tag, frames[0].tag) == frames[0].max_count); cx_assert(cpl_recipeconfig_is_required(config, frames[0].tag, frames[0].tag) == (frames[0].min_count > 0)); cx_assert(cpl_recipeconfig_get_min_count(config, frames[1].tag, frames[1].tag) == frames[1].min_count); cx_assert(cpl_recipeconfig_get_max_count(config, frames[1].tag, frames[1].tag) == frames[1].max_count); cx_assert(cpl_recipeconfig_is_required(config, frames[1].tag, frames[1].tag) == (frames[1].min_count > 0)); cx_strfreev((cxchar**)tags); tags = NULL; status = cpl_recipeconfig_set_inputs(config, frames[0].tag, inputs); cx_assert(status == 0); tags = cpl_recipeconfig_get_inputs(config, frames[0].tag); cx_assert(tags != NULL); cx_assert(strcmp(tags[0], inputs[0].tag) == 0); cx_assert(strcmp(tags[1], inputs[1].tag) == 0); cx_assert(strcmp(tags[2], inputs[2].tag) == 0); cx_assert(tags[3] == NULL); cx_strfreev((cxchar**)tags); tags = NULL; status = cpl_recipeconfig_set_outputs(config, frames[0].tag, outputs); cx_assert(status == 0); tags = cpl_recipeconfig_get_outputs(config, frames[0].tag); cx_assert(tags != NULL); cx_assert(strcmp(tags[0], outputs[0]) == 0); cx_assert(strcmp(tags[1], outputs[1]) == 0); cx_assert(strcmp(tags[2], outputs[2]) == 0); cx_assert(tags[3] == NULL); cx_strfreev((cxchar**)tags); tags = NULL; status = cpl_recipeconfig_set_inputs(config, frames[1].tag, _inputs); cx_assert(status == 0); tags = cpl_recipeconfig_get_inputs(config, frames[1].tag); cx_assert(tags != NULL); cx_assert(strcmp(tags[0], _inputs[0].tag) == 0); cx_assert(strcmp(tags[1], _inputs[1].tag) == 0); cx_assert(strcmp(tags[2], _inputs[2].tag) == 0); cx_assert(tags[3] == NULL); cx_strfreev((cxchar**)tags); tags = NULL; status = cpl_recipeconfig_set_outputs(config, frames[1].tag, outputs); cx_assert(status == 0); tags = cpl_recipeconfig_get_outputs(config, frames[1].tag); cx_assert(tags != NULL); cx_assert(strcmp(tags[0], outputs[0]) == 0); cx_assert(strcmp(tags[1], outputs[1]) == 0); cx_assert(strcmp(tags[2], outputs[2]) == 0); cx_assert(tags[3] == NULL); cx_strfreev((cxchar**)tags); tags = NULL; cpl_recipeconfig_delete(config); config = NULL; /* * Test 7: Create a recipe configuration object and check that * input and output configurations cannot be added without * adding the configuration tags before. */ config = cpl_recipeconfig_new(); cx_assert(config != NULL); cpl_error_reset(); status = cpl_recipeconfig_set_input(config, frames[0].tag, inputs[0].tag, -1, -1); cx_assert(status == 1); cx_assert(cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND); cpl_error_reset(); status = cpl_recipeconfig_set_inputs(config, frames[0].tag, inputs); cx_assert(status == 1); cx_assert(cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND); cpl_error_reset(); status = cpl_recipeconfig_set_output(config, frames[0].tag, outputs[0]); cx_assert(status == 1); cx_assert(cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND); cpl_error_reset(); status = cpl_recipeconfig_set_outputs(config, frames[0].tag, outputs); cx_assert(status == 1); cx_assert(cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND); cpl_recipeconfig_delete(config); config = NULL; /* * Test 8: Create a recipe configuration object and check that * a configuration tag cannot be reused as input frame * tag. */ config = cpl_recipeconfig_new(); cx_assert(config != NULL); status = cpl_recipeconfig_set_tag(config, frames[0].tag, -1, -1); cx_assert(status == 0); cpl_error_reset(); status = cpl_recipeconfig_set_input(config, frames[0].tag, frames[0].tag, -1, -1); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_ILLEGAL_INPUT); cpl_recipeconfig_delete(config); config = NULL; /* * Test 9: Check error conditions of the member functions. */ config = cpl_recipeconfig_new(); cx_assert(config != NULL); status = cpl_recipeconfig_set_tag(config, frames[0].tag, -1, -1); cx_assert(status == 0); cpl_error_reset(); tags = cpl_recipeconfig_get_tags(NULL); cx_assert(tags == NULL); cx_assert(cpl_error_get_code() == CPL_ERROR_NULL_INPUT); cpl_error_reset(); tags = cpl_recipeconfig_get_inputs(NULL, frames[0].tag); cx_assert(tags == NULL); cx_assert(cpl_error_get_code() == CPL_ERROR_NULL_INPUT); cpl_error_reset(); tags = cpl_recipeconfig_get_inputs(config, NULL); cx_assert(tags == NULL); cx_assert(cpl_error_get_code() == CPL_ERROR_NULL_INPUT); cpl_error_reset(); tags = cpl_recipeconfig_get_inputs(config, ""); cx_assert(tags == NULL); cx_assert(cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND); cpl_error_reset(); tags = cpl_recipeconfig_get_inputs(config, frames[1].tag); cx_assert(tags == NULL); cx_assert(cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND); cpl_error_reset(); tags = cpl_recipeconfig_get_outputs(NULL, frames[0].tag); cx_assert(tags == NULL); cx_assert(cpl_error_get_code() == CPL_ERROR_NULL_INPUT); cpl_error_reset(); tags = cpl_recipeconfig_get_outputs(config, NULL); cx_assert(tags == NULL); cx_assert(cpl_error_get_code() == CPL_ERROR_NULL_INPUT); cpl_error_reset(); tags = cpl_recipeconfig_get_outputs(config, ""); cx_assert(tags == NULL); cx_assert(cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND); cpl_error_reset(); tags = cpl_recipeconfig_get_outputs(config, frames[1].tag); cx_assert(tags == NULL); cx_assert(cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND); cpl_error_reset(); status = cpl_recipeconfig_get_min_count(NULL, frames[0].tag, inputs[0].tag); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_NULL_INPUT); cpl_error_reset(); status = cpl_recipeconfig_get_min_count(config, NULL, inputs[0].tag); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_NULL_INPUT); cpl_error_reset(); status = cpl_recipeconfig_get_min_count(config, "", inputs[0].tag); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND); cpl_error_reset(); status = cpl_recipeconfig_get_min_count(config, frames[1].tag, inputs[0].tag); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND); cpl_error_reset(); status = cpl_recipeconfig_get_min_count(config, frames[0].tag, NULL); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_NULL_INPUT); cpl_error_reset(); status = cpl_recipeconfig_get_min_count(config, frames[0].tag, ""); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND); cpl_error_reset(); status = cpl_recipeconfig_get_min_count(config, frames[0].tag, inputs[1].tag); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND); cpl_error_reset(); status = cpl_recipeconfig_get_max_count(NULL, frames[0].tag, inputs[0].tag); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_NULL_INPUT); cpl_error_reset(); status = cpl_recipeconfig_get_max_count(config, NULL, inputs[0].tag); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_NULL_INPUT); cpl_error_reset(); status = cpl_recipeconfig_get_max_count(config, "", inputs[0].tag); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND); cpl_error_reset(); status = cpl_recipeconfig_get_max_count(config, frames[1].tag, inputs[0].tag); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND); cpl_error_reset(); status = cpl_recipeconfig_get_max_count(config, frames[0].tag, NULL); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_NULL_INPUT); cpl_error_reset(); status = cpl_recipeconfig_get_max_count(config, frames[0].tag, ""); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND); cpl_error_reset(); status = cpl_recipeconfig_get_max_count(config, frames[0].tag, inputs[1].tag); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND); cpl_error_reset(); status = cpl_recipeconfig_is_required(NULL, frames[0].tag, inputs[0].tag); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_NULL_INPUT); cpl_error_reset(); status = cpl_recipeconfig_is_required(config, NULL, inputs[0].tag); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_NULL_INPUT); cpl_error_reset(); status = cpl_recipeconfig_is_required(config, "", inputs[0].tag); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND); cpl_error_reset(); status = cpl_recipeconfig_is_required(config, frames[1].tag, inputs[0].tag); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND); cpl_error_reset(); status = cpl_recipeconfig_is_required(config, frames[0].tag, NULL); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_NULL_INPUT); cpl_error_reset(); status = cpl_recipeconfig_is_required(config, frames[0].tag, ""); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND); cpl_error_reset(); status = cpl_recipeconfig_is_required(config, frames[0].tag, inputs[1].tag); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND); cpl_error_reset(); status = cpl_recipeconfig_set_tag(NULL, frames[1].tag, -1, -1); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_NULL_INPUT); cpl_error_reset(); status = cpl_recipeconfig_set_tag(config, NULL, -1, -1); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_NULL_INPUT); cpl_error_reset(); status = cpl_recipeconfig_set_tag(config, "", -1, -1); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_ILLEGAL_INPUT); cpl_error_reset(); status = cpl_recipeconfig_set_input(NULL, frames[0].tag, inputs[0].tag, -1, -1); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_NULL_INPUT); cpl_error_reset(); status = cpl_recipeconfig_set_input(config, NULL, inputs[0].tag, -1, -1); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_NULL_INPUT); cpl_error_reset(); status = cpl_recipeconfig_set_input(config, "", inputs[0].tag, -1, -1); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_ILLEGAL_INPUT); cpl_error_reset(); status = cpl_recipeconfig_set_input(config, frames[1].tag, inputs[0].tag, -1, -1); cx_assert(status == 2); cx_assert(cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND); cpl_error_reset(); status = cpl_recipeconfig_set_input(config, frames[0].tag, NULL, -1, -1); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_NULL_INPUT); cpl_error_reset(); status = cpl_recipeconfig_set_input(config, frames[0].tag, "", -1, -1); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_ILLEGAL_INPUT); cpl_error_reset(); status = cpl_recipeconfig_set_input(config, frames[0].tag, frames[0].tag, -1, -1); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_ILLEGAL_INPUT); cpl_error_reset(); status = cpl_recipeconfig_set_output(NULL, frames[0].tag, outputs[0]); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_NULL_INPUT); cpl_error_reset(); status = cpl_recipeconfig_set_output(config, NULL, outputs[0]); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_NULL_INPUT); cpl_error_reset(); status = cpl_recipeconfig_set_output(config, "", outputs[0]); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_ILLEGAL_INPUT); cpl_error_reset(); status = cpl_recipeconfig_set_output(config, frames[0].tag, NULL); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_NULL_INPUT); cpl_error_reset(); status = cpl_recipeconfig_set_output(config, frames[0].tag, ""); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_ILLEGAL_INPUT); cpl_error_reset(); status = cpl_recipeconfig_set_tags(NULL, frames); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_NULL_INPUT); cpl_error_reset(); status = cpl_recipeconfig_set_tags(config, NULL); cx_assert(status == 0); cx_assert(cpl_error_get_code() == CPL_ERROR_NONE); cpl_error_reset(); status = cpl_recipeconfig_set_tags(config, bad); cx_assert(status == 1); cx_assert(cpl_error_get_code() == CPL_ERROR_ILLEGAL_INPUT); cpl_error_reset(); status = cpl_recipeconfig_set_inputs(NULL, frames[0].tag, inputs); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_NULL_INPUT); cpl_error_reset(); status = cpl_recipeconfig_set_inputs(config, NULL, inputs); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_NULL_INPUT); cpl_error_reset(); status = cpl_recipeconfig_set_inputs(config, "", inputs); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_ILLEGAL_INPUT); cpl_error_reset(); status = cpl_recipeconfig_set_inputs(config, frames[1].tag, inputs); cx_assert(status == 2); cx_assert(cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND); cpl_error_reset(); status = cpl_recipeconfig_set_inputs(config, frames[0].tag, NULL); cx_assert(status == 0); cx_assert(cpl_error_get_code() == CPL_ERROR_NONE); cpl_error_reset(); status = cpl_recipeconfig_set_inputs(config, frames[0].tag, bad); cx_assert(status == 3); cx_assert(cpl_error_get_code() == CPL_ERROR_ILLEGAL_INPUT); cpl_error_reset(); status = cpl_recipeconfig_set_outputs(NULL, frames[0].tag, outputs); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_NULL_INPUT); cpl_error_reset(); status = cpl_recipeconfig_set_outputs(config, NULL, outputs); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_NULL_INPUT); cpl_error_reset(); status = cpl_recipeconfig_set_outputs(config, "", outputs); cx_assert(status == -1); cx_assert(cpl_error_get_code() == CPL_ERROR_ILLEGAL_INPUT); cpl_error_reset(); status = cpl_recipeconfig_set_outputs(config, frames[1].tag, outputs); cx_assert(status == 2); cx_assert(cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND); cpl_error_reset(); status = cpl_recipeconfig_set_outputs(config, frames[0].tag, NULL); cx_assert(status == 0); cx_assert(cpl_error_get_code() == CPL_ERROR_NONE); cpl_error_reset(); status = cpl_recipeconfig_set_outputs(config, frames[0].tag, _bad); cx_assert(status == 3); cx_assert(cpl_error_get_code() == CPL_ERROR_ILLEGAL_INPUT); cpl_recipeconfig_delete(config); config = NULL; /* * All tests succeeded */ cpl_end(); return 0; }