Changeset 13337 for trunk/psLib/test/math/tap_psPolyFit3D.c
- Timestamp:
- May 10, 2007, 10:17:52 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/math/tap_psPolyFit3D.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
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 //
Note:
See TracChangeset
for help on using the changeset viewer.
