Changeset 4898 for trunk/psLib/test/sys/tst_psMemory.c
- Timestamp:
- Aug 29, 2005, 3:14:13 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/sys/tst_psMemory.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/sys/tst_psMemory.c
r4877 r4898 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-08- 25 23:42:07$8 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-08-30 01:14:13 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 35 35 static psS32 TPmemCorruption( void ); 36 36 static psS32 TPmultipleFree( void ); 37 static psS32 memCheckTypes( void ); 37 38 void memProblemCallback( psMemBlock *ptr, const char *filename, unsigned int lineno ); 38 39 … … 53 54 {TPFreeReferencedMemory, 456, "freeReferencedMemory", 0, false}, 54 55 {TPmultipleFree, 699, "multipleFree", -6, false}, 56 {memCheckTypes, 700, "psMemCheckType", 0, false}, 55 57 {NULL} 56 58 }; … … 534 536 return 0; 535 537 } 538 539 static psS32 memCheckTypes( void ) 540 { 541 // psArray *negative; 542 // negative = psArrayAlloc(2); 543 // psMetadata *neg; 544 // neg = psMetadataAlloc(); 545 546 psArray *array; 547 array = psArrayAlloc(100); 548 if ( !psMemCheckType(PS_DATA_ARRAY, array) ) { 549 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckArray failed in memCheckType. \n"); 550 psFree(array); 551 return 1; 552 } 553 // if ( psMemCheckType(PS_DATA_ARRAY, neg) ) 554 // { 555 // psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckArray failed in memCheckType. \n"); 556 // return 1; 557 // } 558 psFree(array); 559 560 psBitSet *bits; 561 bits = psBitSetAlloc(100); 562 if ( !psMemCheckType(PS_DATA_BITSET, bits) ) { 563 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckBitSet failed in memCheckType. \n"); 564 psFree(bits); 565 return 1; 566 } 567 // if ( psMemCheckType(PS_DATA_BITSET, negative) ) 568 // { 569 // psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckBitSet failed in memCheckType. \n"); 570 // return 1; 571 // } 572 psFree(bits); 573 574 psCube *cube; 575 cube = psCubeAlloc(); 576 if ( !psMemCheckType(PS_DATA_CUBE, cube) ) { 577 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckCube failed in memCheckType. \n"); 578 psFree(cube); 579 return 1; 580 } 581 psFree(cube); 582 583 /* 584 psFits *fits; 585 char *filename = ""; 586 fits = psFitsAlloc(filename); 587 if ( !psMemCheckType(PS_DATA_FITS, fits) ) 588 { 589 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckFits failed in memCheckType. \n"); 590 psFree(fits); 591 return 1; 592 } 593 psFree(fits); 594 */ 595 psHash *hash; 596 hash = psHashAlloc(100); 597 if ( !psMemCheckType(PS_DATA_HASH, hash) ) { 598 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckHash failed in memCheckType. \n"); 599 psFree(hash); 600 return 1; 601 } 602 psFree(hash); 603 604 psHistogram *histogram; 605 histogram = psHistogramAlloc(1.1, 2.2, 2); 606 if ( !psMemCheckType(PS_DATA_HISTOGRAM, histogram) ) { 607 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckHistogram failed in memCheckType. \n"); 608 psFree(histogram); 609 return 1; 610 } 611 psFree(histogram); 612 613 psImage *image; 614 image = psImageAlloc(5, 5, PS_TYPE_F32); 615 if ( !psMemCheckType(PS_DATA_IMAGE, image) ) { 616 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckImage failed in memCheckType. \n"); 617 psFree(image); 618 return 1; 619 } 620 psFree(image); 621 622 psKernel *kernel; 623 kernel = psKernelAlloc(0, 1, 0, 1); 624 if ( !psMemCheckType(PS_DATA_KERNEL, kernel) ) { 625 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckKernel failed in memCheckType. \n"); 626 psFree(kernel); 627 return 1; 628 } 629 psFree(kernel); 630 631 psList *list; 632 list = psListAlloc(NULL); 633 if ( !psMemCheckType(PS_DATA_LIST, list) ) { 634 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckList failed in memCheckType. \n"); 635 psFree(list); 636 return 1; 637 } 638 psFree(list); 639 640 /* 641 psLookupTable *lookup; 642 char *filename = ""; 643 char *format = "%d"; 644 lookup = psLookupTableAlloc(filename, format, 0); 645 if ( !psMemCheckType(PS_DATA_LOOKUPTABLE, lookup) ) 646 { 647 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckLookupTable failed in memCheckType. \n"); 648 psFree(lookup); 649 return 1; 650 } 651 psFree(lookup); 652 */ 653 psMetadata *metadata; 654 metadata = psMetadataAlloc(); 655 if ( !psMemCheckType(PS_DATA_METADATA, metadata) ) { 656 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckMetadata failed in memCheckType. \n"); 657 psFree(metadata); 658 return 1; 659 } 660 psFree(metadata); 661 662 psMetadataItem *metaItem; 663 metaItem = psMetadataItemAlloc("name", PS_DATA_S32, "COMMENT", 1); 664 if ( !psMemCheckType(PS_DATA_METADATAITEM, metaItem) ) { 665 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckMetadataItem failed in memCheckType. \n"); 666 psFree(metaItem); 667 return 1; 668 } 669 psFree(metaItem); 670 671 psMinimization *min; 672 min = psMinimizationAlloc(3, 0.1); 673 if ( !psMemCheckType(PS_DATA_MINIMIZATION, min) ) { 674 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckMinimization failed in memCheckType. \n"); 675 psFree(min); 676 return 1; 677 } 678 psFree(min); 679 680 psPixels *pixels; 681 pixels = psPixelsAlloc(100); 682 if ( !psMemCheckType(PS_DATA_PIXELS, pixels) ) { 683 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckPixels failed in memCheckType. \n"); 684 psFree(pixels); 685 return 1; 686 } 687 psFree(pixels); 688 689 psPlane *plane; 690 plane = psPlaneAlloc(); 691 if ( !psMemCheckType(PS_DATA_PLANE, plane) ) { 692 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckPlane failed in memCheckType. \n"); 693 psFree(plane); 694 return 1; 695 } 696 psFree(plane); 697 698 psPlaneDistort *planeDistort; 699 planeDistort = psPlaneDistortAlloc(1, 1, 1, 1); 700 if ( !psMemCheckType(PS_DATA_PLANEDISTORT, planeDistort) ) { 701 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckPlaneDistort failed in memCheckType. \n"); 702 psFree(planeDistort); 703 return 1; 704 } 705 psFree(planeDistort); 706 707 psPlaneTransform *planeTransform; 708 planeTransform = psPlaneTransformAlloc(1, 1); 709 if ( !psMemCheckType(PS_DATA_PLANETRANSFORM, planeTransform) ) { 710 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckPlaneTransform failed in memCheckType. \n"); 711 psFree(planeTransform); 712 return 1; 713 } 714 psFree(planeTransform); 715 716 psPolynomial1D *poly1; 717 poly1 = psPolynomial1DAlloc(2, PS_POLYNOMIAL_ORD); 718 if ( !psMemCheckType(PS_DATA_POLYNOMIAL1D, poly1) ) { 719 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckPolynomial1D failed in memCheckType. \n"); 720 psFree(poly1); 721 return 1; 722 } 723 psFree(poly1); 724 725 psPolynomial2D *poly2; 726 poly2 = psPolynomial2DAlloc(2, 1, PS_POLYNOMIAL_ORD); 727 if ( !psMemCheckType(PS_DATA_POLYNOMIAL2D, poly2) ) { 728 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckPolynomial2D failed in memCheckType. \n"); 729 psFree(poly2); 730 return 1; 731 } 732 psFree(poly2); 733 734 psPolynomial3D *poly3; 735 poly3 = psPolynomial3DAlloc(2, 1, 2, PS_POLYNOMIAL_ORD); 736 if ( !psMemCheckType(PS_DATA_POLYNOMIAL3D, poly3) ) { 737 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckPolynomial3D failed in memCheckType. \n"); 738 psFree(poly3); 739 return 1; 740 } 741 psFree(poly3); 742 743 psPolynomial4D *poly4; 744 poly4 = psPolynomial4DAlloc(2, 1, 2, 1, PS_POLYNOMIAL_ORD); 745 if ( !psMemCheckType(PS_DATA_POLYNOMIAL4D, poly4) ) { 746 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckPolynomial4D failed in memCheckType. \n"); 747 psFree(poly4); 748 return 1; 749 } 750 psFree(poly4); 751 752 psProjection *proj; 753 proj = psProjectionAlloc(1, 1, 2.1, 2.1, PS_PROJ_TAN); 754 if ( !psMemCheckType(PS_DATA_PROJECTION, proj) ) { 755 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckProjection failed in memCheckType. \n"); 756 psFree(proj); 757 return 1; 758 } 759 psFree(proj); 760 761 psScalar *scalar; 762 psC64 c64 = 1.1 + 7I; 763 scalar = psScalarAlloc(c64, PS_TYPE_F64); 764 if ( !psMemCheckType(PS_DATA_SCALAR, scalar) ) { 765 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckScalar failed in memCheckType. \n"); 766 psFree(scalar); 767 return 1; 768 } 769 psFree(scalar); 770 771 psSphere *sphere; 772 sphere = psSphereAlloc(); 773 if ( !psMemCheckType(PS_DATA_SPHERE, sphere) ) { 774 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckSphere failed in memCheckType. \n"); 775 psFree(sphere); 776 return 1; 777 } 778 psFree(sphere); 779 780 psSphereRot *sphereRot; 781 sphereRot = psSphereRotAlloc(0, 0, 20); 782 if ( !psMemCheckType(PS_DATA_SPHEREROT, sphereRot) ) { 783 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckSphereRot failed in memCheckType. \n"); 784 psFree(sphereRot); 785 return 1; 786 } 787 psFree(sphereRot); 788 789 psSpline1D *spline; 790 spline = psSpline1DAlloc(2, 1, 0, 2); 791 if ( !psMemCheckType(PS_DATA_SPLINE1D, spline) ) { 792 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckSpline1D failed in memCheckType. \n"); 793 psFree(spline); 794 return 1; 795 } 796 psFree(spline); 797 798 psStats *stats; 799 stats = psStatsAlloc(PS_STAT_MAX); 800 if ( !psMemCheckType(PS_DATA_STATS, stats) ) { 801 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckStats failed in memCheckType. \n"); 802 psFree(stats); 803 return 1; 804 } 805 psFree(stats); 806 807 /* psTime *time; 808 time = psTimeAlloc(PS_TIME_UT1); 809 if ( !psMemCheckType(PS_DATA_TIME, time) ) 810 { 811 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckTime failed in memCheckType. \n"); 812 psFree(time); 813 return 1; 814 } 815 psFree(time); 816 */ 817 psVector *vector; 818 vector = psVectorAlloc(100, PS_TYPE_F32); 819 if ( !psMemCheckType(PS_DATA_VECTOR, vector) ) { 820 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckVector failed in memCheckType. \n"); 821 psFree(vector); 822 return 1; 823 } 824 psFree(vector); 825 826 827 // psFree(negative); 828 // psFree(neg); 829 830 return 0; 831 }
Note:
See TracChangeset
for help on using the changeset viewer.
