UVES Pipeline Reference Manual  5.4.0
uves_qclog-test.c
1 /* *
2  * This file is part of the ESO UVES Pipeline *
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 /*
21  * $Author: amodigli $
22  * $Date: 2009-06-05 05:49:02 $
23  * $Revision: 1.4 $
24  * $Name: not supported by cvs2svn $
25  * $Log: not supported by cvs2svn $
26  * Revision 1.3 2008/09/29 07:01:54 amodigli
27  * add #include <string.h>
28  *
29  * Revision 1.2 2007/05/23 06:43:23 jmlarsen
30  * Removed unused variables
31  *
32  * Revision 1.1 2007/03/15 12:27:18 jmlarsen
33  * Moved unit tests to ./uves/tests and ./flames/tests
34  *
35  * Revision 1.3 2007/02/27 14:04:14 jmlarsen
36  * Move unit test infrastructure to IRPLIB
37  *
38  * Revision 1.2 2007/01/29 12:17:54 jmlarsen
39  * Support setting verbosity from command line
40  *
41  * Revision 1.1 2006/11/28 08:26:35 jmlarsen
42  * Added QC log unit test
43  *
44  */
45 
46 /*-----------------------------------------------------------------------------
47  Includes
48  -----------------------------------------------------------------------------*/
49 
50 #ifdef HAVE_CONFIG_H
51 # include <config.h>
52 #endif
53 
54 #include <uves_qclog.h>
55 #include <uves_utils_wrappers.h>
56 #include <uves_error.h>
57 #include <cpl_test.h>
58 #include <string.h>
59 #include <cpl.h>
60 /*-----------------------------------------------------------------------------
61  Defines
62  -----------------------------------------------------------------------------*/
63 
64 /*-----------------------------------------------------------------------------
65  Functions prototypes
66  -----------------------------------------------------------------------------*/
67 
68 
69 /*----------------------------------------------------------------------------*/
73 /*----------------------------------------------------------------------------*/
76 /*----------------------------------------------------------------------------*/
80 /*----------------------------------------------------------------------------*/
81 static void
83 {
84  const char *qc_name = NULL;
85 
86  const char *name = "SOMETHING";
87  int trace_number = 2;
88  bool flames = false;
89 
90  /* UVES */
91  qc_name = uves_qclog_get_qc_name(name, flames, trace_number);
92 
93  assure( strcmp(qc_name, "QC SOMETHING") == 0,
94  CPL_ERROR_ILLEGAL_OUTPUT, "%s != %s",
95  qc_name, "QC SOMETHING");
96 
97  /* FLAMES */
98  flames = true;
99 
100  uves_free_string_const(&qc_name);
101  qc_name = uves_qclog_get_qc_name(name, flames, trace_number);
102 
103  assure( strcmp(qc_name, "QC FIB3 SOMETHING") == 0,
104  CPL_ERROR_ILLEGAL_OUTPUT, "%s != %s",
105  qc_name, "QC FIB3 SOMETHING");
106 
107  cleanup:
108  uves_free_string_const(&qc_name);
109  return;
110 }
111 
112 
113 /*----------------------------------------------------------------------------*/
117 /*----------------------------------------------------------------------------*/
118 
119 int main(void)
120 {
121  /* Initialize CPL + UVES messaging */
122  cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING);
123 
124  check( test_qc_name(),
125  "Test of QC names failed");
126 
127  cleanup:
128  return cpl_test_end(0);
129 }
130 
131