irplib_framelist-test.c

00001 /*                                                                            *
00002  *   This file is part of the ESO IRPLIB package                              *
00003  *   Copyright (C) 2004,2005 European Southern Observatory                    *
00004  *                                                                            *
00005  *   This library is free software; you can redistribute it and/or modify     *
00006  *   it under the terms of the GNU General Public License as published by     *
00007  *   the Free Software Foundation; either version 2 of the License, or        *
00008  *   (at your option) any later version.                                      *
00009  *                                                                            *
00010  *   This program is distributed in the hope that it will be useful,          *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of           *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            *
00013  *   GNU General Public License for more details.                             *
00014  *                                                                            *
00015  *   You should have received a copy of the GNU General Public License        *
00016  *   along with this program; if not, write to the Free Software              *
00017  *   Foundation, 51 Franklin St, Fifth Floor, Boston, MA  02111-1307  USA     *
00018  *                                                                            */
00019  
00020 #ifdef HAVE_CONFIG_H
00021 #  include <config.h>
00022 #endif
00023 
00024 /*-----------------------------------------------------------------------------
00025                                 Includes
00026  -----------------------------------------------------------------------------*/
00027 
00028 #include <irplib_framelist.h>
00029 
00030 
00031 /*----------------------------------------------------------------------------*/
00035 /*----------------------------------------------------------------------------*/
00036 
00037 
00038 /*----------------------------------------------------------------------------*/
00042 /*----------------------------------------------------------------------------*/
00043 
00044 int main(void)
00045 {
00046 
00047     irplib_framelist * flist;
00048     irplib_framelist * nulllist;
00049     cpl_frameset     * fset;
00050     cpl_frameset     * nullset;
00051     int i;
00052 
00053     /* Initialize CPL for unit testing */
00054     cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING);
00055 
00056     /* Some NULL tests */
00057 
00058     irplib_framelist_delete(NULL);
00059     cpl_test_error(CPL_ERROR_NONE);
00060 
00061     nulllist = irplib_framelist_cast(NULL);
00062     cpl_test_error(CPL_ERROR_NULL_INPUT);
00063     cpl_test_null(nulllist);
00064 
00065     nullset = irplib_frameset_cast(NULL);
00066     cpl_test_error(CPL_ERROR_NULL_INPUT);
00067     cpl_test_null(nullset);
00068 
00069     irplib_framelist_empty(NULL);
00070     cpl_test_error(CPL_ERROR_NONE);
00071 
00072     i = irplib_framelist_get_size(NULL);
00073     cpl_test_error(CPL_ERROR_NULL_INPUT);
00074     cpl_test_leq(i, -1);
00075 
00076 
00077     /* Some tests on an empty list */
00078     flist = irplib_framelist_new();
00079 
00080     cpl_test_zero(irplib_framelist_get_size(flist));
00081 
00082     irplib_framelist_empty(flist);
00083 
00084     cpl_test_zero(irplib_framelist_get_size(flist));
00085 
00086     fset = irplib_frameset_cast(flist);
00087 
00088     irplib_framelist_delete(flist);
00089 
00090     flist = irplib_framelist_cast(fset);
00091 
00092     cpl_test_zero(irplib_framelist_get_size(flist));
00093 
00094     cpl_frameset_delete(fset);
00095     irplib_framelist_delete(flist);
00096 
00097     return cpl_test_end(0);
00098 }

Generated on Mon Feb 6 14:42:06 2012 for NACO Pipeline Reference Manual by  doxygen 1.5.8