Changeset 13337
- Timestamp:
- May 10, 2007, 10:17:52 AM (19 years ago)
- Location:
- trunk/psLib/test
- Files:
-
- 6 edited
-
TABLE-SDRS-CH06-DataManip (modified) (4 diffs)
-
math/Makefile.am (modified) (1 diff)
-
math/tap_psPolyFit1D.c (modified) (2 diffs)
-
math/tap_psPolyFit2D.c (modified) (1 diff)
-
math/tap_psPolyFit3D.c (modified) (1 diff)
-
math/tap_psPolyFit4D.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/TABLE-SDRS-CH06-DataManip
r13306 r13337 22 22 na na na 10 23 23 psStatsOptionFromString() 24 NONE NONE NONE NONE24 10 na na 10 na 25 25 psStatsOptionToString() 26 NONE NONE NONE NONE26 10 na na 10 na 27 27 psStatsFromString() 28 28 NONE NONE NONE NONE … … 101 101 psSpline1DEval() 102 102 8 na 5 8 103 There should be a PS_ASSERT_PTR_NON_NULL(spline->knots) before we assert type: 104 PS_ASSERT_PTR_NON_NULL(spline, NULL); 105 PS_ASSERT_VECTOR_TYPE(spline->knots, PS_TYPE_F32, NULL); 103 There should be a PS_ASSERT_PTR_NON_NULL(spline->knots) before we 104 assert type: 105 PS_ASSERT_PTR_NON_NULL(spline, NULL); 106 PS_ASSERT_VECTOR_TYPE(spline->knots, PS_TYPE_F32, NULL); 106 107 psSpline1DEvalVector() 107 108 8 na 5 8 … … 137 138 NONE 138 139 psVectorFitPolynomial1D() 139 0 10 7 9140 M ust add unallowed input parameters, maybe vary the poly orders.140 10 10 7 9 141 Maybe vary the poly orders. 141 142 4D has some tests that are failing, but should not be. 142 143 psVectorFitPolynomial2D() 143 0 10 7 9144 10 10 7 9 144 145 DITTO 145 146 psVectorFitPolynomial3D() 146 0 10 7 9147 10 10 7 9 147 148 DITTO 148 149 psVectorFitPolynomial4D() 149 0 10 7 9150 10 10 7 9 150 151 DITTO 151 152 psVectorClipFitPolynomial1D() 152 0 10 7 9153 10 10 7 9 153 154 DITTO 154 155 psVectorClipFitPolynomial2D() 155 0 10 7 9156 10 10 7 9 156 157 DITTO 157 158 psVectorClipFitPolynomial3D() 158 0 10 7 9159 10 10 7 9 159 160 DITTO 160 161 psVectorClipFitPolynomial4D() 161 0 10 7 9162 10 10 7 9 162 163 DITTO 163 164 psVectorFitSpline1D() 0 2 10 5 5 164 165 psImageSubset() 10 2 1 10 na 165 in imageops dir. not math:tap_psImageStructManip.c166 in imageops/tap_psImageStructManip.c 166 167 A single 128x256 image of type U32 is tested. 167 168 psImageCopy() 10 10 8 10 na 168 in imageops dir. not math:tap_psImageStructManip.c169 in imageops/tap_psImageStructManip.c 169 170 A single input 128x256 image of type F32 is tested, however it's 170 171 converted to all other allowed types. 171 172 psImageTrim() 10 2 4 10 na 172 in imageops dir. not math:tap_psImageStructManip.c173 in imageops/tap_psImageStructManip.c 173 174 A single 200x300 image of type F32 is tested. 174 175 psImageFlip() 0 0 0 0 0 175 176 NONE 176 177 psImageRow() 10 10 2 10 na 177 in imageops dir. not math:tap_psImageStructManip.c178 in imageops/tap_psImageStructManip.c 178 179 psImageCol() 10 10 2 10 na 179 in imageops dir. not math:tap_psImagePixelExtract.c180 in imageops/tap_psImagePixelExtract.c 180 181 A single 3x3 image is used 181 182 psImageSlice() 10 10 10 10 na 182 in imageops dir. not math:tap_psImagePixelExtract.c183 in imageops/tap_psImagePixelExtract.c 183 184 Spend more time determining if all input params are tested, and all combos 184 185 as well. 185 186 SDRS seems to be out of date. 186 187 psImageCut() 5 2 2 10 na 187 in imageops dir. not math:tap_psImagePixelExtract.c188 in imageops/tap_psImagePixelExtract.c 188 189 SDRS seems to be incomplete and lots of unallowed input param combos are 189 190 probably not tested. 190 191 A single 200x300 input image of type F32 is tested. 191 192 192 psImageRadialCut() 10 2 2 10 na 193 in imageops dir. not math:tap_psImagePixelExtract.c193 in imageops/tap_psImagePixelExtract.c 194 194 A single 200x300 input image of type F32 is tested. 195 195 psImageRebin() 10 10 2 10 na 196 In imageops dir. not math:tap_psImageGeomManip.c196 In imageops/tap_psImageGeomManip.c 197 197 Only 16x16 images are rebinned into 4x4 images. Try NxM. 198 198 psImageResample() 10 2 2 10 na 199 In imageops dir. not math:tap_psImageGeomManip.c199 In imageops/tap_psImageGeomManip.c 200 200 A single 80x60 input image of type F32 is used. 201 201 psImageRotate() 8 5 2 10 na 202 In imageops dir. not math:tap_psImageGeomManip.c202 In imageops/tap_psImageGeomManip.c 203 203 A single 64x64 input image is used 204 204 Only types F32 and S16 are tested … … 207 207 There is a potential autoconf directory problem with reading the FITS file. 208 208 psImageShift() 10 5 5 10 na 209 In imageops dir. not math:tap_psImageGeomManip.c209 In imageops/tap_psImageGeomManip.c 210 210 Only 64x128 images are used. 211 211 Only types F32 and S16 are tested 212 212 psImageRoll() 10 10 2 10 na 213 In imageops dir. not math:tap_psImageGeomManip.c213 In imageops/tap_psImageGeomManip.c 214 214 Only NxN square images are tested. 215 215 psImageTransform() 0 2 2 5 na 216 In imageops dir. not math:tap_psImageGeomManip.c216 In imageops/tap_psImageGeomManip.c 217 217 A single 16x32 input image of type F32 is used 218 218 No attempt at unallowed input params, types, or sizes. -
trunk/psLib/test/math/Makefile.am
r13127 r13337 42 42 tap_psStats08 \ 43 43 tap_psStats09 \ 44 tap_psStats10 \ 44 45 tap_psStatsTiming \ 45 46 tap_psFunc01 \ -
trunk/psLib/test/math/tap_psPolyFit1D.c
r13124 r13337 109 109 psVector *xTruth = psVectorAlloc(numData, PS_TYPE_F64); 110 110 psVector *fTruth = psVectorAlloc(numData, PS_TYPE_F64); 111 xTruth->n = numData;112 fTruth->n = numData;113 111 psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 1); // Using a known seed 114 112 for (int i = 0; i < numData; i++) { … … 350 348 psLogSetFormat("HLNM"); 351 349 psLogSetLevel(PS_LOG_INFO); 352 plan_tests(64); 350 plan_tests(104); 351 352 353 // psVectorFitPolynomial1D() 354 // Test various erroneous input paramater configurations 355 { 356 psMemId id = psMemGetId(); 357 psPolynomial1D *myPoly = psPolynomial1DAlloc(PS_POLYNOMIAL_ORD, POLY_ORDER); 358 psVector *x = psVectorAlloc(NUM_DATA, PS_TYPE_F32); 359 psVector *xS32 = psVectorAlloc(NUM_DATA, PS_TYPE_S32); 360 psVector *f = psVectorAlloc(NUM_DATA, PS_TYPE_F32); 361 psVector *fS32 = psVectorAlloc(NUM_DATA, PS_TYPE_S32); 362 psVector *mask = psVectorAlloc(NUM_DATA, PS_TYPE_U8); 363 psVector *maskS8 = psVectorAlloc(NUM_DATA, PS_TYPE_S8); 364 psVector *fErr = psVectorAlloc(NUM_DATA, PS_TYPE_F32); 365 psVector *fErrS32 = psVectorAlloc(NUM_DATA, PS_TYPE_S32); 366 367 368 // Set psPolynomial1D to NULL, should cause error 369 { 370 psMemId id = psMemGetId(); 371 bool rc = psVectorFitPolynomial1D(NULL, mask, MASK_VALUE, f, fErr, x); 372 ok(rc == false, "psVectorFitPolynomial1D() returned FALSE with NULL psPolynomial1D"); 373 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 374 } 375 376 377 // Set mask to incorrect type, should cause error 378 { 379 psMemId id = psMemGetId(); 380 bool rc = psVectorFitPolynomial1D(myPoly, maskS8, MASK_VALUE, f, fErr, x); 381 ok(rc == false, "psVectorFitPolynomial1D() returned FALSE with mask set to incorrect type"); 382 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 383 } 384 385 386 // Set f psVector to incorrect type, should cause error 387 { 388 psMemId id = psMemGetId(); 389 bool rc = psVectorFitPolynomial1D(myPoly, mask, MASK_VALUE, fS32, fErr, x); 390 ok(rc == false, "psVectorFitPolynomial1D() returned FALSE: Set f psVector to incorrect type"); 391 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 392 } 393 394 395 // Set fError vector to incorrect type, should cause error 396 { 397 psMemId id = psMemGetId(); 398 bool rc = psVectorFitPolynomial1D(myPoly, mask, MASK_VALUE, f, fErrS32, x); 399 ok(rc == false, "psVectorFitPolynomial1D() returned FALSE: Set fError vector to incorrect type"); 400 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 401 } 402 403 404 // Set x vector to incorrect type, should cause error 405 { 406 psMemId id = psMemGetId(); 407 bool rc = psVectorFitPolynomial1D(myPoly, mask, MASK_VALUE, f, fErr, xS32); 408 ok(rc == false, "psVectorFitPolynomial1D() returned FALSE: Set x vector to incorrect type"); 409 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 410 } 411 412 413 // Incorrect mask psVector size, should cause error 414 { 415 psMemId id = psMemGetId(); 416 mask->n++; 417 bool rc = psVectorFitPolynomial1D(myPoly, mask, MASK_VALUE, f, fErr, x); 418 mask->n--; 419 ok(rc == false, "psVectorFitPolynomial1D() returned FALSE: Incorrect mask psVector size"); 420 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 421 } 422 423 424 // Incorrect f psVector size, should cause error 425 { 426 psMemId id = psMemGetId(); 427 f->n++; 428 bool rc = psVectorFitPolynomial1D(myPoly, mask, MASK_VALUE, f, fErr, x); 429 f->n--; 430 ok(rc == false, "psVectorFitPolynomial1D() returned FALSE: Incorrect f psVector size"); 431 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 432 } 433 434 435 // Incorrect fErr psVector size, should cause error 436 { 437 psMemId id = psMemGetId(); 438 fErr->n++; 439 bool rc = psVectorFitPolynomial1D(myPoly, mask, MASK_VALUE, f, fErr, x); 440 fErr->n--; 441 ok(rc == false, "psVectorFitPolynomial1D() returned FALSE: Incorrect fErr psVector size"); 442 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 443 } 444 445 446 // Incorrect x psVector size, should cause error 447 { 448 psMemId id = psMemGetId(); 449 x->n++; 450 bool rc = psVectorFitPolynomial1D(myPoly, mask, MASK_VALUE, f, fErr, x); 451 x->n--; 452 ok(rc == false, "psVectorFitPolynomial1D() returned FALSE: Incorrect x psVector size"); 453 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 454 } 455 456 psFree(myPoly); 457 psFree(x); 458 psFree(xS32); 459 psFree(f); 460 psFree(fS32); 461 psFree(mask); 462 psFree(maskS8); 463 psFree(fErr); 464 psFree(fErrS32); 465 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 466 } 467 468 469 // psVectorClipFitPolynomial1D() 470 // Test various erroneous input paramater configurations 471 { 472 psMemId id = psMemGetId(); 473 psPolynomial1D *myPoly = psPolynomial1DAlloc(PS_POLYNOMIAL_ORD, POLY_ORDER); 474 psVector *x = psVectorAlloc(NUM_DATA, PS_TYPE_F32); 475 psVector *xS32 = psVectorAlloc(NUM_DATA, PS_TYPE_S32); 476 psVector *f = psVectorAlloc(NUM_DATA, PS_TYPE_F32); 477 psVector *fS32 = psVectorAlloc(NUM_DATA, PS_TYPE_S32); 478 psVector *mask = psVectorAlloc(NUM_DATA, PS_TYPE_U8); 479 psVector *maskS8 = psVectorAlloc(NUM_DATA, PS_TYPE_S8); 480 psVector *fErr = psVectorAlloc(NUM_DATA, PS_TYPE_F32); 481 psVector *fErrS32 = psVectorAlloc(NUM_DATA, PS_TYPE_S32); 482 psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN); 483 484 485 // Set psPolynomial1D to NULL, should cause error 486 { 487 psMemId id = psMemGetId(); 488 bool rc = psVectorClipFitPolynomial1D(NULL, stats, mask, MASK_VALUE, f, fErr, x); 489 ok(rc == false, "psVectorClipFitPolynomial1D() returned FALSE with NULL psPolynomial1D"); 490 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 491 } 492 493 494 // Set psStats to NULL, should cause error 495 { 496 psMemId id = psMemGetId(); 497 bool rc = psVectorClipFitPolynomial1D(myPoly, NULL, mask, MASK_VALUE, f, fErr, x); 498 ok(rc == false, "psVectorClipFitPolynomial1D() returned FALSE with NULL psStats"); 499 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 500 } 501 502 503 // Set mask to incorrect type, should cause error 504 { 505 psMemId id = psMemGetId(); 506 bool rc = psVectorClipFitPolynomial1D(myPoly, stats, maskS8, MASK_VALUE, f, fErr, x); 507 ok(rc == false, "psVectorClipFitPolynomial1D() returned FALSE with mask set to incorrect type"); 508 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 509 } 510 511 512 // Set f psVector to incorrect type, should cause error 513 { 514 psMemId id = psMemGetId(); 515 bool rc = psVectorClipFitPolynomial1D(myPoly, stats, mask, MASK_VALUE, fS32, fErr, x); 516 ok(rc == false, "psVectorClipFitPolynomial1D() returned FALSE: Set f psVector to incorrect type"); 517 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 518 } 519 520 521 // Set fError vector to incorrect type, should cause error 522 { 523 psMemId id = psMemGetId(); 524 bool rc = psVectorClipFitPolynomial1D(myPoly, stats, mask, MASK_VALUE, f, fErrS32, x); 525 ok(rc == false, "psVectorClipFitPolynomial1D() returned FALSE: Set fError vector to incorrect type"); 526 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 527 } 528 529 530 // Set x vector to incorrect type, should cause error 531 { 532 psMemId id = psMemGetId(); 533 bool rc = psVectorClipFitPolynomial1D(myPoly, stats, mask, MASK_VALUE, f, fErr, xS32); 534 ok(rc == false, "psVectorClipFitPolynomial1D() returned FALSE: Set x vector to incorrect type"); 535 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 536 } 537 538 539 // Incorrect mask psVector size, should cause error 540 { 541 psMemId id = psMemGetId(); 542 mask->n++; 543 bool rc = psVectorClipFitPolynomial1D(myPoly, stats, mask, MASK_VALUE, f, fErr, x); 544 mask->n--; 545 ok(rc == false, "psVectorClipFitPolynomial1D() returned FALSE: Incorrect mask psVector size"); 546 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 547 } 548 549 550 // Incorrect f psVector size, should cause error 551 { 552 psMemId id = psMemGetId(); 553 f->n++; 554 bool rc = psVectorClipFitPolynomial1D(myPoly, stats, mask, MASK_VALUE, f, fErr, x); 555 f->n--; 556 ok(rc == false, "psVectorClipFitPolynomial1D() returned FALSE: Incorrect f psVector size"); 557 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 558 } 559 560 561 // Incorrect fErr psVector size, should cause error 562 { 563 psMemId id = psMemGetId(); 564 fErr->n++; 565 bool rc = psVectorClipFitPolynomial1D(myPoly, stats, mask, MASK_VALUE, f, fErr, x); 566 fErr->n--; 567 ok(rc == false, "psVectorClipFitPolynomial1D() returned FALSE: Incorrect fErr psVector size"); 568 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 569 } 570 571 572 // Incorrect x psVector size, should cause error 573 { 574 psMemId id = psMemGetId(); 575 x->n++; 576 bool rc = psVectorClipFitPolynomial1D(myPoly, stats, mask, MASK_VALUE, f, fErr, x); 577 x->n--; 578 ok(rc == false, "psVectorClipFitPolynomial1D() returned FALSE: Incorrect x psVector size"); 579 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 580 } 581 582 psFree(myPoly); 583 psFree(x); 584 psFree(xS32); 585 psFree(f); 586 psFree(fS32); 587 psFree(mask); 588 psFree(maskS8); 589 psFree(fErr); 590 psFree(fErrS32); 591 psFree(stats); 592 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 593 } 353 594 354 595 // -
trunk/psLib/test/math/tap_psPolyFit2D.c
r13124 r13337 364 364 psLogSetFormat("HLNM"); 365 365 psLogSetLevel(PS_LOG_INFO); 366 plan_tests(44); 366 plan_tests(88); 367 368 369 // psVectorFitPolynomial2D() 370 // Test various erroneous input paramater configurations 371 { 372 psMemId id = psMemGetId(); 373 psPolynomial2D *myPoly = psPolynomial2DAlloc(PS_POLYNOMIAL_ORD, POLY_ORDER_X, POLY_ORDER_Y); 374 psVector *x = psVectorAlloc(NUM_DATA, PS_TYPE_F32); 375 psVector *xS32 = psVectorAlloc(NUM_DATA, PS_TYPE_S32); 376 psVector *y = psVectorAlloc(NUM_DATA, PS_TYPE_F32); 377 psVector *yS32 = psVectorAlloc(NUM_DATA, PS_TYPE_S32); 378 psVector *f = psVectorAlloc(NUM_DATA, PS_TYPE_F32); 379 psVector *fS32 = psVectorAlloc(NUM_DATA, PS_TYPE_S32); 380 psVector *mask = psVectorAlloc(NUM_DATA, PS_TYPE_U8); 381 psVector *maskS8 = psVectorAlloc(NUM_DATA, PS_TYPE_S8); 382 psVector *fErr = psVectorAlloc(NUM_DATA, PS_TYPE_F32); 383 psVector *fErrS32 = psVectorAlloc(NUM_DATA, PS_TYPE_S32); 384 385 386 // Set psPolynomial2D to NULL, should cause error 387 { 388 psMemId id = psMemGetId(); 389 bool rc = psVectorFitPolynomial2D(NULL, mask, MASK_VALUE, f, fErr, x, y); 390 ok(rc == false, "psVectorFitPolynomial2D() returned FALSE with NULL psPolynomial2D"); 391 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 392 } 393 394 395 // Set mask to incorrect type, should cause error 396 { 397 psMemId id = psMemGetId(); 398 bool rc = psVectorFitPolynomial2D(myPoly, maskS8, MASK_VALUE, f, fErr, x, y); 399 ok(rc == false, "psVectorFitPolynomial2D() returned FALSE with mask set to incorrect type"); 400 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 401 } 402 403 404 // Set f psVector to incorrect type, should cause error 405 { 406 psMemId id = psMemGetId(); 407 bool rc = psVectorFitPolynomial2D(myPoly, mask, MASK_VALUE, fS32, fErr, x, y); 408 ok(rc == false, "psVectorFitPolynomial2D() returned FALSE: Set f psVector to incorrect type"); 409 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 410 } 411 412 413 // Set fError vector to incorrect type, should cause error 414 { 415 psMemId id = psMemGetId(); 416 bool rc = psVectorFitPolynomial2D(myPoly, mask, MASK_VALUE, f, fErrS32, x, y); 417 ok(rc == false, "psVectorFitPolynomial2D() returned FALSE: Set fError vector to incorrect type"); 418 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 419 } 420 421 422 // Set x vector to incorrect type, should cause error 423 { 424 psMemId id = psMemGetId(); 425 bool rc = psVectorFitPolynomial2D(myPoly, mask, MASK_VALUE, f, fErr, xS32, y); 426 ok(rc == false, "psVectorFitPolynomial2D() returned FALSE: Set x vector to incorrect type"); 427 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 428 } 429 430 431 // Set y vector to incorrect type, should cause error 432 { 433 psMemId id = psMemGetId(); 434 bool rc = psVectorFitPolynomial2D(myPoly, mask, MASK_VALUE, f, fErr, x, yS32); 435 ok(rc == false, "psVectorFitPolynomial2D() returned FALSE: Set y vector to incorrect type"); 436 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 437 } 438 439 440 // Incorrect mask psVector size, should cause error 441 { 442 psMemId id = psMemGetId(); 443 mask->n++; 444 bool rc = psVectorFitPolynomial2D(myPoly, mask, MASK_VALUE, f, fErr, x, y); 445 mask->n--; 446 ok(rc == false, "psVectorFitPolynomial2D() returned FALSE: Incorrect mask psVector size"); 447 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 448 } 449 450 451 // Incorrect f psVector size, should cause error 452 { 453 psMemId id = psMemGetId(); 454 f->n++; 455 bool rc = psVectorFitPolynomial2D(myPoly, mask, MASK_VALUE, f, fErr, x, y); 456 f->n--; 457 ok(rc == false, "psVectorFitPolynomial2D() returned FALSE: Incorrect f psVector size"); 458 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 459 } 460 461 462 // Incorrect fErr psVector size, should cause error 463 { 464 psMemId id = psMemGetId(); 465 fErr->n++; 466 bool rc = psVectorFitPolynomial2D(myPoly, mask, MASK_VALUE, f, fErr, x, y); 467 fErr->n--; 468 ok(rc == false, "psVectorFitPolynomial2D() returned FALSE: Incorrect fErr psVector size"); 469 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 470 } 471 472 473 // Incorrect x psVector size, should cause error 474 { 475 psMemId id = psMemGetId(); 476 x->n++; 477 bool rc = psVectorFitPolynomial2D(myPoly, mask, MASK_VALUE, f, fErr, x, y); 478 x->n--; 479 ok(rc == false, "psVectorFitPolynomial2D() returned FALSE: Incorrect x psVector size"); 480 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 481 } 482 483 psFree(myPoly); 484 psFree(x); 485 psFree(xS32); 486 psFree(y); 487 psFree(yS32); 488 psFree(f); 489 psFree(fS32); 490 psFree(mask); 491 psFree(maskS8); 492 psFree(fErr); 493 psFree(fErrS32); 494 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 495 } 496 497 498 // psVectorClipFitPolynomial2D() 499 // Test various erroneous input paramater configurations 500 { 501 psMemId id = psMemGetId(); 502 psPolynomial2D *myPoly = psPolynomial2DAlloc(PS_POLYNOMIAL_ORD, POLY_ORDER_X, POLY_ORDER_Y); 503 psVector *x = psVectorAlloc(NUM_DATA, PS_TYPE_F32); 504 psVector *xS32 = psVectorAlloc(NUM_DATA, PS_TYPE_S32); 505 psVector *y = psVectorAlloc(NUM_DATA, PS_TYPE_F32); 506 psVector *yS32 = psVectorAlloc(NUM_DATA, PS_TYPE_S32); 507 psVector *f = psVectorAlloc(NUM_DATA, PS_TYPE_F32); 508 psVector *fS32 = psVectorAlloc(NUM_DATA, PS_TYPE_S32); 509 psVector *mask = psVectorAlloc(NUM_DATA, PS_TYPE_U8); 510 psVector *maskS8 = psVectorAlloc(NUM_DATA, PS_TYPE_S8); 511 psVector *fErr = psVectorAlloc(NUM_DATA, PS_TYPE_F32); 512 psVector *fErrS32 = psVectorAlloc(NUM_DATA, PS_TYPE_S32); 513 psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN); 514 515 516 // Set psPolynomial2D to NULL, should cause error 517 { 518 psMemId id = psMemGetId(); 519 bool rc = psVectorClipFitPolynomial2D(NULL, stats, mask, MASK_VALUE, f, fErr, x, y); 520 ok(rc == false, "psVectorClipFitPolynomial2D() returned FALSE with NULL psPolynomial2D"); 521 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 522 } 523 524 525 // Set psStats to NULL, should cause error 526 { 527 psMemId id = psMemGetId(); 528 bool rc = psVectorClipFitPolynomial2D(myPoly, NULL, mask, MASK_VALUE, f, fErr, x, y); 529 ok(rc == false, "psVectorClipFitPolynomial2D() returned FALSE with NULL psStats"); 530 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 531 } 532 533 534 // Set mask to incorrect type, should cause error 535 { 536 psMemId id = psMemGetId(); 537 bool rc = psVectorClipFitPolynomial2D(myPoly, stats, maskS8, MASK_VALUE, f, fErr, x, y); 538 ok(rc == false, "psVectorClipFitPolynomial2D() returned FALSE with mask set to incorrect type"); 539 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 540 } 541 542 543 // Set f psVector to incorrect type, should cause error 544 { 545 psMemId id = psMemGetId(); 546 bool rc = psVectorClipFitPolynomial2D(myPoly, stats, mask, MASK_VALUE, fS32, fErr, x, y); 547 ok(rc == false, "psVectorClipFitPolynomial2D() returned FALSE: Set f psVector to incorrect type"); 548 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 549 } 550 551 552 // Set fError vector to incorrect type, should cause error 553 { 554 psMemId id = psMemGetId(); 555 bool rc = psVectorClipFitPolynomial2D(myPoly, stats, mask, MASK_VALUE, f, fErrS32, x, y); 556 ok(rc == false, "psVectorClipFitPolynomial2D() returned FALSE: Set fError vector to incorrect type"); 557 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 558 } 559 560 561 // Set x vector to incorrect type, should cause error 562 { 563 psMemId id = psMemGetId(); 564 bool rc = psVectorClipFitPolynomial2D(myPoly, stats, mask, MASK_VALUE, f, fErr, xS32, y); 565 ok(rc == false, "psVectorClipFitPolynomial2D() returned FALSE: Set x vector to incorrect type"); 566 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 567 } 568 569 570 // Set y vector to incorrect type, should cause error 571 { 572 psMemId id = psMemGetId(); 573 bool rc = psVectorClipFitPolynomial2D(myPoly, stats, mask, MASK_VALUE, f, fErr, x, yS32); 574 ok(rc == false, "psVectorClipFitPolynomial2D() returned FALSE: Set y vector to incorrect type"); 575 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 576 } 577 578 579 // Incorrect mask psVector size, should cause error 580 { 581 psMemId id = psMemGetId(); 582 mask->n++; 583 bool rc = psVectorClipFitPolynomial2D(myPoly, stats, mask, MASK_VALUE, f, fErr, x, y); 584 mask->n--; 585 ok(rc == false, "psVectorClipFitPolynomial2D() returned FALSE: Incorrect mask psVector size"); 586 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 587 } 588 589 590 // Incorrect f psVector size, should cause error 591 { 592 psMemId id = psMemGetId(); 593 f->n++; 594 bool rc = psVectorClipFitPolynomial2D(myPoly, stats, mask, MASK_VALUE, f, fErr, x, y); 595 f->n--; 596 ok(rc == false, "psVectorClipFitPolynomial2D() returned FALSE: Incorrect f psVector size"); 597 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 598 } 599 600 601 // Incorrect fErr psVector size, should cause error 602 { 603 psMemId id = psMemGetId(); 604 fErr->n++; 605 bool rc = psVectorClipFitPolynomial2D(myPoly, stats, mask, MASK_VALUE, f, fErr, x, y); 606 fErr->n--; 607 ok(rc == false, "psVectorClipFitPolynomial2D() returned FALSE: Incorrect fErr psVector size"); 608 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 609 } 610 611 612 // Incorrect x psVector size, should cause error 613 { 614 psMemId id = psMemGetId(); 615 x->n++; 616 bool rc = psVectorClipFitPolynomial2D(myPoly, stats, mask, MASK_VALUE, f, fErr, x, y); 617 x->n--; 618 ok(rc == false, "psVectorClipFitPolynomial2D() returned FALSE: Incorrect x psVector size"); 619 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 620 } 621 622 psFree(myPoly); 623 psFree(x); 624 psFree(xS32); 625 psFree(y); 626 psFree(yS32); 627 psFree(f); 628 psFree(fS32); 629 psFree(mask); 630 psFree(maskS8); 631 psFree(fErr); 632 psFree(fErrS32); 633 psFree(stats); 634 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 635 } 636 367 637 368 638 // -
trunk/psLib/test/math/tap_psPolyFit3D.c
r13124 r13337 414 414 psLogSetFormat("HLNM"); 415 415 psLogSetLevel(PS_LOG_INFO); 416 plan_tests(52); 416 plan_tests(100); 417 418 419 // psVectorFitPolynomial3D() 420 // Test various erroneous input paramater configurations 421 { 422 psMemId id = psMemGetId(); 423 psPolynomial3D *myPoly = psPolynomial3DAlloc(PS_POLYNOMIAL_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z); 424 psVector *x = psVectorAlloc(NUM_DATA, PS_TYPE_F32); 425 psVector *xS32 = psVectorAlloc(NUM_DATA, PS_TYPE_S32); 426 psVector *y = psVectorAlloc(NUM_DATA, PS_TYPE_F32); 427 psVector *yS32 = psVectorAlloc(NUM_DATA, PS_TYPE_S32); 428 psVector *z = psVectorAlloc(NUM_DATA, PS_TYPE_F32); 429 psVector *zS32 = psVectorAlloc(NUM_DATA, PS_TYPE_S32); 430 psVector *f = psVectorAlloc(NUM_DATA, PS_TYPE_F32); 431 psVector *fS32 = psVectorAlloc(NUM_DATA, PS_TYPE_S32); 432 psVector *mask = psVectorAlloc(NUM_DATA, PS_TYPE_U8); 433 psVector *maskS8 = psVectorAlloc(NUM_DATA, PS_TYPE_S8); 434 psVector *fErr = psVectorAlloc(NUM_DATA, PS_TYPE_F32); 435 psVector *fErrS32 = psVectorAlloc(NUM_DATA, PS_TYPE_S32); 436 437 438 // Set psPolynomial3D to NULL, should cause error 439 { 440 psMemId id = psMemGetId(); 441 bool rc = psVectorFitPolynomial3D(NULL, mask, MASK_VALUE, f, fErr, x, y, z); 442 ok(rc == false, "psVectorFitPolynomial3D() returned FALSE with NULL psPolynomial3D"); 443 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 444 } 445 446 447 // Set mask to incorrect type, should cause error 448 { 449 psMemId id = psMemGetId(); 450 bool rc = psVectorFitPolynomial3D(myPoly, maskS8, MASK_VALUE, f, fErr, x, y, z); 451 ok(rc == false, "psVectorFitPolynomial3D() returned FALSE with mask set to incorrect type"); 452 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 453 } 454 455 456 // Set f psVector to incorrect type, should cause error 457 { 458 psMemId id = psMemGetId(); 459 bool rc = psVectorFitPolynomial3D(myPoly, mask, MASK_VALUE, fS32, fErr, x, y, z); 460 ok(rc == false, "psVectorFitPolynomial3D() returned FALSE: Set f psVector to incorrect type"); 461 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 462 } 463 464 465 // Set fError vector to incorrect type, should cause error 466 { 467 psMemId id = psMemGetId(); 468 bool rc = psVectorFitPolynomial3D(myPoly, mask, MASK_VALUE, f, fErrS32, x, y, z); 469 ok(rc == false, "psVectorFitPolynomial3D() returned FALSE: Set fError vector to incorrect type"); 470 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 471 } 472 473 474 // Set x vector to incorrect type, should cause error 475 { 476 psMemId id = psMemGetId(); 477 bool rc = psVectorFitPolynomial3D(myPoly, mask, MASK_VALUE, f, fErr, xS32, y, z); 478 ok(rc == false, "psVectorFitPolynomial3D() returned FALSE: Set x vector to incorrect type"); 479 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 480 } 481 482 483 // Set y vector to incorrect type, should cause error 484 { 485 psMemId id = psMemGetId(); 486 bool rc = psVectorFitPolynomial3D(myPoly, mask, MASK_VALUE, f, fErr, x, yS32, z); 487 ok(rc == false, "psVectorFitPolynomial3D() returned FALSE: Set y vector to incorrect type"); 488 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 489 } 490 491 492 // Set z vector to incorrect type, should cause error 493 { 494 psMemId id = psMemGetId(); 495 bool rc = psVectorFitPolynomial3D(myPoly, mask, MASK_VALUE, f, fErr, x, y, zS32); 496 ok(rc == false, "psVectorFitPolynomial3D() returned FALSE: Set z vector to incorrect type"); 497 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 498 } 499 500 501 // Incorrect mask psVector size, should cause error 502 { 503 psMemId id = psMemGetId(); 504 mask->n++; 505 bool rc = psVectorFitPolynomial3D(myPoly, mask, MASK_VALUE, f, fErr, x, y, z); 506 mask->n--; 507 ok(rc == false, "psVectorFitPolynomial3D() returned FALSE: Incorrect mask psVector size"); 508 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 509 } 510 511 512 // Incorrect f psVector size, should cause error 513 { 514 psMemId id = psMemGetId(); 515 f->n++; 516 bool rc = psVectorFitPolynomial3D(myPoly, mask, MASK_VALUE, f, fErr, x, y, z); 517 f->n--; 518 ok(rc == false, "psVectorFitPolynomial3D() returned FALSE: Incorrect f psVector size"); 519 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 520 } 521 522 523 // Incorrect fErr psVector size, should cause error 524 { 525 psMemId id = psMemGetId(); 526 fErr->n++; 527 bool rc = psVectorFitPolynomial3D(myPoly, mask, MASK_VALUE, f, fErr, x, y, z); 528 fErr->n--; 529 ok(rc == false, "psVectorFitPolynomial3D() returned FALSE: Incorrect fErr psVector size"); 530 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 531 } 532 533 534 // Incorrect x psVector size, should cause error 535 { 536 psMemId id = psMemGetId(); 537 x->n++; 538 bool rc = psVectorFitPolynomial3D(myPoly, mask, MASK_VALUE, f, fErr, x, y, z); 539 x->n--; 540 ok(rc == false, "psVectorFitPolynomial3D() returned FALSE: Incorrect x psVector size"); 541 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 542 } 543 544 psFree(myPoly); 545 psFree(x); 546 psFree(xS32); 547 psFree(y); 548 psFree(yS32); 549 psFree(z); 550 psFree(zS32); 551 psFree(f); 552 psFree(fS32); 553 psFree(mask); 554 psFree(maskS8); 555 psFree(fErr); 556 psFree(fErrS32); 557 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 558 } 559 560 561 // psVectorClipFitPolynomial3D() 562 // Test various erroneous input paramater configurations 563 { 564 psMemId id = psMemGetId(); 565 psPolynomial3D *myPoly = psPolynomial3DAlloc(PS_POLYNOMIAL_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z); 566 psVector *x = psVectorAlloc(NUM_DATA, PS_TYPE_F32); 567 psVector *xS32 = psVectorAlloc(NUM_DATA, PS_TYPE_S32); 568 psVector *y = psVectorAlloc(NUM_DATA, PS_TYPE_F32); 569 psVector *yS32 = psVectorAlloc(NUM_DATA, PS_TYPE_S32); 570 psVector *z = psVectorAlloc(NUM_DATA, PS_TYPE_F32); 571 psVector *zS32 = psVectorAlloc(NUM_DATA, PS_TYPE_S32); 572 psVector *f = psVectorAlloc(NUM_DATA, PS_TYPE_F32); 573 psVector *fS32 = psVectorAlloc(NUM_DATA, PS_TYPE_S32); 574 psVector *mask = psVectorAlloc(NUM_DATA, PS_TYPE_U8); 575 psVector *maskS8 = psVectorAlloc(NUM_DATA, PS_TYPE_S8); 576 psVector *fErr = psVectorAlloc(NUM_DATA, PS_TYPE_F32); 577 psVector *fErrS32 = psVectorAlloc(NUM_DATA, PS_TYPE_S32); 578 psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN); 579 580 581 // Set psPolynomial3D to NULL, should cause error 582 { 583 psMemId id = psMemGetId(); 584 bool rc = psVectorClipFitPolynomial3D(NULL, stats, mask, MASK_VALUE, f, fErr, x, y, z); 585 ok(rc == false, "psVectorClipFitPolynomial3D() returned FALSE with NULL psPolynomial3D"); 586 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 587 } 588 589 590 // Set psStats to NULL, should cause error 591 { 592 psMemId id = psMemGetId(); 593 bool rc = psVectorClipFitPolynomial3D(myPoly, NULL, mask, MASK_VALUE, f, fErr, x, y, z); 594 ok(rc == false, "psVectorClipFitPolynomial3D() returned FALSE with NULL psStats"); 595 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 596 } 597 598 599 // Set mask to incorrect type, should cause error 600 { 601 psMemId id = psMemGetId(); 602 bool rc = psVectorClipFitPolynomial3D(myPoly, stats, maskS8, MASK_VALUE, f, fErr, x, y, z); 603 ok(rc == false, "psVectorClipFitPolynomial3D() returned FALSE with mask set to incorrect type"); 604 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 605 } 606 607 608 // Set f psVector to incorrect type, should cause error 609 { 610 psMemId id = psMemGetId(); 611 bool rc = psVectorClipFitPolynomial3D(myPoly, stats, mask, MASK_VALUE, fS32, fErr, x, y, z); 612 ok(rc == false, "psVectorClipFitPolynomial3D() returned FALSE: Set f psVector to incorrect type"); 613 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 614 } 615 616 617 // Set fError vector to incorrect type, should cause error 618 { 619 psMemId id = psMemGetId(); 620 bool rc = psVectorClipFitPolynomial3D(myPoly, stats, mask, MASK_VALUE, f, fErrS32, x, y, z); 621 ok(rc == false, "psVectorClipFitPolynomial3D() returned FALSE: Set fError vector to incorrect type"); 622 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 623 } 624 625 626 // Set x vector to incorrect type, should cause error 627 { 628 psMemId id = psMemGetId(); 629 bool rc = psVectorClipFitPolynomial3D(myPoly, stats, mask, MASK_VALUE, f, fErr, xS32, y, z); 630 ok(rc == false, "psVectorClipFitPolynomial3D() returned FALSE: Set x vector to incorrect type"); 631 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 632 } 633 634 635 // Set y vector to incorrect type, should cause error 636 { 637 psMemId id = psMemGetId(); 638 bool rc = psVectorClipFitPolynomial3D(myPoly, stats, mask, MASK_VALUE, f, fErr, x, yS32, z); 639 ok(rc == false, "psVectorClipFitPolynomial3D() returned FALSE: Set y vector to incorrect type"); 640 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 641 } 642 643 644 // Set z vector to incorrect type, should cause error 645 { 646 psMemId id = psMemGetId(); 647 bool rc = psVectorClipFitPolynomial3D(myPoly, stats, mask, MASK_VALUE, f, fErr, x, y, zS32); 648 ok(rc == false, "psVectorClipFitPolynomial3D() returned FALSE: Set z vector to incorrect type"); 649 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 650 } 651 652 653 // Incorrect mask psVector size, should cause error 654 { 655 psMemId id = psMemGetId(); 656 mask->n++; 657 bool rc = psVectorClipFitPolynomial3D(myPoly, stats, mask, MASK_VALUE, f, fErr, x, y, z); 658 mask->n--; 659 ok(rc == false, "psVectorClipFitPolynomial3D() returned FALSE: Incorrect mask psVector size"); 660 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 661 } 662 663 664 // Incorrect f psVector size, should cause error 665 { 666 psMemId id = psMemGetId(); 667 f->n++; 668 bool rc = psVectorClipFitPolynomial3D(myPoly, stats, mask, MASK_VALUE, f, fErr, x, y, z); 669 f->n--; 670 ok(rc == false, "psVectorClipFitPolynomial3D() returned FALSE: Incorrect f psVector size"); 671 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 672 } 673 674 675 // Incorrect fErr psVector size, should cause error 676 { 677 psMemId id = psMemGetId(); 678 fErr->n++; 679 bool rc = psVectorClipFitPolynomial3D(myPoly, stats, mask, MASK_VALUE, f, fErr, x, y, z); 680 fErr->n--; 681 ok(rc == false, "psVectorClipFitPolynomial3D() returned FALSE: Incorrect fErr psVector size"); 682 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 683 } 684 685 686 // Incorrect x psVector size, should cause error 687 { 688 psMemId id = psMemGetId(); 689 x->n++; 690 bool rc = psVectorClipFitPolynomial3D(myPoly, stats, mask, MASK_VALUE, f, fErr, x, y, z); 691 x->n--; 692 ok(rc == false, "psVectorClipFitPolynomial3D() returned FALSE: Incorrect x psVector size"); 693 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 694 } 695 696 psFree(myPoly); 697 psFree(x); 698 psFree(xS32); 699 psFree(y); 700 psFree(yS32); 701 psFree(z); 702 psFree(zS32); 703 psFree(f); 704 psFree(fS32); 705 psFree(mask); 706 psFree(maskS8); 707 psFree(fErr); 708 psFree(fErrS32); 709 psFree(stats); 710 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 711 } 712 417 713 418 714 // -
trunk/psLib/test/math/tap_psPolyFit4D.c
r13124 r13337 472 472 psLogSetFormat("HLNM"); 473 473 psLogSetLevel(PS_LOG_INFO); 474 plan_tests(60); 475 474 plan_tests(112); 475 476 477 // psVectorFitPolynomial4D() 478 // Test various erroneous input paramater configurations 479 { 480 psMemId id = psMemGetId(); 481 psPolynomial4D *myPoly = psPolynomial4DAlloc(PS_POLYNOMIAL_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, POLY_ORDER_T); 482 psVector *x = psVectorAlloc(NUM_DATA, PS_TYPE_F32); 483 psVector *xS32 = psVectorAlloc(NUM_DATA, PS_TYPE_S32); 484 psVector *y = psVectorAlloc(NUM_DATA, PS_TYPE_F32); 485 psVector *yS32 = psVectorAlloc(NUM_DATA, PS_TYPE_S32); 486 psVector *z = psVectorAlloc(NUM_DATA, PS_TYPE_F32); 487 psVector *zS32 = psVectorAlloc(NUM_DATA, PS_TYPE_S32); 488 psVector *t = psVectorAlloc(NUM_DATA, PS_TYPE_F32); 489 psVector *tS32 = psVectorAlloc(NUM_DATA, PS_TYPE_S32); 490 psVector *f = psVectorAlloc(NUM_DATA, PS_TYPE_F32); 491 psVector *fS32 = psVectorAlloc(NUM_DATA, PS_TYPE_S32); 492 psVector *mask = psVectorAlloc(NUM_DATA, PS_TYPE_U8); 493 psVector *maskS8 = psVectorAlloc(NUM_DATA, PS_TYPE_S8); 494 psVector *fErr = psVectorAlloc(NUM_DATA, PS_TYPE_F32); 495 psVector *fErrS32 = psVectorAlloc(NUM_DATA, PS_TYPE_S32); 496 497 498 // Set psPolynomial4D to NULL, should cause error 499 { 500 psMemId id = psMemGetId(); 501 bool rc = psVectorFitPolynomial4D(NULL, mask, MASK_VALUE, f, fErr, x, y, z, t); 502 ok(rc == false, "psVectorFitPolynomial4D() returned FALSE with NULL psPolynomial4D"); 503 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 504 } 505 506 507 // Set mask to incorrect type, should cause error 508 { 509 psMemId id = psMemGetId(); 510 bool rc = psVectorFitPolynomial4D(myPoly, maskS8, MASK_VALUE, f, fErr, x, y, z, t); 511 ok(rc == false, "psVectorFitPolynomial4D() returned FALSE with mask set to incorrect type"); 512 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 513 } 514 515 516 // Set f psVector to incorrect type, should cause error 517 { 518 psMemId id = psMemGetId(); 519 bool rc = psVectorFitPolynomial4D(myPoly, mask, MASK_VALUE, fS32, fErr, x, y, z, t); 520 ok(rc == false, "psVectorFitPolynomial4D() returned FALSE: Set f psVector to incorrect type"); 521 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 522 } 523 524 525 // Set fError vector to incorrect type, should cause error 526 { 527 psMemId id = psMemGetId(); 528 bool rc = psVectorFitPolynomial4D(myPoly, mask, MASK_VALUE, f, fErrS32, x, y, z, t); 529 ok(rc == false, "psVectorFitPolynomial4D() returned FALSE: Set fError vector to incorrect type"); 530 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 531 } 532 533 534 // Set x vector to incorrect type, should cause error 535 { 536 psMemId id = psMemGetId(); 537 bool rc = psVectorFitPolynomial4D(myPoly, mask, MASK_VALUE, f, fErr, xS32, y, z, t); 538 ok(rc == false, "psVectorFitPolynomial4D() returned FALSE: Set x vector to incorrect type"); 539 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 540 } 541 542 543 // Set y vector to incorrect type, should cause error 544 { 545 psMemId id = psMemGetId(); 546 bool rc = psVectorFitPolynomial4D(myPoly, mask, MASK_VALUE, f, fErr, x, yS32, z, t); 547 ok(rc == false, "psVectorFitPolynomial4D() returned FALSE: Set y vector to incorrect type"); 548 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 549 } 550 551 552 // Set z vector to incorrect type, should cause error 553 { 554 psMemId id = psMemGetId(); 555 bool rc = psVectorFitPolynomial4D(myPoly, mask, MASK_VALUE, f, fErr, x, y, zS32, t); 556 ok(rc == false, "psVectorFitPolynomial4D() returned FALSE: Set z vector to incorrect type"); 557 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 558 } 559 560 561 // Set t vector to incorrect type, should cause error 562 { 563 psMemId id = psMemGetId(); 564 bool rc = psVectorFitPolynomial4D(myPoly, mask, MASK_VALUE, f, fErr, x, y, z, tS32); 565 ok(rc == false, "psVectorFitPolynomial4D() returned FALSE: Set t vector to incorrect type"); 566 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 567 } 568 569 570 // Incorrect mask psVector size, should cause error 571 { 572 psMemId id = psMemGetId(); 573 mask->n++; 574 bool rc = psVectorFitPolynomial4D(myPoly, mask, MASK_VALUE, f, fErr, x, y, z, t); 575 mask->n--; 576 ok(rc == false, "psVectorFitPolynomial4D() returned FALSE: Incorrect mask psVector size"); 577 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 578 } 579 580 581 // Incorrect f psVector size, should cause error 582 { 583 psMemId id = psMemGetId(); 584 f->n++; 585 bool rc = psVectorFitPolynomial4D(myPoly, mask, MASK_VALUE, f, fErr, x, y, z, t); 586 f->n--; 587 ok(rc == false, "psVectorFitPolynomial4D() returned FALSE: Incorrect f psVector size"); 588 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 589 } 590 591 592 // Incorrect fErr psVector size, should cause error 593 { 594 psMemId id = psMemGetId(); 595 fErr->n++; 596 bool rc = psVectorFitPolynomial4D(myPoly, mask, MASK_VALUE, f, fErr, x, y, z, t); 597 fErr->n--; 598 ok(rc == false, "psVectorFitPolynomial4D() returned FALSE: Incorrect fErr psVector size"); 599 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 600 } 601 602 603 // Incorrect x psVector size, should cause error 604 { 605 psMemId id = psMemGetId(); 606 x->n++; 607 bool rc = psVectorFitPolynomial4D(myPoly, mask, MASK_VALUE, f, fErr, x, y, z, t); 608 x->n--; 609 ok(rc == false, "psVectorFitPolynomial4D() returned FALSE: Incorrect x psVector size"); 610 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 611 } 612 613 psFree(myPoly); 614 psFree(x); 615 psFree(xS32); 616 psFree(y); 617 psFree(yS32); 618 psFree(z); 619 psFree(zS32); 620 psFree(t); 621 psFree(tS32); 622 psFree(f); 623 psFree(fS32); 624 psFree(mask); 625 psFree(maskS8); 626 psFree(fErr); 627 psFree(fErrS32); 628 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 629 } 630 631 632 // psVectorClipFitPolynomial4D() 633 // Test various erroneous input paramater configurations 634 { 635 psMemId id = psMemGetId(); 636 psPolynomial4D *myPoly = psPolynomial4DAlloc(PS_POLYNOMIAL_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, POLY_ORDER_T); 637 psVector *x = psVectorAlloc(NUM_DATA, PS_TYPE_F32); 638 psVector *xS32 = psVectorAlloc(NUM_DATA, PS_TYPE_S32); 639 psVector *y = psVectorAlloc(NUM_DATA, PS_TYPE_F32); 640 psVector *yS32 = psVectorAlloc(NUM_DATA, PS_TYPE_S32); 641 psVector *z = psVectorAlloc(NUM_DATA, PS_TYPE_F32); 642 psVector *zS32 = psVectorAlloc(NUM_DATA, PS_TYPE_S32); 643 psVector *t = psVectorAlloc(NUM_DATA, PS_TYPE_F32); 644 psVector *tS32 = psVectorAlloc(NUM_DATA, PS_TYPE_S32); 645 psVector *f = psVectorAlloc(NUM_DATA, PS_TYPE_F32); 646 psVector *fS32 = psVectorAlloc(NUM_DATA, PS_TYPE_S32); 647 psVector *mask = psVectorAlloc(NUM_DATA, PS_TYPE_U8); 648 psVector *maskS8 = psVectorAlloc(NUM_DATA, PS_TYPE_S8); 649 psVector *fErr = psVectorAlloc(NUM_DATA, PS_TYPE_F32); 650 psVector *fErrS32 = psVectorAlloc(NUM_DATA, PS_TYPE_S32); 651 psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN); 652 653 654 // Set psPolynomial4D to NULL, should cause error 655 { 656 psMemId id = psMemGetId(); 657 bool rc = psVectorClipFitPolynomial4D(NULL, stats, mask, MASK_VALUE, f, fErr, x, y, z, t); 658 ok(rc == false, "psVectorClipFitPolynomial4D() returned FALSE with NULL psPolynomial4D"); 659 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 660 } 661 662 663 // Set psStats to NULL, should cause error 664 { 665 psMemId id = psMemGetId(); 666 bool rc = psVectorClipFitPolynomial4D(myPoly, stats, mask, MASK_VALUE, f, fErr, x, y, z, t); 667 ok(rc == false, "psVectorClipFitPolynomial4D() returned FALSE with NULL psStats"); 668 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 669 } 670 671 672 // Set mask to incorrect type, should cause error 673 { 674 psMemId id = psMemGetId(); 675 bool rc = psVectorClipFitPolynomial4D(myPoly, stats, maskS8, MASK_VALUE, f, fErr, x, y, z, t); 676 ok(rc == false, "psVectorClipFitPolynomial4D() returned FALSE with mask set to incorrect type"); 677 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 678 } 679 680 681 // Set f psVector to incorrect type, should cause error 682 { 683 psMemId id = psMemGetId(); 684 bool rc = psVectorClipFitPolynomial4D(myPoly, stats, mask, MASK_VALUE, fS32, fErr, x, y, z, t); 685 ok(rc == false, "psVectorClipFitPolynomial4D() returned FALSE: Set f psVector to incorrect type"); 686 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 687 } 688 689 690 // Set fError vector to incorrect type, should cause error 691 { 692 psMemId id = psMemGetId(); 693 bool rc = psVectorClipFitPolynomial4D(myPoly, stats, mask, MASK_VALUE, f, fErrS32, x, y, z, t); 694 ok(rc == false, "psVectorClipFitPolynomial4D() returned FALSE: Set fError vector to incorrect type"); 695 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 696 } 697 698 699 // Set x vector to incorrect type, should cause error 700 { 701 psMemId id = psMemGetId(); 702 bool rc = psVectorClipFitPolynomial4D(myPoly, stats, mask, MASK_VALUE, f, fErr, xS32, y, z, t); 703 ok(rc == false, "psVectorClipFitPolynomial4D() returned FALSE: Set x vector to incorrect type"); 704 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 705 } 706 707 708 // Set y vector to incorrect type, should cause error 709 { 710 psMemId id = psMemGetId(); 711 bool rc = psVectorClipFitPolynomial4D(myPoly, stats, mask, MASK_VALUE, f, fErr, x, yS32, z, t); 712 ok(rc == false, "psVectorClipFitPolynomial4D() returned FALSE: Set y vector to incorrect type"); 713 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 714 } 715 716 717 // Set z vector to incorrect type, should cause error 718 { 719 psMemId id = psMemGetId(); 720 bool rc = psVectorClipFitPolynomial4D(myPoly, stats, mask, MASK_VALUE, f, fErr, x, y, zS32, t); 721 ok(rc == false, "psVectorClipFitPolynomial4D() returned FALSE: Set z vector to incorrect type"); 722 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 723 } 724 725 726 // Set t vector to incorrect type, should cause error 727 { 728 psMemId id = psMemGetId(); 729 bool rc = psVectorClipFitPolynomial4D(myPoly, stats, mask, MASK_VALUE, f, fErr, x, y, z, tS32); 730 ok(rc == false, "psVectorClipFitPolynomial4D() returned FALSE: Set t vector to incorrect type"); 731 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 732 } 733 734 735 // Incorrect mask psVector size, should cause error 736 { 737 psMemId id = psMemGetId(); 738 mask->n++; 739 bool rc = psVectorClipFitPolynomial4D(myPoly, stats, mask, MASK_VALUE, f, fErr, x, y, z, t); 740 mask->n--; 741 ok(rc == false, "psVectorClipFitPolynomial4D() returned FALSE: Incorrect mask psVector size"); 742 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 743 } 744 745 746 // Incorrect f psVector size, should cause error 747 { 748 psMemId id = psMemGetId(); 749 f->n++; 750 bool rc = psVectorClipFitPolynomial4D(myPoly, stats, mask, MASK_VALUE, f, fErr, x, y, z, t); 751 f->n--; 752 ok(rc == false, "psVectorClipFitPolynomial4D() returned FALSE: Incorrect f psVector size"); 753 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 754 } 755 756 757 // Incorrect fErr psVector size, should cause error 758 { 759 psMemId id = psMemGetId(); 760 fErr->n++; 761 bool rc = psVectorClipFitPolynomial4D(myPoly, stats, mask, MASK_VALUE, f, fErr, x, y, z, t); 762 fErr->n--; 763 ok(rc == false, "psVectorClipFitPolynomial4D() returned FALSE: Incorrect fErr psVector size"); 764 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 765 } 766 767 768 // Incorrect x psVector size, should cause error 769 { 770 psMemId id = psMemGetId(); 771 x->n++; 772 bool rc = psVectorClipFitPolynomial4D(myPoly, stats, mask, MASK_VALUE, f, fErr, x, y, z, t); 773 x->n--; 774 ok(rc == false, "psVectorClipFitPolynomial4D() returned FALSE: Incorrect x psVector size"); 775 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 776 } 777 778 psFree(myPoly); 779 psFree(x); 780 psFree(xS32); 781 psFree(y); 782 psFree(yS32); 783 psFree(z); 784 psFree(zS32); 785 psFree(t); 786 psFree(tS32); 787 psFree(f); 788 psFree(fS32); 789 psFree(mask); 790 psFree(maskS8); 791 psFree(fErr); 792 psFree(fErrS32); 793 psFree(stats); 794 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 795 } 796 797 476 798 // 477 799 // F32 tests: Ordinary polys, non-clip fit … … 696 1018 } 697 1019 1020
Note:
See TracChangeset
for help on using the changeset viewer.
