Changeset 4886
- Timestamp:
- Aug 25, 2005, 5:35:03 PM (21 years ago)
- Location:
- trunk/psLib
- Files:
-
- 4 edited
-
src/mathtypes/psImage.c (modified) (4 diffs)
-
src/mathtypes/psImage.h (modified) (1 diff)
-
test/mathtypes/tst_psImage.c (modified) (4 diffs)
-
test/mathtypes/verified/tst_psImage.stderr (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/mathtypes/psImage.c
r4815 r4886 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1.7 5$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-08- 18 21:44:40$11 * @version $Revision: 1.76 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-08-26 03:35:02 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 209 209 psF32 vF32; 210 210 psF64 vF64; 211 int temp; 211 212 212 213 if (image == NULL) … … 217 218 switch (image->type.type) { 218 219 case PS_TYPE_U8: 219 vU8 = va_arg (argp, psU32); 220 220 temp = va_arg (argp, psU32); 221 if ( temp >= 0 || temp <= 255 ) 222 vU8 = temp; 223 else 224 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Error: U8 Value out of Range.\n"); 221 225 for (int iy = 0; iy < image->numRows; iy++) { 222 226 for (int ix = 0; ix < image->numCols; ix++) { … … 224 228 } 225 229 } 226 break;230 return (true); 227 231 228 232 case PS_TYPE_F32: -
trunk/psLib/src/mathtypes/psImage.h
r4815 r4886 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.6 2$ $Name: not supported by cvs2svn $14 * @date $Date: 2005-08- 18 21:44:40$13 * @version $Revision: 1.63 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2005-08-26 03:35:02 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii -
trunk/psLib/test/mathtypes/tst_psImage.c
r4547 r4886 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-0 7-13 02:47:00$8 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-08-26 03:35:03 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 23 23 static psS32 testImageAlloc(void); 24 24 static psS32 testRegion(void); 25 static psS32 testRegion2(void); 26 static psS32 testRegion3(void); 27 static psS32 testImageInit(void); 25 28 26 29 testDescription tests[] = { … … 29 32 {testRegion,790,"psRegionSet",0,false}, 30 33 {testRegion,791,"psRegionFromString",0,true}, 34 {testRegion2,792,"psRegionForImage",0,false}, 35 {testRegion3,793,"psRegionForSquare",0,false}, 36 {testImageInit,794,"psImageInit",0,false}, 31 37 {NULL} 32 38 }; … … 275 281 return 0; 276 282 } 283 284 //psRegionForImage// 285 static psS32 testRegion2(void) 286 { 287 psImage *in = NULL; 288 psRegion *inReg; 289 psRegion out; 290 in = psImageAlloc(1, 1, PS_TYPE_S32); 291 *inReg = psRegionSet(1, 2, 1, 2); 292 out = psRegionForImage(in, inReg); 293 psRegion *inReg2; 294 psRegion out2; 295 *inReg2 = psRegionSet(-1, 0, -2, -1); 296 out2 = psRegionForImage(in, inReg2); 297 if( out.x0 != 1 || out.x1 != 1 || out.y0 != 1 || out.y1 != 1 ) { 298 psError(PS_ERR_UNKNOWN, true, "Error: Region For Image returned incorrect values.\n"); 299 } 300 if( out2.x0 != 0 || out2.x1 != 1 || out2.y0 != 0 || out2.y1 != 0 ) { 301 psError(PS_ERR_UNKNOWN, true, "Error: Region For Image returned incorrect values.\n"); 302 } 303 psFree(in); 304 return 0; 305 } 306 307 //psRegionForSquare// 308 static psS32 testRegion3(void) 309 { 310 float X = 1; 311 float Y = 1; 312 float RAD = 1; 313 psRegion out; 314 out = psRegionForSquare(X, Y, RAD); 315 if (out.x0 != 0 || out.x1 != 3 || out.y0 != 0 || out.y1!= 3) 316 psError(PS_ERR_UNKNOWN, true, "Error: Region For Square returned incorrect values.\n"); 317 return 0; 318 } 319 320 //Initialize an image with a given value.// 321 static psS32 testImageInit(void) 322 { 323 psImage *in1 = NULL; 324 psImage *in2 = NULL; 325 psImage *in3 = NULL; 326 psImage *in4 = NULL; 327 int nRow = 1; 328 int nCol = 1; 329 in1 = psImageAlloc(nRow, nCol, PS_TYPE_U8); 330 if ( !psImageInit(in1, 1 ) ) { 331 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "ImageInit failed. U8 Case - 1x1\n"); 332 } 333 nRow = 5; 334 in2 = psImageAlloc(nRow, nCol, PS_TYPE_F32); 335 if ( !psImageInit(in2, 3) ) { 336 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "ImageInit failed. F32 Case - 5x1\n"); 337 } 338 nCol = 5; 339 in3 = psImageAlloc(nRow, nCol, PS_TYPE_F64); 340 if ( !psImageInit(in3, 3.141) ) { 341 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "ImageInit failed. F64 Case - 5x5\n"); 342 } 343 in4 = psImageAlloc(nRow, nCol, PS_TYPE_S32); 344 if ( !psImageInit(in4, 3) ) { 345 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "ImageInit failed. S32 Case - 5x5\n"); 346 } 347 psFree(in1); 348 psFree(in2); 349 psFree(in3); 350 psFree(in4); 351 return 0; 352 } 353 -
trunk/psLib/test/mathtypes/verified/tst_psImage.stderr
r4547 r4886 97 97 ---> TESTPOINT PASSED (psImage{psRegionSet} | tst_psImage.c) 98 98 99 /***************************** TESTPOINT ******************************************\ 100 * TestFile: tst_psImage.c * 101 * TestPoint: psImage{psRegionForImage} * 102 * TestType: Positive * 103 \**********************************************************************************/ 104 105 106 ---> TESTPOINT PASSED (psImage{psRegionForImage} | tst_psImage.c) 107 108 /***************************** TESTPOINT ******************************************\ 109 * TestFile: tst_psImage.c * 110 * TestPoint: psImage{psRegionForSquare} * 111 * TestType: Positive * 112 \**********************************************************************************/ 113 114 115 ---> TESTPOINT PASSED (psImage{psRegionForSquare} | tst_psImage.c) 116 117 /***************************** TESTPOINT ******************************************\ 118 * TestFile: tst_psImage.c * 119 * TestPoint: psImage{psImageInit} * 120 * TestType: Positive * 121 \**********************************************************************************/ 122 123 <DATE><TIME>|<HOST>|E|psImageInit (FILE:LINENO) 124 datatype 260 not defined in psImageInit 125 <DATE><TIME>|<HOST>|E|testImageInit (FILE:LINENO) 126 ImageInit failed. S32 Case - 5x5 127 128 ---> TESTPOINT PASSED (psImage{psImageInit} | tst_psImage.c) 129
Note:
See TracChangeset
for help on using the changeset viewer.
