test.h

00001 /*                                                                              *
00002  *   This file is part of the ESO IRPLIB package                                *
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 #ifndef TEST_H
00021 #define TEST_H
00022 
00023 #ifdef HAVE_CONFIG_H
00024 #  include <config.h>
00025 #endif
00026 
00027 /*-----------------------------------------------------------------------------
00028                                 Includes
00029  -----------------------------------------------------------------------------*/
00030 
00031 #include <cpl.h>
00032 
00033 /*-----------------------------------------------------------------------------
00034                                 Defines
00035  -----------------------------------------------------------------------------*/
00036 
00039 /*----------------------------------------------------------------------------*/
00055 /*----------------------------------------------------------------------------*/
00056 #define test(expr) \
00057         test_macro(expr, #expr, cpl_func, __FILE__, __LINE__)
00058 
00059 /*----------------------------------------------------------------------------*/
00079 /*----------------------------------------------------------------------------*/
00080 #define test_eq(first, second)                                          \
00081         test_eq_macro(first, #first, second, #second,                   \
00082                               cpl_func, __FILE__, __LINE__)
00083 /*----------------------------------------------------------------------------*/
00099 /*----------------------------------------------------------------------------*/
00100 #define test_eq_string(first, second)                                   \
00101         test_eq_string_macro(first, #first, second, #second,            \
00102                               cpl_func, __FILE__, __LINE__)
00103 
00104 /*----------------------------------------------------------------------------*/
00123 /*----------------------------------------------------------------------------*/
00124 #define test_abs(first, second, tolerance)                              \
00125         test_abs_macro(first, #first, second, #second,                  \
00126                               tolerance, #tolerance,                           \
00127                               cpl_func, __FILE__, __LINE__)
00128 
00129 /*----------------------------------------------------------------------------*/
00154 /*----------------------------------------------------------------------------*/
00155 #define test_rel(first, second, tolerance)                              \
00156         test_rel_macro(first, #first, second, #second,                  \
00157                               tolerance, #tolerance,                           \
00158                               cpl_func, __FILE__, __LINE__)
00159 
00160 /*----------------------------------------------------------------------------*/
00165 /*----------------------------------------------------------------------------*/
00166 #define TEST_INIT test_init_macro(__FILE__)
00167 
00168 /*----------------------------------------------------------------------------*/
00173 /*----------------------------------------------------------------------------*/
00174 #define TEST_END \
00175     return(test_end_macro(cpl_func, __FILE__, __LINE__) ? \
00176     EXIT_FAILURE : EXIT_SUCCESS)
00177 
00178 
00179 /*-----------------------------------------------------------------------------
00180                                Functions prototypes
00181  -----------------------------------------------------------------------------*/
00182 /* None of these functions should be called directly */
00183 void
00184 test_init_macro(const char *file);
00185 
00186 unsigned
00187 test_end_macro(const char *function, const char *file, unsigned line);
00188 
00189 void 
00190 test_macro(int expression, const char *expr_string,
00191                   const char *function, const char *file, unsigned line);
00192 
00193 void 
00194 test_eq_macro(int first,  const char *first_string,
00195                      int second, const char *second_string,
00196                      const char *function, const char *file, unsigned line);
00197 void 
00198 test_eq_string_macro(const char *first,  const char *first_string,
00199                 const char *second, const char *second_string,
00200                 const char *function, 
00201                 const char *file, unsigned line);
00202 void 
00203 test_abs_macro(double first,  const char *first_string,
00204                       double second, const char *second_string,
00205                       double tolerance, const char *tolerance_string,
00206                       const char *function, const char *file, unsigned line);
00207 
00208 void 
00209 test_rel_macro(double first,  const char *first_string,
00210                       double second, const char *second_string,
00211                       double tolerance, const char *tolerance_string,
00212                       const char *function, const char *file, unsigned line);
00213 
00214 void 
00215 test_recipe_output(const cpl_frameset *frames,
00216                    const char *const product_tags[], int n_prod,
00217            const char *main_product,
00218            const char *const qc[], int n_qc);
00219 
00222 #endif

Generated on Fri Mar 4 09:46:01 2011 for FORS Pipeline Reference Manual by  doxygen 1.4.7