Changeset 13337 for trunk/psLib/test/math/tap_psPolyFit4D.c
- Timestamp:
- May 10, 2007, 10:17:52 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/math/tap_psPolyFit4D.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
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.
