CR2RE Pipeline Reference Manual 1.6.7
irplib_framelist-test.c
1/* *
2 * This file is part of the ESO IRPLIB package *
3 * Copyright (C) 2004,2005 European Southern Observatory *
4 * *
5 * This library is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the Free Software *
17 * Foundation, 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA *
18 * */
19
20#ifdef HAVE_CONFIG_H
21# include <config.h>
22#endif
23
24/*-----------------------------------------------------------------------------
25 Includes
26 -----------------------------------------------------------------------------*/
27
28#include <irplib_framelist.h>
29
30
31/*----------------------------------------------------------------------------*/
35/*----------------------------------------------------------------------------*/
36
37
38/*----------------------------------------------------------------------------*/
42/*----------------------------------------------------------------------------*/
43
44int main(void)
45{
46
47 irplib_framelist * flist;
48 irplib_framelist * nulllist;
49 cpl_frame * frm;
50 cpl_frameset * fset;
51 cpl_frameset * nullset;
52 int i;
53
54 /* Initialize CPL for unit testing */
55 cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING);
56
57 /* Some NULL tests */
58
60 cpl_test_error(CPL_ERROR_NONE);
61
62 nulllist = irplib_framelist_cast(NULL);
63 cpl_test_error(CPL_ERROR_NULL_INPUT);
64 cpl_test_null(nulllist);
65
66 nullset = irplib_frameset_cast(NULL);
67 cpl_test_error(CPL_ERROR_NULL_INPUT);
68 cpl_test_null(nullset);
69
71 cpl_test_error(CPL_ERROR_NONE);
72
74 cpl_test_error(CPL_ERROR_NULL_INPUT);
75 cpl_test_leq(i, -1);
76
77
78 /* Some tests on an empty list */
79 flist = irplib_framelist_new();
80
81 cpl_test_zero(irplib_framelist_get_size(flist));
82
84
85 cpl_test_zero(irplib_framelist_get_size(flist));
86
87 fset = irplib_frameset_cast(flist);
88
90
91 flist = irplib_framelist_cast(fset);
92
93 cpl_test_zero(irplib_framelist_get_size(flist));
94
96
97 frm = cpl_frame_new();
98 cpl_frame_set_filename(frm, "test.fits");
99 cpl_frame_set_tag(frm, "TEST");
100 cpl_frameset_insert(fset, frm);
101
102 flist = irplib_framelist_cast(fset);
103
104 cpl_test_eq(irplib_framelist_get_size(flist), 1);
105
107
108 cpl_frameset_insert(fset, cpl_frame_duplicate(frm));
109 flist = irplib_framelist_cast(fset);
110
111 cpl_test_eq(irplib_framelist_get_size(flist), 2);
112
113 cpl_frameset_delete(fset);
115
116 return cpl_test_end(0);
117}
int irplib_framelist_get_size(const irplib_framelist *self)
Get the size of a framelist.
cpl_frameset * irplib_frameset_cast(const irplib_framelist *self)
Create a CPL frameset from an irplib_framelist.
irplib_framelist * irplib_framelist_cast(const cpl_frameset *frameset)
Create an irplib_framelist from a cpl_framelist.
void irplib_framelist_delete(irplib_framelist *self)
Deallocate an irplib_framelist with its frames and properties.
void irplib_framelist_empty(irplib_framelist *self)
Erase all frames from a framelist.
irplib_framelist * irplib_framelist_new(void)
Create an empty framelist.