Changeset 1033
- Timestamp:
- Jun 14, 2004, 1:03:48 PM (22 years ago)
- Location:
- trunk/psLib/test
- Files:
-
- 3 edited
-
collections/tst_psList.c (modified) (2 diffs)
-
image/tst_psImage.c (modified) (6 diffs)
-
image/verified/tst_psImage.stderr (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/collections/tst_psList.c
r982 r1033 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 9$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-06-1 0 18:49:28$8 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-06-14 23:03:43 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 42 42 43 43 if (! runTestSuite(stderr,"psList",tests)) { 44 psAbort(__FILE__,"One or more tests failed"); 44 psError(__FILE__,"One or more tests failed"); 45 return 1; 45 46 } 46 47 return 0; -
trunk/psLib/test/image/tst_psImage.c
r981 r1033 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-06-1 0 18:48:35$8 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-06-14 23:03:43 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 43 43 testImageOverlay(); 44 44 if (! runTestSuite(stderr,"psImage",tests)) { 45 psAbort(__FILE__,"One or more tests failed"); 45 psError(__FILE__,"One or more tests failed"); 46 return 1; 46 47 } 47 48 return 0; … … 642 643 #define testImageClipByType(datatype) \ 643 644 img = psImageAlloc(c,r,PS_TYPE_##datatype); \ 644 for (unsigned row=0;row<r;row++) { \645 for (unsigned int row=0;row<r;row++) { \ 645 646 ps##datatype* imgRow = img->data.datatype[row]; \ 646 for (unsigned col=0;col<c;col++) { \647 for (unsigned int col=0;col<c;col++) { \ 647 648 imgRow[col] = (ps##datatype)(row+col); \ 648 649 } \ … … 654 655 \ 655 656 numClipped = 0; \ 656 for (unsigned row=0;row<r;row++) { \657 for (unsigned int row=0;row<r;row++) { \ 657 658 ps##datatype* imgRow = img->data.datatype[row]; \ 658 for (unsigned col=0;col<c;col++) { \659 for (unsigned int col=0;col<c;col++) { \ 659 660 ps##datatype value = (ps##datatype)(row+col); \ 660 661 if (value < (ps##datatype)min) { \ … … 666 667 } \ 667 668 if (fabsf(imgRow[col]-value) > FLT_EPSILON) { \ 668 psError(__func__,"Pixel value is not as expected (%d vs %d) at % d,%d", \669 psError(__func__,"Pixel value is not as expected (%d vs %d) at %u,%u", \ 669 670 imgRow[col],value,col,row); \ 670 671 return 1; \ … … 679 680 psImageFree(img); 680 681 682 #define testImageClipByComplexType(datatype) \ 683 img = psImageAlloc(c,r,PS_TYPE_##datatype); \ 684 for (unsigned int row=0;row<r;row++) { \ 685 ps##datatype* imgRow = img->data.datatype[row]; \ 686 for (unsigned int col=0;col<c;col++) { \ 687 imgRow[col] = (ps##datatype)(row+I*col); \ 688 } \ 689 } \ 690 min = (float)r/2.0f; \ 691 max = (float)r; \ 692 \ 693 retVal = psImageClip(img,min,-1.0f,max,-2.0f); \ 694 \ 695 numClipped = 0; \ 696 for (unsigned int row=0;row<r;row++) { \ 697 ps##datatype* imgRow = img->data.datatype[row]; \ 698 for (unsigned int col=0;col<c;col++) { \ 699 ps##datatype value = row+I*col; \ 700 if (cabs(value) < min) { \ 701 numClipped++; \ 702 value = -1.0f; \ 703 } else if (cabs(value) > max) { \ 704 numClipped++; \ 705 value = -2.0f; \ 706 } \ 707 if (fabsf(creal(imgRow[col])-creal(value)) > FLT_EPSILON || \ 708 fabsf(cimag(imgRow[col])-cimag(value)) > FLT_EPSILON) { \ 709 psError(__func__,"Pixel value is not as expected (%.2f+%.2fi vs %.2f+%.2fi) at %u,%u", \ 710 creal(imgRow[col]),cimag(imgRow[col]),creal(value),cimag(value),col,row); \ 711 return 1; \ 712 } \ 713 } \ 714 } \ 715 if (retVal != numClipped) { \ 716 psError(__func__,"Expected %d clips, but got %d", \ 717 numClipped,retVal); \ 718 return 2; \ 719 } \ 720 psImageFree(img); 721 722 psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of F64 imagery"); 681 723 testImageClipByType(F64); 724 psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of F32 imagery"); 682 725 testImageClipByType(F32); 683 testImageClipByType(S64);726 psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of S32 imagery"); 684 727 testImageClipByType(S32); 728 psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of S16 imagery"); 685 729 testImageClipByType(S16); 730 psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of S8 imagery"); 686 731 testImageClipByType(S8); 687 testImageClipByType(U64);732 psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of U32 imagery"); 688 733 testImageClipByType(U32); 734 psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of U16 imagery"); 689 735 testImageClipByType(U16); 736 psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of U8 imagery"); 690 737 testImageClipByType(U8); 738 psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of C32 imagery"); 739 testImageClipByComplexType(C32); 740 psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of C64 imagery"); 741 testImageClipByComplexType(C64); 691 742 692 743 // Verify the retuned integer is zero, psImage structure input is unmodified -
trunk/psLib/test/image/verified/tst_psImage.stderr
r1018 r1033 105 105 106 106 <DATE> <TIME> <HOST> |I| testImageClip|psImageClip shall limit the minimum and maximum data value within a psImage structure 107 <DATE> <TIME> <HOST> |I| testImageClip|Testing clipping of F64 imagery 108 <DATE> <TIME> <HOST> |I| testImageClip|Testing clipping of F32 imagery 109 <DATE> <TIME> <HOST> |I| testImageClip|Testing clipping of S32 imagery 110 <DATE> <TIME> <HOST> |I| testImageClip|Testing clipping of S16 imagery 111 <DATE> <TIME> <HOST> |I| testImageClip|Testing clipping of S8 imagery 112 <DATE> <TIME> <HOST> |I| testImageClip|Testing clipping of U32 imagery 113 <DATE> <TIME> <HOST> |I| testImageClip|Testing clipping of U16 imagery 114 <DATE> <TIME> <HOST> |I| testImageClip|Testing clipping of U8 imagery 115 <DATE> <TIME> <HOST> |I| testImageClip|Testing clipping of C32 imagery 116 <DATE> <TIME> <HOST> |I| testImageClip|Testing clipping of C64 imagery 107 117 <DATE> <TIME> <HOST> |I| testImageClip|Following should be an error (max<min) 108 118 <DATE> <TIME> <HOST> |E| psImageClip|psImageClip can not be invoked with max < min.
Note:
See TracChangeset
for help on using the changeset viewer.
