00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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
00029
00030
00031 #include <cpl.h>
00032
00033
00034
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
00181
00182
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