UVES Pipeline Reference Manual  5.4.0
irplib_plugin-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_plugin.h>
29 #include <string.h>
30 #include <float.h>
31 
32 /*-----------------------------------------------------------------------------
33  Function prototypes
34  -----------------------------------------------------------------------------*/
35 
36 /*----------------------------------------------------------------------------*/
40 /*----------------------------------------------------------------------------*/
41 
42 
43 /*----------------------------------------------------------------------------*/
47 /*----------------------------------------------------------------------------*/
48 
49 int main(void)
50 {
51 
52 
53 
54  cpl_parameterlist * parlist;
55 
56  /* Initialize CPL for unit testing */
57  cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING);
58 
59  parlist = cpl_parameterlist_new();
60 
61 
62  (void)irplib_parameterlist_get_double(parlist, "INST", "RECIPE", NULL);
63  cpl_test_error(CPL_ERROR_NULL_INPUT);
64 
65  (void)irplib_parameterlist_get_double(parlist, "INST", NULL, "PAR");
66  cpl_test_error(CPL_ERROR_NULL_INPUT);
67 
68  (void)irplib_parameterlist_get_double(parlist, NULL, "RECIPE", "PAR");
69  cpl_test_error(CPL_ERROR_NULL_INPUT);
70 
71  (void)irplib_parameterlist_get_double(NULL, "INST", "RECIPE", "PAR");
72  cpl_test_error(CPL_ERROR_NULL_INPUT);
73 
74  (void)irplib_parameterlist_get_double(parlist, "INST", "RECIPE", "PAR");
75  cpl_test_error(CPL_ERROR_DATA_NOT_FOUND);
76 
77 
78  (void)irplib_parameterlist_get_int(parlist, "INST", "RECIPE", NULL);
79  cpl_test_error(CPL_ERROR_NULL_INPUT);
80 
81  (void)irplib_parameterlist_get_int(parlist, "INST", NULL, "PAR");
82  cpl_test_error(CPL_ERROR_NULL_INPUT);
83 
84  (void)irplib_parameterlist_get_int(parlist, NULL, "RECIPE", "PAR");
85  cpl_test_error(CPL_ERROR_NULL_INPUT);
86 
87  (void)irplib_parameterlist_get_int(NULL, "INST", "RECIPE", "PAR");
88  cpl_test_error(CPL_ERROR_NULL_INPUT);
89 
90  (void)irplib_parameterlist_get_int(parlist, "INST", "RECIPE", "PAR");
91  cpl_test_error(CPL_ERROR_DATA_NOT_FOUND);
92 
93 
94  (void)irplib_parameterlist_get_bool(parlist, "INST", "RECIPE", NULL);
95  cpl_test_error(CPL_ERROR_NULL_INPUT);
96 
97  (void)irplib_parameterlist_get_bool(parlist, "INST", NULL, "PAR");
98  cpl_test_error(CPL_ERROR_NULL_INPUT);
99 
100  (void)irplib_parameterlist_get_bool(parlist, NULL, "RECIPE", "PAR");
101  cpl_test_error(CPL_ERROR_NULL_INPUT);
102 
103  (void)irplib_parameterlist_get_bool(NULL, "INST", "RECIPE", "PAR");
104  cpl_test_error(CPL_ERROR_NULL_INPUT);
105 
106  (void)irplib_parameterlist_get_bool(parlist, "INST", "RECIPE", "PAR");
107  cpl_test_error(CPL_ERROR_DATA_NOT_FOUND);
108 
109 
110  (void)irplib_parameterlist_get_string(parlist, "INST", "RECIPE", NULL);
111  cpl_test_error(CPL_ERROR_NULL_INPUT);
112 
113  (void)irplib_parameterlist_get_string(parlist, "INST", NULL, "PAR");
114  cpl_test_error(CPL_ERROR_NULL_INPUT);
115 
116  (void)irplib_parameterlist_get_string(parlist, NULL, "RECIPE", "PAR");
117  cpl_test_error(CPL_ERROR_NULL_INPUT);
118 
119  (void)irplib_parameterlist_get_string(NULL, "INST", "RECIPE", "PAR");
120  cpl_test_error(CPL_ERROR_NULL_INPUT);
121 
122  (void)irplib_parameterlist_get_string(parlist, "INST", "RECIPE", "PAR");
123  cpl_test_error(CPL_ERROR_DATA_NOT_FOUND);
124 
125 
126  cpl_parameterlist_delete(parlist);
127 
128  return cpl_test_end(0);
129 }