CR2RE Pipeline Reference Manual 1.7.0
hdrl_cat_apio-test.c
1/*
2 * This file is part of the HDRL
3 * Copyright (C) 2017 European Southern Observatory
4 *
5 * This program 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, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#ifdef HAVE_CONFIG_H
21#include "config.h"
22#endif
23
24#include <cpl_test.h>
25
26#include "../hdrl_cat_apio.h"
27
28
29int main(void)
30{
31 cpl_test_init(PACKAGE_BUGREPORT,CPL_MSG_WARNING);
32
33 /* Create an input apm structure */
34 ap_t ap;
35 ap.lsiz = 2048;
36 ap.csiz = 2048;
37 ap.inframe = NULL;
38 ap.conframe = NULL;
39
40 /* Initialize */
41 hdrl_apinit(&ap);
42
43 /* Test some of the various bits of the structure to see if they are the correct values */
44 cpl_test_eq( ap.maxpa, 1024);
45 cpl_test_eq( ap.maxip, 0);
46 cpl_test_nonnull( ap.lastline);
47 cpl_test_nonnull( ap.pstack);
48 cpl_test_nonnull( ap.parent);
49 cpl_test_eq( ap.pstack[10], 10);
50 cpl_test_eq( ap.parent[10].pnop, -1);
51 cpl_test_eq( ap.parent[10].pnbp, -1);
52 cpl_test_eq( ap.ipstack, 1);
53 cpl_test_nonnull( ap.bstack);
54 cpl_test_nonnull( ap.blink);
55 cpl_test_nonnull( ap.plessey);
56 cpl_test_eq( ap.bstack[10], 10);
57 cpl_test_eq( ap.ibstack, 2);
58 cpl_test_eq( ap.nimages, 0);
59 cpl_test_eq( ap.areal[1], 2 * ap.areal[0]);
60 cpl_test_eq( ap.npl, ap.lsiz);
61 cpl_test_eq( ap.npl_pix, 0);
62 cpl_test_nonnull( ap.plarray);
63 cpl_test_eq( ap.backmap.nby, -1);
64 cpl_test_null( ap.backmap.bvals);
65 cpl_test_null( ap.indata);
66 cpl_test_null( ap.confdata);
67
68 /* Clean up */
69 hdrl_apclose(&ap);
70
71
72 return cpl_test_end(0);
73}
void hdrl_apinit(ap_t *ap)
Initialize the ap structure.
void hdrl_apclose(ap_t *ap)
Close ap structure.