Changeset 11402
- Timestamp:
- Jan 29, 2007, 2:52:07 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/mathtypes/tap_psImage.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/mathtypes/tap_psImage.c
r10808 r11402 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $9 * @date $Date: 200 6-12-18 19:10:56$8 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2007-01-30 00:52:07 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 24 24 25 25 26 static int Okay = 1; 27 28 static int setOkay( int okay ) 29 { 30 Okay = okay; 31 return okay; 32 } 26 //static int Okay = 1; 27 //static int setOkay( int okay ) 28 //{ 29 // Okay = okay; 30 // return okay; 31 //} 33 32 34 33 #define OK(exp) \ … … 45 44 int main(int argc, char* argv[]) 46 45 { 47 plan_tests( 1449971);46 plan_tests(383); 48 47 49 48 void testImageAlloc(void); … … 149 148 } 150 149 } 151 for (psS32 r=0;r<rows;r++) { 152 for (psS32 c=0;c<cols;c++) { 153 ok (OK(image->data.U16[r][c] == 2*c+r), 154 "Could not set all pixels in uint16 image at " 155 "(%d,%d)",c,r); 156 RET_OK 157 } 158 } 150 bool errorFlag = false; 151 for (psS32 r=0;r<rows;r++) { 152 for (psS32 c=0;c<cols;c++) { 153 if (image->data.U16[r][c] != 2*c+r) { 154 diag("ERROR: Could not set all pixels in uint16 image at (%d,%d)",c,r); 155 errorFlag = true; 156 } 157 } 158 } 159 ok(!errorFlag, "psImageAlloc() set data correctly (U16)"); 159 160 } 160 161 break; … … 168 169 } 169 170 } 170 for (psS32 r=0;r<rows;r++) { 171 for (psS32 c=0;c<cols;c++) { 172 ok (OK(!(fabsf(image->data.F32[r][c] - (2.0f*c+r)) > FLT_EPSILON)), 173 "Set all pixels in float image at (%d,%d)",c,r); 174 RET_OK 175 } 176 } 171 bool errorFlag = false; 172 for (psS32 r=0;r<rows;r++) { 173 for (psS32 c=0;c<cols;c++) { 174 if (fabsf(image->data.F32[r][c] - (2.0f*c+r)) > FLT_EPSILON) { 175 diag("Could not set all pixels in float image at (%d,%d)",c,r); 176 errorFlag = true; 177 } 178 } 179 } 180 ok(!errorFlag, "psImageAlloc() set data correctly (F32)"); 177 181 } 178 182 break; … … 186 190 } 187 191 } 188 for (psS32 r=0;r<rows;r++) { 189 for (psS32 c=0;c<cols;c++) { 190 ok (OK(!(fabs(image->data.F64[r][c] - (2.0f*c+r)) > DBL_EPSILON)), 191 "Set all pixels in double image at (%d,%d)",c,r); 192 RET_OK 193 } 194 } 192 bool errorFlag = false; 193 for (psS32 r=0;r<rows;r++) { 194 for (psS32 c=0;c<cols;c++) { 195 if (fabs(image->data.F64[r][c] - (2.0f*c+r)) > DBL_EPSILON) { 196 diag("Set all pixels in double image at (%d,%d)",c,r); 197 errorFlag = true; 198 } 199 } 200 } 201 ok(!errorFlag, "psImageAlloc() set data correctly (F64)"); 195 202 } 196 203 break; … … 204 211 } 205 212 } 206 for (psS32 r=0;r<rows;r++) { 207 for (psS32 c=0;c<cols;c++) { 208 ok (OK(!(fabsf(crealf(image->data.C32[r][c]) - r) > FLT_EPSILON || 209 fabsf(cimagf(image->data.C32[r][c]) - c) > FLT_EPSILON )), 210 "Set all pixels in complex image at (%d,%d)",c,r); 211 RET_OK 212 } 213 } 213 bool errorFlag = false; 214 for (psS32 r=0;r<rows;r++) { 215 for (psS32 c=0;c<cols;c++) { 216 if(fabsf(crealf(image->data.C32[r][c]) - r) > FLT_EPSILON || 217 fabsf(cimagf(image->data.C32[r][c]) - c) > FLT_EPSILON) { 218 diag("Set all pixels in complex image at (%d,%d)",c,r); 219 errorFlag = true; 220 } 221 } 222 } 223 ok(!errorFlag, "psImageAlloc() set data correctly (C32)"); 214 224 } 215 225 break; … … 224 234 } 225 235 } 226 for (psS32 r=0;r<rows;r++) { 227 for (psS32 c=0;c<cols;c++) { 228 ok (OK(!(image->data.U8[r][c] != (uint8_t)(r + c))), 229 "Set all pixels in image (type=%d) at (%d,%d)", 230 type[t],c,r); 231 RET_OK 232 } 233 } 236 bool errorFlag = false; 237 for (psS32 r=0;r<rows;r++) { 238 for (psS32 c=0;c<cols;c++) { 239 if (image->data.U8[r][c] != (uint8_t)(r + c)) { 240 diag("Set all pixels in image (type=%d) at (%d,%d)", 241 type[t],c,r); 242 errorFlag = true; 243 } 244 } 245 } 246 ok(!errorFlag, "psImageAlloc() set data correctly (default)"); 234 247 } 235 248 }
Note:
See TracChangeset
for help on using the changeset viewer.
