Changeset 1920 for trunk/psLib/test/image/tst_psImage.c
- Timestamp:
- Sep 28, 2004, 1:26:49 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/image/tst_psImage.c (modified) (19 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/image/tst_psImage.c
r1682 r1920 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1.2 5$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-09- 02 21:17:03$8 * @version $Revision: 1.26 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-09-28 23:26:49 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 26 26 27 27 testDescription tests[] = { 28 { 29 testImageAlloc,546,"psImageAlloc",0,false 30 }, 31 { 32 testImageAlloc,548,"psImageFree",0,true 33 }, 34 { 35 testImageSubset,547,"psImageSubset",0,false 36 }, 37 { 38 testImageSubset,550,"psImageSubset",0,true 39 }, 40 { 41 testImageCopy,551,"psImageCopy",0,false 42 }, 43 { 44 NULL 45 } 28 {testImageAlloc,546,"psImageAlloc",0,false}, 29 {testImageAlloc,548,"psImageFree",0,true}, 30 {testImageSubset,547,"psImageSubset",0,false}, 31 {testImageSubset,550,"psImageSubset",0,true}, 32 {testImageCopy,551,"psImageCopy",0,false}, 33 {NULL} 46 34 }; 47 35 … … 119 107 } 120 108 121 if (image->nChildren != 0) {122 psError(__func__,"psImageAlloc returned non-zero number of children");123 psFree(image);124 return 6;125 }126 127 109 if (image->children != NULL) { 128 psError(__func__,"psImageAlloc returned non-NULL children vector");110 psError(__func__,"psImageAlloc returned non-NULL children array"); 129 111 psFree(image); 130 112 return 7; … … 259 241 } 260 242 } 261 262 // #548: Verify no memory leaks or corruption are detected after a valid psImage structure with no263 // children is freed.264 243 psFree(image); 265 244 } 266 245 } 267 246 268 // #548: Verify program execution doesn't stop, if the input psImage structure pointer is null.269 psFree(NULL);270 271 247 // #548: Verify no memory leaks or corruption are detected after a valid psImage structure with multiple 272 // children is freed.248 // children is freed. 273 249 image = psImageAlloc(100,100,PS_TYPE_F32); 274 psImageSubset(image,50, 50,0,0);275 psImageSubset(image, 50,50,20,20);250 psImageSubset(image,50,0,70,20); 251 psImageSubset(image,70,20,90,40); 276 252 277 253 psFree(image); … … 300 276 memcpy(&preSubsetStruct,original,sizeof(psImage)); 301 277 302 subset2 = psImageSubset(original,c/2,r/2,c/4,r/4); 303 304 subset3 = psImageSubset(original,c/2,r/2,0,0); 278 subset2 = psImageSubset(original,c/4,r/4,c/4+c/2,r/4+r/2); 279 280 subset3 = psImageSubset(original,0,0,c/2,r/2); 281 282 psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure members nrow and ncol are equal to " 283 "the input parameter nrow and ncol respectively."); 284 285 if (subset2->numCols != c/2 || subset2->numRows != r/2) { 286 psError(__func__,"psImageSubset output size was not proper(%dx%d, should be %dx%d).", 287 subset2->numCols, subset2->numRows, c/2,r/2); 288 return 1; 289 } 290 291 if (subset3->numCols != c/2 || subset3->numRows != r/2) { 292 psError(__func__,"psImageSubset output size was not proper(%dx%d, should be %dx%d).", 293 subset3->numCols, subset3->numRows, c/2,r/2); 294 return 2; 295 } 305 296 306 297 psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure contains expected values in the " … … 322 313 } 323 314 324 psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure members nrow and ncol are equal to "325 "the input parameter nrow and ncol respectively.");326 327 if (subset3->numCols != c/2 || subset3->numRows != r/2) {328 psError(__func__,"psImageSubset output size was not proper(%dx%d, should be %dx%d).",329 subset3->numCols, subset3->numRows, c/2,r/2);330 return 5;331 }332 333 315 psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure member type is equal to the input " 334 316 "psImage structure member type."); … … 367 349 } 368 350 369 psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure member Nchildren is equal to "370 "zero.");371 372 if (subset2->nChildren != 0 || subset3->nChildren != 0) {373 psError(__func__,"psImageSubset didn't set nChildren to zero.");374 return 11;375 }376 377 351 psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure member children is null."); 378 352 … … 386 360 "out at parent[Nchildren-1]."); 387 361 388 if (original-> nChildren != preSubsetStruct.nChildren+2) {389 psError(__func__,"psImageSubset didn't increment n Children by one per subset.");362 if (original->children == NULL || original->children->n != 2) { 363 psError(__func__,"psImageSubset didn't increment number of children by one per subset."); 390 364 return 12; 391 365 } 392 if (original->children [0] != subset2 || original->children[1] != subset3) {366 if (original->children->data[0] != subset2 || original->children->data[1] != subset3) { 393 367 psError(__func__,"psImageSubset didn't properly store the children pointers."); 394 368 return 13; … … 400 374 401 375 psLogMsg(__func__,PS_LOG_INFO,"An error should follow..."); 402 subset1 = psImageSubset(NULL, c/2,r/2,0,0);376 subset1 = psImageSubset(NULL,0,0,c/2,r/2); 403 377 if (subset1 != NULL) { 404 378 psError(__func__,"psImageSubset didn't return NULL when input image was NULL."); … … 412 386 memcpy(&preSubsetStruct,original,sizeof(psImage)); 413 387 psLogMsg(__func__,PS_LOG_INFO,"An error should follow..."); 414 subset1 = psImageSubset(original, c/2,0,0,0);388 subset1 = psImageSubset(original,0,r/2,c/2,r/2); 415 389 if (subset1 != NULL) { 416 390 psError(__func__,"psImageSubset didn't return NULL when numRows=0."); … … 418 392 } 419 393 psLogMsg(__func__,PS_LOG_INFO,"An error should follow..."); 420 subset1 = psImageSubset(original, 0,r/2,0,0);394 subset1 = psImageSubset(original,c/2,0,c/2,r/2); 421 395 if (subset1 != NULL) { 422 396 psError(__func__,"psImageSubset didn't return NULL when numCols=0."); … … 434 408 435 409 psLogMsg(__func__,PS_LOG_INFO,"An error should follow..."); 436 subset1 = psImageSubset(original, c/2,r/2,c,0);410 subset1 = psImageSubset(original,0,0,c/2,r*2); 437 411 if (subset1 != NULL) { 438 412 psError(__func__,"psImageSubset didn't return NULL when subset origin was outside of " … … 441 415 } 442 416 psLogMsg(__func__,PS_LOG_INFO,"An error should follow..."); 443 subset1 = psImageSubset(original, c/2,r/2,0,r);417 subset1 = psImageSubset(original,0,0,c*2,r/2); 444 418 if (subset1 != NULL) { 445 419 psError(__func__,"psImageSubset didn't return NULL when subset origin was outside of " … … 448 422 } 449 423 psLogMsg(__func__,PS_LOG_INFO,"An error should follow..."); 450 subset1 = psImageSubset(original, c/2,r/2,-1,0);424 subset1 = psImageSubset(original,-1,0,c/2,r/2); 451 425 if (subset1 != NULL) { 452 426 psError(__func__,"psImageSubset didn't return NULL when subset origin was outside of " … … 455 429 } 456 430 psLogMsg(__func__,PS_LOG_INFO,"An error should follow..."); 457 subset1 = psImageSubset(original, c/2,r/2,0,-1);431 subset1 = psImageSubset(original,0,-1,c/2,r/2); 458 432 if (subset1 != NULL) { 459 433 psError(__func__,"psImageSubset didn't return NULL when subset origin was outside of " … … 468 442 469 443 psLogMsg(__func__,PS_LOG_INFO,"An error should follow..."); 470 subset1 = psImageSubset(original, c/2,r/2,c/2,0);444 subset1 = psImageSubset(original,0,0,c/2,r+1); 471 445 if (subset1 != NULL) { 472 446 psError(__func__,"psImageSubset didn't return NULL when subset was outside of image (via rows)."); … … 474 448 } 475 449 psLogMsg(__func__,PS_LOG_INFO,"An error should follow..."); 476 subset1 = psImageSubset(original, c/2,r/2,0,r/2);450 subset1 = psImageSubset(original,0,0,c+1,r/2); 477 451 if (subset1 != NULL) { 478 452 psError(__func__,"psImageSubset didn't return NULL when subset was outside of image (via cols)."); … … 480 454 } 481 455 psLogMsg(__func__,PS_LOG_INFO,"An error should follow..."); 482 subset1 = psImageSubset(original, c/2,r/2,c/2,r/2);456 subset1 = psImageSubset(original,0,0,c+1,r+1); 483 457 if (subset1 != NULL) { 484 458 psError(__func__,"psImageSubset didn't return NULL when subset was outside of image (via row+cols)."); … … 494 468 495 469 // Verify the returned psImage structure member Nchildren is set to zero. 496 if (original-> nChildren !=0) {497 psError(__func__,"psImageFreeChildren didn't set n Children to zero.");470 if (original->children != NULL && original->children->n > 0) { 471 psError(__func__,"psImageFreeChildren didn't set number of children to zero."); 498 472 return 25; 499 }500 501 // Verify the returned psImage structure member children pointer is set to null.502 if (original->children != NULL) {503 psError(__func__,"psImageFreeChildren didn't set children ptr to NULL.");504 return 26;505 473 } 506 474
Note:
See TracChangeset
for help on using the changeset viewer.
