Changeset 13305 for trunk/psLib/test/math/tap_psPolynomial.c
- Timestamp:
- May 7, 2007, 8:21:16 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/math/tap_psPolynomial.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/math/tap_psPolynomial.c
r13084 r13305 16 16 * XXX: Compare to FLT_EPSILON 17 17 * 18 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $19 * @date $Date: 2007-05-0 1 00:08:52$18 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 19 * @date $Date: 2007-05-08 06:21:16 $ 20 20 * 21 21 * Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii … … 35 35 psLogSetFormat("HLNM"); 36 36 psLogSetLevel(PS_LOG_INFO); 37 38 plan_tests(26); 37 plan_tests(51); 39 38 40 39 // This test will allocate a 1D polynomial and verify the structure allocated … … 75 74 76 75 77 if (0) { 78 // Attempt to allocate with negative order 79 // Following should generate error msg for negative terms 80 if (psPolynomial1DAlloc(PS_POLYNOMIAL_ORD, -1) != NULL) { 81 diag("psPolynomial1DAlloc() Returned structure but expected NULL"); 82 } 83 } 76 // This test will allocate a Chebyshev 1D polynomial and verify the structure allocated 77 { 78 psMemId id = psMemGetId(); 79 psPolynomial1D* my1DPoly = NULL; 80 my1DPoly = psPolynomial1DAlloc(PS_POLYNOMIAL_CHEB, ORDER); 81 ok(my1DPoly != NULL, "Chebyshev 1D polynomial allocated successfully"); 82 skip_start(my1DPoly == NULL, 1, "Skipping tests because psPolynomial1DAlloc() failed"); 83 ok(my1DPoly->type == PS_POLYNOMIAL_CHEB, "psPolynomial1DAlloc(): Chebyshev type set correctly"); 84 skip_end(); 85 psFree(my1DPoly); 86 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 87 } 88 89 90 // Attempt to allocate with negative order 91 // Following should generate error msg for negative terms 92 if (1) { 93 psMemId id = psMemGetId(); 94 ok(psPolynomial1DAlloc(PS_POLYNOMIAL_ORD, -1) == NULL, 95 "psPolynomial1DAlloc() returned NULL with negative polynomial order"); 96 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 97 } 98 84 99 85 100 // This test will allocate a 2D polynomial and verify the structure allocated … … 122 137 } 123 138 124 if (0) { 125 // Attempt to allocate with negative order 126 // Following should generate error msg for negative terms 127 if (psPolynomial2DAlloc(PS_POLYNOMIAL_ORD, -1, 1) != NULL) { 128 diag("psPolynomial2DAlloc() returned structure but expected NULL"); 129 } 130 // Attempt to allocate with negative order 131 // Following should generate error msg for negative terms 132 if (psPolynomial2DAlloc(PS_POLYNOMIAL_ORD, 1, -1) != NULL) { 133 diag("psPolynomial2DAlloc() returned structure but expected NULL"); 134 } 135 } 139 140 // This test will allocate a Chebyshev 2D polynomial and verify the structure allocated 141 { 142 psMemId id = psMemGetId(); 143 psPolynomial2D* my2DPoly = NULL; 144 my2DPoly = psPolynomial2DAlloc(PS_POLYNOMIAL_CHEB, ORDER,ORDER+1); 145 ok(my2DPoly != NULL, "Chebyshev 2D polynomial allocated successfully"); 146 skip_start(my2DPoly == NULL, 1, "Skipping tests because psPolynomial2DAlloc() failed"); 147 skip_end(); 148 psFree(my2DPoly); 149 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 150 } 151 152 153 // Attempt to allocate with negative order 154 // Following should generate error msg for negative terms 155 if (1) { 156 psMemId id = psMemGetId(); 157 ok(psPolynomial2DAlloc(PS_POLYNOMIAL_ORD, -1, 1) == NULL, 158 "psPolynomial2DAlloc() returned NULL with negative polynomial order"); 159 ok(psPolynomial2DAlloc(PS_POLYNOMIAL_ORD, 1, -1) == NULL, 160 "psPolynomial2DAlloc() returned NULL with negative polynomial order"); 161 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 162 } 163 136 164 137 165 // This test will allocate a 3D polynomial and verify the structure allocated … … 179 207 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 180 208 } 181 if (0) { 182 // Attempt to allocate with negative order 183 // Following should generate error msg for negative terms 184 if (psPolynomial3DAlloc(PS_POLYNOMIAL_ORD, -1, 1, 1) != NULL) { 185 diag("psPolynomial3DAlloc(): returned structure but expected NULL"); 186 } 187 // Attempt to allocate with negative order 188 // Following should generate error msg for negative terms 189 if (psPolynomial3DAlloc(PS_POLYNOMIAL_ORD, 1, -1, 1) != NULL) { 190 diag("psPolynomial3DAlloc() returned structure but expected NULL"); 191 } 192 // Attempt to allocate with negative order 193 // Following should generate error msg for negative terms 194 if (psPolynomial3DAlloc(PS_POLYNOMIAL_ORD, 1, 1, -1) != NULL) { 195 diag("psPolynomial3DAlloc(): returned structure but expected NULL"); 196 } 197 } 209 210 211 // This test will allocate a Chebyshev 3D polynomial and verify the structure allocated 212 { 213 psMemId id = psMemGetId(); 214 psPolynomial3D* my3DPoly = NULL; 215 my3DPoly = psPolynomial3DAlloc(PS_POLYNOMIAL_CHEB, ORDER, ORDER+1, ORDER+2); 216 ok(my3DPoly != NULL, "Chebyshev 3D polynomial allocated successfully"); 217 skip_start(my3DPoly == NULL, 1, "Skipping tests because psPolynomial2DAlloc() failed"); 218 ok(my3DPoly->type == PS_POLYNOMIAL_CHEB, "psPolynomial3DAlloc(): Chebyshev type set correctly"); 219 skip_end(); 220 psFree(my3DPoly); 221 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 222 } 223 224 225 // Attempt to allocate with negative order 226 // Following should generate error msg for negative terms 227 if (1) { 228 psMemId id = psMemGetId(); 229 ok(psPolynomial3DAlloc(PS_POLYNOMIAL_ORD, -1, 1, 1) == NULL, 230 "psPolynomial3DAlloc() returned NULL with negative polynomial order"); 231 ok(psPolynomial3DAlloc(PS_POLYNOMIAL_ORD, 1, -1, 1) == NULL, 232 "psPolynomial3DAlloc() returned NULL with negative polynomial order"); 233 ok(psPolynomial3DAlloc(PS_POLYNOMIAL_ORD, 1, 1, -1) == NULL, 234 "psPolynomial3DAlloc() returned NULL with negative polynomial order"); 235 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 236 } 237 198 238 199 239 // This test will allocate a 4D polynomial and verify the structure allocated … … 245 285 } 246 286 247 if (0) { 248 // Attempt to allocate with negative order 249 // Following should generate error msg for negative terms 250 if (psPolynomial4DAlloc(PS_POLYNOMIAL_ORD, -1, 1, 1, 1) != NULL) { 251 diag("psPolynomial4DAlloc(): returned structure but expected NULL"); 252 } 253 // Attempt to allocate with negative order 254 // Following should generate error msg for negative terms 255 if (psPolynomial4DAlloc(PS_POLYNOMIAL_ORD, 1, -1, 1, 1) != NULL) { 256 diag("psPolynomial4DAlloc(): returned structure but expected NULL"); 257 psError(PS_ERR_UNKNOWN,true,"Returned structure but expected NULL"); 258 } 259 // Attempt to allocate with negative order 260 // Following should generate error msg for negative terms 261 if (psPolynomial4DAlloc(PS_POLYNOMIAL_ORD, 1, 1, -1, 1) != NULL) { 262 diag("psPolynomial4DAlloc(): returned structure but expected NULL"); 263 psError(PS_ERR_UNKNOWN,true,"Returned structure but expected NULL"); 264 } 265 // Attempt to allocate with negative order 266 // Following should generate error msg for negative terms 267 if (psPolynomial4DAlloc(PS_POLYNOMIAL_ORD, 1, 1, 1, -1) != NULL) { 268 diag("psPolynomial4DAlloc(): returned structure but expected NULL"); 269 } 270 } 287 288 // This test will allocate a Chebyshev 4D polynomial and verify the structure allocated 289 { 290 psMemId id = psMemGetId(); 291 psPolynomial4D* my4DPoly = NULL; 292 my4DPoly = psPolynomial4DAlloc(PS_POLYNOMIAL_CHEB, ORDER,ORDER+1,ORDER+2,ORDER+3); 293 ok(my4DPoly != NULL, "Chebyshev 4D polynomial allocated successfully"); 294 skip_start(my4DPoly == NULL, 1, "Skipping tests because psPolynomial4DAlloc() failed"); 295 ok(my4DPoly->type == PS_POLYNOMIAL_CHEB, "psPolynomial4DAlloc(): Chebyshev type set correctly"); 296 skip_end(); 297 psFree(my4DPoly); 298 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 299 } 300 301 302 // Attempt to allocate with negative order 303 // Following should generate error msg for negative terms 304 if (1) { 305 psMemId id = psMemGetId(); 306 ok(psPolynomial4DAlloc(PS_POLYNOMIAL_ORD, -1, 1, 1, 1) == NULL, 307 "psPolynomial4DAlloc() returned NULL with negative polynomial order"); 308 ok(psPolynomial4DAlloc(PS_POLYNOMIAL_ORD, 1, -1, 1, 1) == NULL, 309 "psPolynomial4DAlloc() returned NULL with negative polynomial order"); 310 ok(psPolynomial4DAlloc(PS_POLYNOMIAL_ORD, 1, 1, -1, 1) == NULL, 311 "psPolynomial4DAlloc() returned NULL with negative polynomial order"); 312 ok(psPolynomial4DAlloc(PS_POLYNOMIAL_ORD, 1, 1, 1, -1) == NULL, 313 "psPolynomial4DAlloc() returned NULL with negative polynomial order"); 314 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 315 } 316 317 271 318 } 272 319
Note:
See TracChangeset
for help on using the changeset viewer.
