00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifdef HAVE_CONFIG_H
00021 # include <config.h>
00022 #endif
00023
00024
00025
00026
00027
00028 #include <irplib_utils.h>
00029 #include <string.h>
00030 #include <float.h>
00031
00032
00033
00034
00035
00036 static IRPLIB_UTIL_SET_ROW(my_table_set_row);
00037 static IRPLIB_UTIL_CHECK(my_table_check);
00038
00039
00043
00044
00045
00049
00050 static void
00051 test_irplib_isnaninf(void)
00052 {
00053 double infinity = DBL_MAX * DBL_MAX;
00054 double number[] = {17, 0};
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067 cpl_test_zero(irplib_isnan(infinity) );
00068
00069 cpl_test_zero(irplib_isnan(number[0]) );
00070 cpl_test_zero(irplib_isnan(number[1]) );
00071
00072 cpl_test( irplib_isinf(infinity) );
00073
00074 cpl_test_zero(irplib_isinf(number[0]) );
00075 cpl_test_zero(irplib_isinf(number[1]) );
00076
00077 return;
00078 }
00079
00080
00081 static cpl_boolean my_table_set_row(cpl_table * self,
00082 const char * line,
00083 int irow,
00084 const cpl_frame * rawframe,
00085 const cpl_parameterlist * parlist)
00086 {
00087
00088 cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
00089 cpl_ensure_code(line != NULL, CPL_ERROR_NULL_INPUT);
00090 cpl_ensure_code(irow >= 0, CPL_ERROR_ILLEGAL_INPUT);
00091 cpl_ensure_code(rawframe != NULL, CPL_ERROR_NULL_INPUT);
00092 cpl_ensure_code(parlist != NULL, CPL_ERROR_NULL_INPUT);
00093
00094 return CPL_ERROR_NONE;
00095
00096 }
00097
00098 static cpl_error_code my_table_check(cpl_table * self,
00099 const cpl_frameset * useframes,
00100 const cpl_parameterlist * parlist)
00101 {
00102
00103 cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
00104 cpl_ensure_code(useframes != NULL, CPL_ERROR_NULL_INPUT);
00105 cpl_ensure_code(parlist != NULL, CPL_ERROR_NULL_INPUT);
00106
00107 return CPL_ERROR_NONE;
00108
00109 }
00110
00111
00112 static void
00113 test_irplib_dfs_table_convert(void)
00114 {
00115
00116
00117 cpl_error_code error
00118 = irplib_dfs_table_convert(NULL, NULL, NULL, 1024, '#',
00119 NULL, NULL, NULL, NULL, NULL, NULL,
00120 NULL, NULL, NULL, my_table_set_row,
00121 my_table_check);
00122
00123 cpl_test_error(CPL_ERROR_NULL_INPUT);
00124 cpl_test_eq(error, CPL_ERROR_NULL_INPUT);
00125
00126 error =
00127 irplib_table_read_from_frameset(NULL, NULL, 1024, '#', NULL,
00128 my_table_set_row);
00129
00130 cpl_test_error(CPL_ERROR_NULL_INPUT);
00131 cpl_test_eq(error, CPL_ERROR_NULL_INPUT);
00132 }
00133
00134
00135
00139
00140
00141 int main(void)
00142 {
00143
00144 cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING);
00145
00146 test_irplib_isnaninf();
00147
00148 test_irplib_dfs_table_convert();
00149
00150 return cpl_test_end(0);
00151 }