uves_qclog-test.c

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: jmlarsen $
00022  * $Date: 2007/05/23 06:43:23 $
00023  * $Revision: 1.2 $
00024  * $Name: uves-3_3_1 $
00025  * $Log: uves_qclog-test.c,v $
00026  * Revision 1.2  2007/05/23 06:43:23  jmlarsen
00027  * Removed unused variables
00028  *
00029  * Revision 1.1  2007/03/15 12:27:18  jmlarsen
00030  * Moved unit tests to ./uves/tests and ./flames/tests
00031  *
00032  * Revision 1.3  2007/02/27 14:04:14  jmlarsen
00033  * Move unit test infrastructure to IRPLIB
00034  *
00035  * Revision 1.2  2007/01/29 12:17:54  jmlarsen
00036  * Support setting verbosity from command line
00037  *
00038  * Revision 1.1  2006/11/28 08:26:35  jmlarsen
00039  * Added QC log unit test
00040  *
00041  */
00042 
00043 /*-----------------------------------------------------------------------------
00044                                 Includes
00045  -----------------------------------------------------------------------------*/
00046 
00047 #ifdef HAVE_CONFIG_H
00048 #  include <config.h>
00049 #endif
00050 
00051 #include <uves_qclog.h>
00052 #include <uves_utils_wrappers.h>
00053 #include <uves_error.h>
00054 #include <irplib_test.h>
00055 
00056 #include <cpl.h>
00057 /*-----------------------------------------------------------------------------
00058                                 Defines
00059  -----------------------------------------------------------------------------*/
00060 
00061 /*-----------------------------------------------------------------------------
00062                             Functions prototypes
00063  -----------------------------------------------------------------------------*/
00064 
00065 
00066 /*----------------------------------------------------------------------------*/
00070 /*----------------------------------------------------------------------------*/
00073 /*----------------------------------------------------------------------------*/
00077 /*----------------------------------------------------------------------------*/
00078 static void
00079 test_qc_name(void)
00080 {
00081     const char *qc_name = NULL;
00082 
00083     const char *name = "SOMETHING";
00084     int trace_number = 2;
00085     bool flames = false;
00086 
00087     /* UVES */
00088     qc_name = uves_qclog_get_qc_name(name, flames, trace_number);
00089     
00090     assure( strcmp(qc_name, "QC SOMETHING") == 0,
00091         CPL_ERROR_ILLEGAL_OUTPUT, "%s != %s",
00092         qc_name, "QC SOMETHING");
00093 
00094     /* FLAMES */
00095     flames = true;
00096 
00097     uves_free_string_const(&qc_name);
00098     qc_name = uves_qclog_get_qc_name(name, flames, trace_number);
00099     
00100     assure( strcmp(qc_name, "QC FIB3 SOMETHING") == 0,
00101         CPL_ERROR_ILLEGAL_OUTPUT, "%s != %s",
00102         qc_name, "QC FIB3 SOMETHING");
00103 
00104   cleanup:
00105     uves_free_string_const(&qc_name);
00106     return;
00107 }
00108 
00109    
00110 /*----------------------------------------------------------------------------*/
00114 /*----------------------------------------------------------------------------*/
00115 
00116 int main(void)
00117 {
00118     /* Initialize CPL + UVES messaging */
00119     IRPLIB_TEST_INIT;
00120 
00121     check( test_qc_name(),
00122        "Test of QC names failed");
00123 
00124   cleanup:
00125     IRPLIB_TEST_END;
00126 }
00127 
00128 

Generated on Tue Jun 19 14:39:17 2007 for UVES Pipeline Reference Manual by  doxygen 1.4.6