Changeset 42336 for trunk/psLib/test
- Timestamp:
- Jan 30, 2023, 9:51:20 AM (3 years ago)
- Location:
- trunk/psLib
- Files:
-
- 2 edited
- 1 copied
-
. (modified) (1 prop)
-
test/math/mana.spline.pro (copied) (copied from branches/eam_branches/psLib.20230123/test/math/mana.spline.pro )
-
test/math/tap_psSpline1D.c (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/IPP-308_move_backups_folder/psLib merged eligible /branches/czw_branch/20160809/psLib merged eligible /branches/czw_branch/20170908/psLib merged eligible /branches/eam_branches/ipp-20191011/psLib merged eligible /branches/eam_branches/ipp-20211108/psLib merged eligible /branches/eam_branches/ipp-dev-20210817/psLib merged eligible /branches/eam_branches/psLib.20230123 merged eligible /tags/ipp-ops-20220303-rc/psLib merged eligible /tags/ipp-ops-20220705/psLib merged eligible /tags/ipp-ps1-20210510/psLib merged eligible /tags/ipp-ps1-20210708/psLib merged eligible /branches/ipp-259_genericise_backups/psLib 40910-40966
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/psLib/test/math/tap_psSpline1D.c
r13124 r42336 1 /* @file t st_psImageManip.c2 * 3 * @brief This file will containtests for all of the public psLib functions1 /* @file tap_psImageManip.c 2 * 3 * @brief This file contains tests for all of the public psLib functions 4 4 * that implement 1-D spline functionality: 5 5 * psSpline1DAlloc() 6 6 * psSpline1DEval() 7 7 * psSpline1DEvalVector() 8 * ps VectorFitSpline1D()8 * psSpline1DFitVector() 9 9 * 10 10 * This file is composed of the tests formerly in tst_psFunc02.c, … … 35 35 psF32 expect) 36 36 { 37 // NOTE: this returns NAN if 'expect' == 0.0 38 // NOTE 2: this is not testing a percent, but fractional error 37 39 if ((fabs(actual - expect) / fabs(expect)) > ERROR_TOLERANCE_PERCENT) { 38 40 return(true); … … 83 85 typedef psF64 (*mappingFuncF64)(psF64 x); 84 86 87 /* EAM 2023.01.22 : these tests are not well considered. They generate a set of N+1 points 88 to use as knots at integer values from 0 to N, then evaluate the spline half-way between 89 the knots. the function above is a cubic, so a cubic spline should fit it perfectly, which 90 is fine. Perhaps this test suite should use a pre-defined collection of data points? 91 */ 92 85 93 bool genericF32Test(psS32 NumSplines, mappingFuncF32 func, bool xNull) 86 94 { 87 // We test the ps VectorFitSpline1D, psSpline1DEval() functions. F32 version.95 // We test the psSpline1DFitVector, psSpline1DEval() functions. F32 version. 88 96 bool testStatus = true; 89 97 { 98 // Generate the vector data 90 99 psMemId id = psMemGetId(); 91 100 psVector *xF32 = psVectorAlloc(NumSplines+1, PS_TYPE_F32); … … 98 107 psSpline1D *tmpSpline = NULL; 99 108 if (!xNull) { 100 tmpSpline = ps VectorFitSpline1D(xF32, yF32);109 tmpSpline = psSpline1DFitVector(xF32, yF32); 101 110 } else { 102 tmpSpline = psVectorFitSpline1D(NULL, yF32); 103 } 111 tmpSpline = psSpline1DFitVector(NULL, yF32); 112 } 113 104 114 if(tmpSpline == NULL) { 105 diag("ps VectorFitSpline1D() returned NULL");115 diag("psSpline1DFitVector() returned NULL"); 106 116 testStatus = false; 107 117 } else { 108 118 if (tmpSpline->n != NumSplines) { 109 diag("ps VectorFitSpline1D() did not properly set the psSpline1D->n member");119 diag("psSpline1DFitVector() did not properly set the psSpline1D->n member"); 110 120 testStatus = false; 111 121 } 112 122 if(tmpSpline->spline == NULL) { 113 diag("ps VectorFitSpline1D() returned a NULL psSpline1D->spline member.");123 diag("psSpline1DFitVector() returned a NULL psSpline1D->spline member."); 114 124 testStatus = false; 115 125 } 116 126 for (psS32 i = 0 ; i < NumSplines ; i++) { 117 127 if (tmpSpline->spline[i] == NULL) { 118 diag("ps VectorFitSpline1D() returned a NULL psSpline1D->spline[%d] member.", i);128 diag("psSpline1DFitVector() returned a NULL psSpline1D->spline[%d] member.", i); 119 129 testStatus = false; 120 130 } 121 131 } 122 132 if (tmpSpline->knots == NULL) { 123 diag("ps VectorFitSpline1D() returned a NULL psSpline1D->knots member");133 diag("psSpline1DFitVector() returned a NULL psSpline1D->knots member"); 124 134 testStatus = false; 125 135 } 126 136 if (tmpSpline->p_psDeriv2 == NULL) { 127 diag("ps VectorFitSpline1D()returned a NULL psSpline1D->p_psDeriv2 member");137 diag("psSpline1DFitVector()returned a NULL psSpline1D->p_psDeriv2 member"); 128 138 testStatus = false; 129 139 } … … 136 146 testStatus = false; 137 147 diag("TEST ERROR: f(%f) is %f, should be %f", x, y, myFunc00(x)); 148 // XXX EAM : the truth value above should be 'func' not myFunc00 138 149 } 139 150 } … … 150 161 diag("TEST ERROR: f(%f) is %f, should be %f", xF32->data.F32[i], 151 162 yF32Test->data.F32[i], myFunc00(xF32->data.F32[i])); 163 // XXX EAM : the truth value above should be 'func' not myFunc00 152 164 } 153 165 } … … 171 183 bool genericF64Test(psS32 NumSplines, mappingFuncF64 func, bool xNull) 172 184 { 173 // We test the ps VectorFitSpline1D, psSpline1DEval() functions. F64 version.185 // We test the psSpline1DFitVector, psSpline1DEval() functions. F64 version. 174 186 bool testStatus = true; 175 187 { … … 184 196 psSpline1D *tmpSpline = NULL; 185 197 if (!xNull) { 186 tmpSpline = ps VectorFitSpline1D(xF64, yF64);198 tmpSpline = psSpline1DFitVector(xF64, yF64); 187 199 } else { 188 tmpSpline = ps VectorFitSpline1D(NULL, yF64);200 tmpSpline = psSpline1DFitVector(NULL, yF64); 189 201 } 190 202 if(tmpSpline == NULL) { 191 diag("ps VectorFitSpline1D() returned NULL");203 diag("psSpline1DFitVector() returned NULL"); 192 204 testStatus = false; 193 205 } else { 194 206 if (tmpSpline->n != NumSplines) { 195 diag("ps VectorFitSpline1D() did not properly set the psSpline1D->n member");207 diag("psSpline1DFitVector() did not properly set the psSpline1D->n member"); 196 208 testStatus = false; 197 209 } 198 210 if(tmpSpline->spline == NULL) { 199 diag("ps VectorFitSpline1D() returned a NULL psSpline1D->spline member.");211 diag("psSpline1DFitVector() returned a NULL psSpline1D->spline member."); 200 212 testStatus = false; 201 213 } 202 214 for (psS32 i = 0 ; i < NumSplines ; i++) { 203 215 if (tmpSpline->spline[i] == NULL) { 204 diag("ps VectorFitSpline1D() returned a NULL psSpline1D->spline[%d] member.", i);216 diag("psSpline1DFitVector() returned a NULL psSpline1D->spline[%d] member.", i); 205 217 testStatus = false; 206 218 } 207 219 } 208 220 if (tmpSpline->knots == NULL) { 209 diag("ps VectorFitSpline1D() returned a NULL psSpline1D->knots member");221 diag("psSpline1DFitVector() returned a NULL psSpline1D->knots member"); 210 222 testStatus = false; 211 223 } 212 224 if (tmpSpline->p_psDeriv2 == NULL) { 213 diag("ps VectorFitSpline1D()returned a NULL psSpline1D->p_psDeriv2 member");225 diag("psSpline1DFitVector()returned a NULL psSpline1D->p_psDeriv2 member"); 214 226 testStatus = false; 215 227 } … … 274 286 } 275 287 276 // psSplineEvalTest_sub(): Call ps VectorFitSpline1Dwith NULL arguments.277 { 278 psMemId id = psMemGetId(); 279 psSpline1D *tmpSpline = ps VectorFitSpline1D(NULL, NULL);280 ok(tmpSpline == NULL, "ps VectorFitSpline1D() returns NULL with NULL arguments");288 // psSplineEvalTest_sub(): Call psSpline1DFitVector with NULL arguments. 289 { 290 psMemId id = psMemGetId(); 291 psSpline1D *tmpSpline = psSpline1DFitVector(NULL, NULL); 292 ok(tmpSpline == NULL, "psSpline1DFitVector() returns NULL with NULL arguments"); 281 293 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 282 294 } … … 287 299 psMemId id = psMemGetId(); 288 300 float y = psSpline1DEval(NULL, 0.0); 289 ok(isnan(y), "psSpline1DEval() returned NAN wi llNULL input spline");301 ok(isnan(y), "psSpline1DEval() returned NAN with NULL input spline"); 290 302 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 291 303 } … … 297 309 psVector *x = psVectorAlloc(10, PS_TYPE_F32); 298 310 psVector *y = psSpline1DEvalVector(NULL, x); 299 ok(y == NULL, "psSpline1DEvalVector() returned N AN willNULL input spline");311 ok(y == NULL, "psSpline1DEvalVector() returned NULL with NULL input spline"); 300 312 psFree(x); 301 313 psFree(y); … … 316 328 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 317 329 } 318 319 330 320 331 ok(genericF32Test(1, myFunc00, false), "Generic, simple mapping, F32 test. 1 spline");
Note:
See TracChangeset
for help on using the changeset viewer.
