Changeset 7071 for trunk/psLib/test/imageops
- Timestamp:
- May 4, 2006, 4:48:35 PM (20 years ago)
- Location:
- trunk/psLib/test/imageops
- Files:
-
- 2 edited
-
tst_psImageSmooth.c (modified) (6 diffs)
-
tst_psImageStructManip.c (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/imageops/tst_psImageSmooth.c
r6280 r7071 5 5 * @author GLG, MHPCC 6 6 * 7 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $8 * @date $Date: 2006-0 2-01 21:35:59$7 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2006-05-05 02:48:34 $ 9 9 * 10 10 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 83 83 } 84 84 if (VERBOSE) { 85 p_psImagePrint(1, img, "The Sm mothed Image");85 p_psImagePrint(1, img, "The Smoothed Image"); 86 86 } 87 87 … … 132 132 } 133 133 if (VERBOSE) { 134 p_psImagePrint(1, img, "The Sm mothed Image");134 p_psImagePrint(1, img, "The Smoothed Image"); 135 135 } 136 136 … … 139 139 for (psS32 j = 1 ; j < numCols-1 ; j++) { 140 140 if ((fabs(img->data.F32[i][j] - 0.5) > 0.1)) { 141 printf("TEST ERROR: img[%d][%d] was %f, expected 0.5\n", i, j, img->data.F32[i][j]); 141 printf("TEST ERROR: img[%d][%d] was %f, expected 0.5\n", 142 i, j, img->data.F32[i][j]); 142 143 testStatus = false; 143 144 } … … 150 151 for (psS32 j = 1 ; j < numCols-1 ; j++) { 151 152 if ((fabs(img->data.F64[i][j] - 0.5) > 0.1)) { 152 printf("TEST ERROR: img[%d][%d] was %f, expected 0.5\n", i, j, img->data.F64[i][j]); 153 printf("TEST ERROR: img[%d][%d] was %f, expected 0.5\n", 154 i, j, img->data.F64[i][j]); 153 155 testStatus = false; 154 156 } … … 161 163 return(testStatus); 162 164 } 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 165 185 166 static psS32 testImageSmooth() -
trunk/psLib/test/imageops/tst_psImageStructManip.c
r4547 r7071 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $9 * @date $Date: 200 5-07-13 02:47:00$8 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2006-05-05 02:48:34 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 62 62 subset3 = psImageSubset(original,region1); 63 63 64 psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure members nrow and ncol are equal to " 64 psLogMsg(__func__,PS_LOG_INFO, 65 "Verify the returned psImage structure members nrow and ncol are equal to " 65 66 "the input parameter nrow and ncol respectively."); 66 67 67 68 if (subset2->numCols != c/2 || subset2->numRows != r/2) { 68 psError(PS_ERR_UNKNOWN,true,"psImageSubset output size was not proper(%dx%d, should be %dx%d).", 69 psError(PS_ERR_UNKNOWN,true, 70 "psImageSubset output size was not proper(%dx%d, should be %dx%d).", 69 71 subset2->numCols, subset2->numRows, c/2,r/2); 70 72 return 1; … … 72 74 73 75 if (subset3->numCols != c/2 || subset3->numRows != r/2) { 74 psError(PS_ERR_UNKNOWN,true,"psImageSubset output size was not proper(%dx%d, should be %dx%d).", 76 psError(PS_ERR_UNKNOWN,true, 77 "psImageSubset output size was not proper(%dx%d, should be %dx%d).", 75 78 subset3->numCols, subset3->numRows, c/2,r/2); 76 79 return 2; 77 80 } 78 81 79 psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure contains expected values in the " 82 psLogMsg(__func__,PS_LOG_INFO, 83 "Verify the returned psImage structure contains expected values in the " 80 84 "row member, if the input psImage structure image contains known values."); 81 85 … … 95 99 } 96 100 97 psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure member type is equal to the input " 101 psLogMsg(__func__,PS_LOG_INFO, 102 "Verify the returned psImage structure member type is equal to the input " 98 103 "psImage structure member type."); 99 104 … … 109 114 } 110 115 111 psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure members row0 and col0 are equal to " 116 psLogMsg(__func__,PS_LOG_INFO, 117 "Verify the returned psImage structure members row0 and col0 are equal to " 112 118 "the input parameters row0 and col0 respectively."); 113 119 114 120 if (subset2->col0 != c/4 || subset2->row0 != r/4) { 115 psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't set col0/row0 for subset2 (%d/%d, should be %d/%d).", 121 psError(PS_ERR_UNKNOWN,true, 122 "psImageSubset didn't set col0/row0 for subset2 (%d/%d, should be %d/%d).", 116 123 subset2->col0,subset2->row0,c/4,r/4); 117 124 return 8; 118 125 } 119 126 if (subset3->col0 != 0 || subset3->row0 != 0) { 120 psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't set col0/row0 for subset3 (%d/%d, should be %d/%d).", 127 psError(PS_ERR_UNKNOWN,true, 128 "psImageSubset didn't set col0/row0 for subset3 (%d/%d, should be %d/%d).", 121 129 subset3->col0,subset3->row0,0,0); 122 130 return 9; 123 131 } 124 132 125 psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure member parent is equal to the " 133 psLogMsg(__func__,PS_LOG_INFO, 134 "Verify the returned psImage structure member parent is equal to the " 126 135 "input psImage structure pointer image."); 127 136 … … 138 147 } 139 148 140 psLogMsg(__func__,PS_LOG_INFO,"Verify the input psImage structure image only has the following members " 149 psLogMsg(__func__,PS_LOG_INFO, 150 "Verify the input psImage structure image only has the following members " 141 151 "changed: 1) Nchildren is increased by one. 2) parent contains pointer psImage structure " 142 152 "out at parent[Nchildren-1]."); 143 153 144 154 if (original->children == NULL || original->children->n != 2) { 145 psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't increment number of children by one per subset."); 155 psError(PS_ERR_UNKNOWN,true, 156 "psImageSubset didn't increment number of children by one per subset."); 146 157 return 12; 147 158 } … … 180 191 } 181 192 if (memcmp(original,&preSubsetStruct,sizeof(psImage)) != 0) { 182 psError(PS_ERR_UNKNOWN,true,"psImageSubset changed the original struct though it failed to subset."); 193 psError(PS_ERR_UNKNOWN,true, 194 "psImageSubset changed the original struct though it failed to subset."); 183 195 return 17; 184 196 } 185 197 186 198 187 psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure pointer is null and program " 188 "execution doesn't stop, if the input parameters row0 and col0 are not within the range of " 189 "values of psImage structure image."); 199 psLogMsg(__func__,PS_LOG_INFO, 200 "Verify the returned psImage structure pointer is null and program " 201 "execution doesn't stop, if the input parameters row0 and col0 are not within " 202 "the range of values of psImage structure image."); 190 203 191 204 psLogMsg(__func__,PS_LOG_INFO,"An error should follow..."); 192 205 subset1 = psImageSubset(original, psRegionSet(0,c/2, 0,r*2)); 193 206 if (subset1 != NULL) { 194 psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't return NULL when subset origin was outside of " 207 psError(PS_ERR_UNKNOWN,true, 208 "psImageSubset didn't return NULL when subset origin was outside of " 195 209 "image (via cols)."); 196 210 return 18; … … 199 213 subset1 = psImageSubset(original,psRegionSet(0,c*2,0,r/2)); 200 214 if (subset1 != NULL) { 201 psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't return NULL when subset origin was outside of " 215 psError(PS_ERR_UNKNOWN,true, 216 "psImageSubset didn't return NULL when subset origin was outside of " 202 217 "image (via rows)."); 203 218 return 19; … … 206 221 subset1 = psImageSubset(original, psRegionSet(-1,c/2,0,r/2)); 207 222 if (subset1 != NULL) { 208 psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't return NULL when subset origin was outside of " 223 psError(PS_ERR_UNKNOWN,true, 224 "psImageSubset didn't return NULL when subset origin was outside of " 209 225 "image (col0=-1)."); 210 226 return 20; … … 213 229 subset1 = psImageSubset(original, psRegionSet(0,c/2,-1,r/2)); 214 230 if (subset1 != NULL) { 215 psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't return NULL when subset origin was outside of " 231 psError(PS_ERR_UNKNOWN,true, 232 "psImageSubset didn't return NULL when subset origin was outside of " 216 233 "image (row0=-1)."); 217 234 return 21; 218 235 } 219 236 220 psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure pointer is null and program " 221 "execution doesn't stop if the input parameters nrow, ncol, row0 and col0 specify a range of " 222 "data not within the input psImage structure image. Also verify the input psImage structure " 223 "is not modified."); 237 psLogMsg(__func__,PS_LOG_INFO, 238 "Verify the returned psImage structure pointer is null and program " 239 "execution doesn't stop if the input parameters nrow, ncol, row0 and col0 " 240 "specify a range of data not within the input psImage structure image. Also " 241 "verify the input psImage structure is not modified."); 224 242 225 243 psLogMsg(__func__,PS_LOG_INFO,"An error should follow..."); 226 244 subset1 = psImageSubset(original,psRegionSet(0,c/2,0,r+1)); 227 245 if (subset1 != NULL) { 228 psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't return NULL when subset was outside of image (via rows)."); 246 psError(PS_ERR_UNKNOWN,true, 247 "psImageSubset didn't return NULL when subset was outside of image (via rows)."); 229 248 return 22; 230 249 } … … 232 251 subset1 = psImageSubset(original, psRegionSet(0,c+1,0,r/2)); 233 252 if (subset1 != NULL) { 234 psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't return NULL when subset was outside of image (via cols)."); 253 psError(PS_ERR_UNKNOWN,true, 254 "psImageSubset didn't return NULL when subset was outside of image (via cols)."); 235 255 return 23; 236 256 } … … 238 258 subset1 = psImageSubset(original,psRegionSet(0,c+1,0,r+1)); 239 259 if (subset1 != NULL) { 240 psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't return NULL when subset was outside of image (via row+cols)."); 260 psError(PS_ERR_UNKNOWN,true, 261 "psImageSubset didn't return NULL when subset was outside of image (via row+cols)."); 241 262 return 24; 242 263 } 243 264 244 psLogMsg(__func__, PS_LOG_INFO, "psImageFreeChildren shall deallocate any children images of a " 265 psLogMsg(__func__, PS_LOG_INFO, 266 "psImageFreeChildren shall deallocate any children images of a " 245 267 "psImage structure"); 246 268 … … 251 273 // Verify the returned psImage structure member Nchildren is set to zero. 252 274 if (original->children != NULL && original->children->n > 0) { 253 psError(PS_ERR_UNKNOWN,true,"psImageFreeChildren didn't set number of children to zero."); 275 psError(PS_ERR_UNKNOWN,true, 276 "psImageFreeChildren didn't set number of children to zero."); 254 277 return 25; 255 278 } 256 279 257 //Verify the returned psImage structure members type, nrow, ncol, row0, col0, rows and parent are not258 // modified.280 //Verify the returned psImage structure members type, nrow, ncol, row0, col0, rows 281 // and parent are not modified. 259 282 if (preSubsetStruct.numRows != original->numRows || 260 283 preSubsetStruct.numCols != original->numCols || … … 262 285 preSubsetStruct.col0 != original->col0) { 263 286 264 psError(PS_ERR_UNKNOWN,true,"psImageFreeChildren modified parent's non-children elements."); 287 psError(PS_ERR_UNKNOWN,true, 288 "psImageFreeChildren modified parent's non-children elements."); 265 289 return 27; 266 290 } … … 352 376 } \ 353 377 if (abs(img2Row[col] - (ps##OUT)(imgRow[col])) > 0.5) { \ 354 psError(PS_ERR_UNKNOWN, true,"returned psImage values after copy don't match at %d,%d " \ 378 psError(PS_ERR_UNKNOWN, true, \ 379 "returned psImage values after copy don't match at %d,%d " \ 355 380 "(%d vs %d)",\ 356 381 col,row,img2Row[col], (ps##OUT)(imgRow[col])); \ … … 456 481 for (psS32 row = 0; row < image2->numRows; row++) { 457 482 for (psS32 col = 0; col < image2->numCols; col++) { 458 if (fabsf(image2->data.F32[row][col] - image->data.F32[row+qtrR][col+qtrC]) > FLT_EPSILON) { 483 if (fabsf(image2->data.F32[row][col] - image->data.F32[row+qtrR][col+qtrC]) 484 > FLT_EPSILON) { 459 485 psLogMsg(__func__,PS_LOG_ERROR, 460 486 "The value at (%d,%d) was %g, but should be %g.",
Note:
See TracChangeset
for help on using the changeset viewer.
