00001 /* * 00002 * This file is part of the ESO UVES Pipeline * 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 /* 00021 * $Author: amodigli $ 00022 * $Date: 2009/06/05 05:49:02 $ 00023 * $Revision: 1.4 $ 00024 * $Name: uves-4_9_1 $ 00025 * $Log: uves_qclog-test.c,v $ 00026 * Revision 1.4 2009/06/05 05:49:02 amodigli 00027 * updated init/end to cpl5 00028 * 00029 * Revision 1.3 2008/09/29 07:01:54 amodigli 00030 * add #include <string.h> 00031 * 00032 * Revision 1.2 2007/05/23 06:43:23 jmlarsen 00033 * Removed unused variables 00034 * 00035 * Revision 1.1 2007/03/15 12:27:18 jmlarsen 00036 * Moved unit tests to ./uves/tests and ./flames/tests 00037 * 00038 * Revision 1.3 2007/02/27 14:04:14 jmlarsen 00039 * Move unit test infrastructure to IRPLIB 00040 * 00041 * Revision 1.2 2007/01/29 12:17:54 jmlarsen 00042 * Support setting verbosity from command line 00043 * 00044 * Revision 1.1 2006/11/28 08:26:35 jmlarsen 00045 * Added QC log unit test 00046 * 00047 */ 00048 00049 /*----------------------------------------------------------------------------- 00050 Includes 00051 -----------------------------------------------------------------------------*/ 00052 00053 #ifdef HAVE_CONFIG_H 00054 # include <config.h> 00055 #endif 00056 00057 #include <uves_qclog.h> 00058 #include <uves_utils_wrappers.h> 00059 #include <uves_error.h> 00060 #include <cpl_test.h> 00061 #include <string.h> 00062 #include <cpl.h> 00063 /*----------------------------------------------------------------------------- 00064 Defines 00065 -----------------------------------------------------------------------------*/ 00066 00067 /*----------------------------------------------------------------------------- 00068 Functions prototypes 00069 -----------------------------------------------------------------------------*/ 00070 00071 00072 /*----------------------------------------------------------------------------*/ 00076 /*----------------------------------------------------------------------------*/ 00079 /*----------------------------------------------------------------------------*/ 00083 /*----------------------------------------------------------------------------*/ 00084 static void 00085 test_qc_name(void) 00086 { 00087 const char *qc_name = NULL; 00088 00089 const char *name = "SOMETHING"; 00090 int trace_number = 2; 00091 bool flames = false; 00092 00093 /* UVES */ 00094 qc_name = uves_qclog_get_qc_name(name, flames, trace_number); 00095 00096 assure( strcmp(qc_name, "QC SOMETHING") == 0, 00097 CPL_ERROR_ILLEGAL_OUTPUT, "%s != %s", 00098 qc_name, "QC SOMETHING"); 00099 00100 /* FLAMES */ 00101 flames = true; 00102 00103 uves_free_string_const(&qc_name); 00104 qc_name = uves_qclog_get_qc_name(name, flames, trace_number); 00105 00106 assure( strcmp(qc_name, "QC FIB3 SOMETHING") == 0, 00107 CPL_ERROR_ILLEGAL_OUTPUT, "%s != %s", 00108 qc_name, "QC FIB3 SOMETHING"); 00109 00110 cleanup: 00111 uves_free_string_const(&qc_name); 00112 return; 00113 } 00114 00115 00116 /*----------------------------------------------------------------------------*/ 00120 /*----------------------------------------------------------------------------*/ 00121 00122 int main(void) 00123 { 00124 /* Initialize CPL + UVES messaging */ 00125 cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); 00126 00127 check( test_qc_name(), 00128 "Test of QC names failed"); 00129 00130 cleanup: 00131 return cpl_test_end(0); 00132 } 00133 00134