cpl_dfs-test.c | cpl_dfs-test.c | |||
---|---|---|---|---|
/* $Id: cpl_dfs-test.c,v 1.60 2012/02/14 14:38:17 llundin Exp $ | /* $Id: cpl_dfs-test.c,v 1.62 2012/04/05 08:48:50 llundin Exp $ | |||
* | * | |||
* This file is part of the ESO Common Pipeline Library | * This file is part of the ESO Common Pipeline Library | |||
* Copyright (C) 2001-2008 European Southern Observatory | * Copyright (C) 2001-2008 European Southern Observatory | |||
* | * | |||
* This program is free software; you can redistribute it and/or modify | * 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 | * it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation; either version 2 of the License, or | * the Free Software Foundation; either version 2 of the License, or | |||
* (at your option) any later version. | * (at your option) any later version. | |||
* | * | |||
* This program is distributed in the hope that it will be useful, | * This program is distributed in the hope that it will be useful, | |||
skipping to change at line 23 | skipping to change at line 23 | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | * GNU General Public License for more details. | |||
* | * | |||
* You should have received a copy of the GNU General Public License | * You should have received a copy of the GNU General Public License | |||
* along with this program; if not, write to the Free Software | * along with this program; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 U SA | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 U SA | |||
*/ | */ | |||
/* | /* | |||
* $Author: llundin $ | * $Author: llundin $ | |||
* $Date: 2012/02/14 14:38:17 $ | * $Date: 2012/04/05 08:48:50 $ | |||
* $Revision: 1.60 $ | * $Revision: 1.62 $ | |||
* $Name: cpl-6_0 $ | * $Name: cpl-6_1 $ | |||
*/ | */ | |||
/*------------------------------------------------------------------------- ---- | /*------------------------------------------------------------------------- ---- | |||
Includes | Includes | |||
-------------------------------------------------------------------------- ---*/ | -------------------------------------------------------------------------- ---*/ | |||
#ifdef HAVE_CONFIG_H | #ifdef HAVE_CONFIG_H | |||
#include <config.h> | #include <config.h> | |||
#endif | #endif | |||
#include <string.h> | #include <string.h> | |||
#include "cpl_dfs.h" | #include "cpl_dfs.h" | |||
#include "cpl_memory.h" | #include "cpl_memory.h" | |||
#include "cpl_test.h" | #include "cpl_test.h" | |||
#include "cpl_image.h" | #include "cpl_image.h" | |||
#include "cpl_io_fits.h" | ||||
/*------------------------------------------------------------------------- ---- | /*------------------------------------------------------------------------- ---- | |||
Defines | Defines | |||
-------------------------------------------------------------------------- ---*/ | -------------------------------------------------------------------------- ---*/ | |||
#define IMAGE_SIZE_X 1009 | #define IMAGE_SIZE_X 1009 | |||
#define IMAGE_SIZE_Y 1031 | #define IMAGE_SIZE_Y 1031 | |||
#define IMAGE_NEXT 32 | #define IMAGE_NEXT 32 | |||
#define CPL_DFS_RAW_ASCII "ascii.txt" | #define CPL_DFS_RAW_ASCII "ascii.txt" | |||
#define CPL_DFS_FITSFILE "product.fits" | #define CPL_DFS_FITSFILE "product.fits" | |||
skipping to change at line 105 | skipping to change at line 107 | |||
cpl_frame * inhframe; | cpl_frame * inhframe; | |||
cpl_frame * proframe; | cpl_frame * proframe; | |||
cpl_frameset * frameset = NULL; | cpl_frameset * frameset = NULL; | |||
cpl_propertylist * plist = NULL; | cpl_propertylist * plist = NULL; | |||
cpl_parameterlist * parlist = NULL; | cpl_parameterlist * parlist = NULL; | |||
cpl_image * image; | cpl_image * image; | |||
const char * md5sum; | const char * md5sum; | |||
cpl_error_code error; | cpl_error_code error; | |||
const int next = IMAGE_NEXT; | const int next = IMAGE_NEXT; | |||
int fstatus = 0; /* CFITSIO error status */ | ||||
int i; | int i; | |||
/* Test 1: Check the error handling of NULL-pointer(s) */ | /* Test 1: Check the error handling of NULL-pointer(s) */ | |||
error = cpl_dfs_setup_product_header(NULL, NULL, NULL, NULL, | error = cpl_dfs_setup_product_header(NULL, NULL, NULL, NULL, | |||
NULL, NULL, NULL, NULL); | NULL, NULL, NULL, NULL); | |||
cpl_test_eq_error( error, CPL_ERROR_NULL_INPUT); | cpl_test_eq_error( error, CPL_ERROR_NULL_INPUT); | |||
/* Test 1a: Check the error handling of NULL-pointer(s) */ | /* Test 1a: Check the error handling of NULL-pointer(s) */ | |||
error = cpl_dfs_update_product_header(NULL); | error = cpl_dfs_update_product_header(NULL); | |||
skipping to change at line 241 | skipping to change at line 244 | |||
cpl_test_eq_error(error, CPL_ERROR_NONE); | cpl_test_eq_error(error, CPL_ERROR_NONE); | |||
error = cpl_dfs_setup_product_header(plist, proframe, frameset, | error = cpl_dfs_setup_product_header(plist, proframe, frameset, | |||
parlist, "Recipe", "Pipeline", | parlist, "Recipe", "Pipeline", | |||
"PRO-1.15", inhframe); | "PRO-1.15", inhframe); | |||
cpl_test_eq_error(error, CPL_ERROR_NONE); | cpl_test_eq_error(error, CPL_ERROR_NONE); | |||
cpl_msg_debug("","Size of product header: %" CPL_SIZE_FORMAT, | cpl_msg_debug("","Size of product header: %" CPL_SIZE_FORMAT, | |||
cpl_propertylist_get_size(plist)); | cpl_propertylist_get_size(plist)); | |||
cpl_propertylist_append_char(plist, "QC MYCHAR", 42); | cpl_propertylist_append_char(plist, "ESO QC MYCHAR", 42); | |||
cpl_propertylist_set_comment(plist, "QC MYCHAR", "42"); | cpl_propertylist_set_comment(plist, "ESO QC MYCHAR", "42"); | |||
error = cpl_dfs_save_paf("IIINSTRUME", "RRRECIPE", plist, | error = cpl_dfs_save_paf("IIINSTRUME", "RRRECIPE", plist, | |||
"cpl_dfs-test.paf"); | "cpl_dfs-test.paf"); | |||
cpl_test_eq_error(error, CPL_ERROR_NONE); | cpl_test_eq_error(error, CPL_ERROR_NONE); | |||
#if 0 | #if 0 | |||
/* | /* | |||
* FIXME: It fails if inherit_frame is an ASCII file, what is | * FIXME: It fails if inherit_frame is an ASCII file, what is | |||
* allowed for the first frame. See below: rawframe points to the | * allowed for the first frame. See below: rawframe points to the | |||
* first frame in frameset. | * first frame in frameset. | |||
skipping to change at line 280 | skipping to change at line 283 | |||
the frameset, but not present on the filesystem */ | the frameset, but not present on the filesystem */ | |||
error = cpl_dfs_setup_product_header(plist, proframe, frameset, | error = cpl_dfs_setup_product_header(plist, proframe, frameset, | |||
parlist, "Recipe", "Pipeline", | parlist, "Recipe", "Pipeline", | |||
"PRO-1.15", proframe); | "PRO-1.15", proframe); | |||
cpl_test_eq_error( error, CPL_ERROR_FILE_NOT_FOUND); | cpl_test_eq_error( error, CPL_ERROR_FILE_NOT_FOUND); | |||
/* Test 6a: A failure on file format (missing file) */ | /* Test 6a: A failure on file format (missing file) */ | |||
/* Need to close file due to non CPL access */ | ||||
cpl_test_zero(cpl_io_fits_close(CPL_DFS_FITSFILE, &fstatus)); | ||||
cpl_test_zero(fstatus); | ||||
/* Make sure file does not exist (from a previously failed test) */ | /* Make sure file does not exist (from a previously failed test) */ | |||
(void)remove(CPL_DFS_FITSFILE); | (void)remove(CPL_DFS_FITSFILE); | |||
error = cpl_frame_set_type(proframe, CPL_FRAME_TYPE_IMAGE); | error = cpl_frame_set_type(proframe, CPL_FRAME_TYPE_IMAGE); | |||
cpl_test_eq_error(error, CPL_ERROR_NONE); | cpl_test_eq_error(error, CPL_ERROR_NONE); | |||
error = cpl_dfs_update_product_header(frameset); | error = cpl_dfs_update_product_header(frameset); | |||
cpl_test_eq_error( error, CPL_ERROR_BAD_FILE_FORMAT); | cpl_test_eq_error( error, CPL_ERROR_BAD_FILE_FORMAT); | |||
End of changes. 6 change blocks. | ||||
6 lines changed or deleted | 13 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |