Changeset 6770 for trunk/psLib/test/imageops/tst_psImagePixelExtract.c
- Timestamp:
- Apr 4, 2006, 12:04:46 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/imageops/tst_psImagePixelExtract.c
r6750 r6770 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $9 * @date $Date: 2006-04-0 1 02:43:57$8 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2006-04-04 22:04:46 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 773 773 int num = 0; 774 774 775 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message ");775 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message(for row)"); 776 776 out = psImageRow(NULL, image, num); 777 777 if (out != NULL) { 778 778 return 1; 779 779 } 780 780 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message(for col)"); 781 out = psImageCol(NULL, image, num); 782 if (out != NULL) { 783 return 1; 784 } 781 785 782 786 image = psImageAlloc(3, 3, PS_TYPE_F64); 787 788 //Test for invalid row0. 789 *(psS32*)&(image->row0) = -1; 790 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message(for row)"); 791 out = psImageRow(NULL, image, num); 792 if (out != NULL) { 793 return 2; 794 } 795 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message(for col)"); 796 out = psImageCol(NULL, image, num); 797 if (out != NULL) { 798 return 2; 799 } 800 801 //Test for invalid col0. 783 802 *(psS32*)&(image->row0) = 5; 803 *(psS32*)&(image->col0) = -1; 804 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message(for row)"); 805 out = psImageRow(NULL, image, num); 806 if (out != NULL) { 807 return 3; 808 } 809 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message(for col)"); 810 out = psImageCol(NULL, image, num); 811 if (out != NULL) { 812 return 3; 813 } 814 815 //Test for invalid numRows 784 816 *(psS32*)&(image->col0) = 10; 817 *(int*)&(image->numRows) = -1; 818 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message(for row)"); 819 out = psImageRow(NULL, image, num); 820 if (out != NULL) { 821 return 4; 822 } 823 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message(for col)"); 824 out = psImageCol(NULL, image, num); 825 if (out != NULL) { 826 return 4; 827 } 828 //Test for invalid numCols 829 *(int*)&(image->numRows) = 3; 830 *(int*)&(image->numCols) = -1; 831 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message(for row)"); 832 out = psImageRow(NULL, image, num); 833 if (out != NULL) { 834 return 5; 835 } 836 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message(for col)"); 837 out = psImageCol(NULL, image, num); 838 if (out != NULL) { 839 return 5; 840 } 841 //Test for invalid row/col number specified. 842 *(int*)&(image->numCols) = 3; 843 num = 8; 844 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message(for row)"); 845 out = psImageRow(NULL, image, num); 846 if (out != NULL) { 847 return 6; 848 } 849 num = 13; 850 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message(for col)"); 851 out = psImageCol(NULL, image, num); 852 if (out != NULL) { 853 return 6; 854 } 855 num = 3; 856 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message(for row)"); 857 out = psImageRow(NULL, image, num); 858 if (out != NULL) { 859 return 7; 860 } 861 num = 8; 862 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message(for col)"); 863 out = psImageCol(NULL, image, num); 864 if (out != NULL) { 865 return 7; 866 } 867 num = -10; 868 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message(for row)"); 869 out = psImageRow(NULL, image, num); 870 if (out != NULL) { 871 return 8; 872 } 873 num = -14; 874 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message(for col)"); 875 out = psImageCol(NULL, image, num); 876 if (out != NULL) { 877 return 8; 878 } 879 880 //Test valid cases. 881 image->col0 = 10; 882 image->row0 = 5; 883 *(int*)&(image->numRows) = 3; 884 *(int*)&(image->numCols) = 3; 785 885 image->data.F64[0][0] = 666.666; 786 886 image->data.F64[1][0] = 66.6; … … 792 892 image->data.F64[1][2] = 666.66; 793 893 image->data.F64[2][2] = 66.66; 794 795 796 894 num = 7; 895 out = psImageRow(out, image, num); 896 if (out == NULL) { 897 psError(PS_ERR_BAD_PARAMETER_NULL, false, 898 "psImageRow failed to return correct psVector output.\n"); 899 return 10; 900 } else { 901 psFree(out); 902 out = NULL; 903 } 904 num = 11; 905 out = psImageCol(NULL, image, num); 906 if (out == NULL) { 907 psError(PS_ERR_BAD_PARAMETER_NULL, false, 908 "psImageCol failed to return correct psVector output.\n"); 909 return 10; 910 } else { 911 psFree(out); 912 out = NULL; 913 } 914 915 num = -3; 916 out = psImageRow(out, image, num); 917 if (out == NULL) { 918 psError(PS_ERR_BAD_PARAMETER_NULL, false, 919 "psImageRow failed to return correct psVector output.\n"); 920 return 10; 921 } else { 922 psFree(out); 923 out = NULL; 924 } 925 num = -1; 926 out = psImageCol(NULL, image, num); 927 if (out == NULL) { 928 psError(PS_ERR_BAD_PARAMETER_NULL, false, 929 "psImageCol failed to return correct psVector output.\n"); 930 return 10; 931 } 797 932 psFree(out); 798 933 psFree(image);
Note:
See TracChangeset
for help on using the changeset viewer.
