Changeset 2273 for trunk/psLib/test/image/tst_psImageExtraction.c
- Timestamp:
- Nov 3, 2004, 3:05:00 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/image/tst_psImageExtraction.c (modified) (54 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/image/tst_psImageExtraction.c
r2204 r2273 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1.1 8$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-1 0-27 00:57:33$8 * @version $Revision: 1.19 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-11-04 01:05:00 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 87 87 \ 88 88 if (out->n != TRUTH_SIZE) { \ 89 psError( __func__,"Number of results is wrong (%d, not %d)", \89 psError(PS_ERR_UNKNOWN,true,"Number of results is wrong (%d, not %d)", \ 90 90 out->n,n); \ 91 91 return TESTNUM*4+1; \ … … 93 93 \ 94 94 if (positions->n != TRUTH_SIZE) { \ 95 psError( __func__,"Number of results for positions vector is wrong (%d, not %d)", \95 psError(PS_ERR_UNKNOWN,true,"Number of results for positions vector is wrong (%d, not %d)", \ 96 96 out->n,n); \ 97 97 return TESTNUM*4+2; \ … … 100 100 for (psS32 i=0;i<out->n;i++) { \ 101 101 if (fabs(out->data.F64[i]-image->data.TYPE[r/10+TRUTHPIX_Y][c/10+TRUTHPIX_X]) > 1.0/(psF64)r) { \ 102 psError( __func__,"Improper result at position %d. Got %g, expected %g",i, \102 psError(PS_ERR_UNKNOWN,true,"Improper result at position %d. Got %g, expected %g",i, \ 103 103 out->data.F64[i],image->data.TYPE[r/10+TRUTHPIX_Y][c/10+TRUTHPIX_X]); \ 104 104 return TESTNUM*4+3; \ … … 106 106 if (DIRECTION == PS_CUT_X_POS || DIRECTION == PS_CUT_X_NEG) { \ 107 107 if (positions->data.U32[i] != c/10+TRUTHPIX_X) { \ 108 psError( __func__,"Improper positions (%d vs %d) result @ %d.", \108 psError(PS_ERR_UNKNOWN,true,"Improper positions (%d vs %d) result @ %d.", \ 109 109 positions->data.U32[i],c/10+TRUTHPIX_X,i); \ 110 110 return TESTNUM*4+4; \ … … 112 112 } else { \ 113 113 if (positions->data.U32[i] != r/10+TRUTHPIX_Y) { \ 114 psError( __func__,"Improper positions (%d vs %d) result @ %d.", \114 psError(PS_ERR_UNKNOWN,true,"Improper positions (%d vs %d) result @ %d.", \ 115 115 positions->data.U32[i],r/10+TRUTHPIX_Y,i); \ 116 116 return TESTNUM*4+4; \ … … 165 165 stat ); 166 166 if ( out != NULL ) { 167 psError( __func__, "Giving a NULL image, psImageSlice didn't return NULL as expected" );167 psError( PS_ERR_UNKNOWN,true, "Giving a NULL image, psImageSlice didn't return NULL as expected" ); 168 168 return 101; 169 169 } … … 184 184 NULL ); 185 185 if ( out != NULL ) { 186 psError( __func__, "Giving a NULL stat struct, psImageSlice didn't return NULL as expected" );186 psError( PS_ERR_UNKNOWN,true, "Giving a NULL stat struct, psImageSlice didn't return NULL as expected" ); 187 187 return 102; 188 188 } … … 202 202 stat); 203 203 if ( out != NULL ) { 204 psError( __func__, "Giving a bogus direction flag, psImageSlice didn't return NULL as expected" );204 psError( PS_ERR_UNKNOWN,true, "Giving a bogus direction flag, psImageSlice didn't return NULL as expected" ); 205 205 return 103; 206 206 } … … 220 220 stat ); 221 221 if ( out != NULL ) { 222 psError( __func__, "Giving a 0x0 region, psImageSlice didn't return NULL as expected" );222 psError( PS_ERR_UNKNOWN,true, "Giving a 0x0 region, psImageSlice didn't return NULL as expected" ); 223 223 return 104; 224 224 } … … 238 238 stat ); 239 239 if ( out != NULL ) { 240 psError( __func__, "Giving an invalid x position, psImageSlice didn't return NULL as expected" );240 psError( PS_ERR_UNKNOWN,true, "Giving an invalid x position, psImageSlice didn't return NULL as expected" ); 241 241 return 105; 242 242 } … … 251 251 stat ); 252 252 if ( out != NULL ) { 253 psError( __func__, "Giving an invalid y position, psImageSlice didn't return NULL as expected" );253 psError( PS_ERR_UNKNOWN,true, "Giving an invalid y position, psImageSlice didn't return NULL as expected" ); 254 254 return 106; 255 255 } … … 264 264 stat); 265 265 if ( out != NULL ) { 266 psError( __func__, "Giving an invalid numCols, psImageSlice didn't return NULL as expected" );266 psError( PS_ERR_UNKNOWN,true, "Giving an invalid numCols, psImageSlice didn't return NULL as expected" ); 267 267 return 107; 268 268 } … … 277 277 stat); 278 278 if ( out != NULL ) { 279 psError( __func__, "Giving an invalid numRows, psImageSlice didn't return NULL as expected" );279 psError( PS_ERR_UNKNOWN,true, "Giving an invalid numRows, psImageSlice didn't return NULL as expected" ); 280 280 return 108; 281 281 } … … 296 296 stat); 297 297 if ( out != NULL ) { 298 psError( __func__, "Giving an invalid numRows, psImageSlice didn't return NULL as expected" );298 psError( PS_ERR_UNKNOWN,true, "Giving an invalid numRows, psImageSlice didn't return NULL as expected" ); 299 299 return 109; 300 300 } … … 314 314 stat); 315 315 if ( out != NULL ) { 316 psError( __func__, "Mask size different than image size didn't return NULL as expected" );316 psError( PS_ERR_UNKNOWN,true, "Mask size different than image size didn't return NULL as expected" ); 317 317 return 110; 318 318 } … … 330 330 stat); 331 331 if ( out != NULL ) { 332 psError( __func__, "Mask invalid type didn't return NULL as expected.");332 psError( PS_ERR_UNKNOWN,true, "Mask invalid type didn't return NULL as expected."); 333 333 return 111; 334 334 } … … 345 345 stat); 346 346 if ( out != NULL ) { 347 psError( __func__, "Input image with invalid type didn't return NULL as expected.");347 psError( PS_ERR_UNKNOWN,true, "Input image with invalid type didn't return NULL as expected."); 348 348 return 112; 349 349 } … … 390 390 391 391 if (subset2->numCols != c/2 || subset2->numRows != r/2) { 392 psError( __func__,"psImageSubset output size was not proper(%dx%d, should be %dx%d).",392 psError(PS_ERR_UNKNOWN,true,"psImageSubset output size was not proper(%dx%d, should be %dx%d).", 393 393 subset2->numCols, subset2->numRows, c/2,r/2); 394 394 return 1; … … 396 396 397 397 if (subset3->numCols != c/2 || subset3->numRows != r/2) { 398 psError( __func__,"psImageSubset output size was not proper(%dx%d, should be %dx%d).",398 psError(PS_ERR_UNKNOWN,true,"psImageSubset output size was not proper(%dx%d, should be %dx%d).", 399 399 subset3->numCols, subset3->numRows, c/2,r/2); 400 400 return 2; … … 407 407 for (psS32 col=0;col<c/2;col++) { 408 408 if (subset2->data.U32[row][col] != original->data.U32[row+r/4][col+c/4]) { 409 psError( __func__,"psImageSubset output #1 was wrong at %dx%d (%d vs %d).",409 psError(PS_ERR_UNKNOWN,true,"psImageSubset output #1 was wrong at %dx%d (%d vs %d).", 410 410 row,col,subset2->data.U32[row][col], original->data.U32[row+r/4][col+c/4]); 411 411 return 3; 412 412 } 413 413 if (subset3->data.U32[row][col] != original->data.U32[row][col]) { 414 psError( __func__,"psImageSubset output #1 was wrong at %dx%d (%d vs %d).",414 psError(PS_ERR_UNKNOWN,true,"psImageSubset output #1 was wrong at %dx%d (%d vs %d).", 415 415 row,col,subset2->data.U32[row][col], original->data.U32[row][col]); 416 416 return 4; … … 423 423 424 424 if (subset2->type.type != PS_TYPE_U32) { 425 psError( __func__,"psImageSubset output type was not proper(%d, should be %d).",425 psError(PS_ERR_UNKNOWN,true,"psImageSubset output type was not proper(%d, should be %d).", 426 426 subset2->type.type, PS_TYPE_U32); 427 427 return 6; 428 428 } 429 429 if (subset3->type.type != PS_TYPE_U32) { 430 psError( __func__,"psImageSubset output type was not proper(%d, should be %d).",430 psError(PS_ERR_UNKNOWN,true,"psImageSubset output type was not proper(%d, should be %d).", 431 431 subset3->type.type, PS_TYPE_U32); 432 432 return 7; … … 437 437 438 438 if (subset2->col0 != c/4 || subset2->row0 != r/4) { 439 psError( __func__,"psImageSubset didn't set col0/row0 for subset2 (%d/%d, should be %d/%d).",439 psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't set col0/row0 for subset2 (%d/%d, should be %d/%d).", 440 440 subset2->col0,subset2->row0,c/4,r/4); 441 441 return 8; 442 442 } 443 443 if (subset3->col0 != 0 || subset3->row0 != 0) { 444 psError( __func__,"psImageSubset didn't set col0/row0 for subset3 (%d/%d, should be %d/%d).",444 psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't set col0/row0 for subset3 (%d/%d, should be %d/%d).", 445 445 subset3->col0,subset3->row0,0,0); 446 446 return 9; … … 451 451 452 452 if (subset2->parent != original || subset3->parent != original) { 453 psError( __func__,"psImageSubset didn't set parent.");453 psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't set parent."); 454 454 return 10; 455 455 } … … 458 458 459 459 if (subset2->children != NULL || subset3->children != NULL) { 460 psError( __func__,"psImageSubset didn't set children to NULL.");460 psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't set children to NULL."); 461 461 return 11; 462 462 } … … 467 467 468 468 if (original->children == NULL || original->children->n != 2) { 469 psError( __func__,"psImageSubset didn't increment number of children by one per subset.");469 psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't increment number of children by one per subset."); 470 470 return 12; 471 471 } 472 472 if (original->children->data[0] != subset2 || original->children->data[1] != subset3) { 473 psError( __func__,"psImageSubset didn't properly store the children pointers.");473 psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't properly store the children pointers."); 474 474 return 13; 475 475 } … … 482 482 subset1 = psImageSubset(NULL,0,0,c/2,r/2); 483 483 if (subset1 != NULL) { 484 psError( __func__,"psImageSubset didn't return NULL when input image was NULL.");484 psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't return NULL when input image was NULL."); 485 485 return 14; 486 486 } … … 494 494 subset1 = psImageSubset(original,0,r/2,c/2,r/2); 495 495 if (subset1 != NULL) { 496 psError( __func__,"psImageSubset didn't return NULL when numRows=0.");496 psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't return NULL when numRows=0."); 497 497 return 15; 498 498 } … … 500 500 subset1 = psImageSubset(original,c/2,0,c/2,r/2); 501 501 if (subset1 != NULL) { 502 psError( __func__,"psImageSubset didn't return NULL when numCols=0.");502 psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't return NULL when numCols=0."); 503 503 return 16; 504 504 } 505 505 if (memcmp(original,&preSubsetStruct,sizeof(psImage)) != 0) { 506 psError( __func__,"psImageSubset changed the original struct though it failed to subset.");506 psError(PS_ERR_UNKNOWN,true,"psImageSubset changed the original struct though it failed to subset."); 507 507 return 17; 508 508 } … … 516 516 subset1 = psImageSubset(original,0,0,c/2,r*2); 517 517 if (subset1 != NULL) { 518 psError( __func__,"psImageSubset didn't return NULL when subset origin was outside of "518 psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't return NULL when subset origin was outside of " 519 519 "image (via cols)."); 520 520 return 18; … … 523 523 subset1 = psImageSubset(original,0,0,c*2,r/2); 524 524 if (subset1 != NULL) { 525 psError( __func__,"psImageSubset didn't return NULL when subset origin was outside of "525 psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't return NULL when subset origin was outside of " 526 526 "image (via rows)."); 527 527 return 19; … … 530 530 subset1 = psImageSubset(original,-1,0,c/2,r/2); 531 531 if (subset1 != NULL) { 532 psError( __func__,"psImageSubset didn't return NULL when subset origin was outside of "532 psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't return NULL when subset origin was outside of " 533 533 "image (col0=-1)."); 534 534 return 20; … … 537 537 subset1 = psImageSubset(original,0,-1,c/2,r/2); 538 538 if (subset1 != NULL) { 539 psError( __func__,"psImageSubset didn't return NULL when subset origin was outside of "539 psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't return NULL when subset origin was outside of " 540 540 "image (row0=-1)."); 541 541 return 21; … … 550 550 subset1 = psImageSubset(original,0,0,c/2,r+1); 551 551 if (subset1 != NULL) { 552 psError( __func__,"psImageSubset didn't return NULL when subset was outside of image (via rows).");552 psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't return NULL when subset was outside of image (via rows)."); 553 553 return 22; 554 554 } … … 556 556 subset1 = psImageSubset(original,0,0,c+1,r/2); 557 557 if (subset1 != NULL) { 558 psError( __func__,"psImageSubset didn't return NULL when subset was outside of image (via cols).");558 psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't return NULL when subset was outside of image (via cols)."); 559 559 return 23; 560 560 } … … 562 562 subset1 = psImageSubset(original,0,0,c+1,r+1); 563 563 if (subset1 != NULL) { 564 psError( __func__,"psImageSubset didn't return NULL when subset was outside of image (via row+cols).");564 psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't return NULL when subset was outside of image (via row+cols)."); 565 565 return 24; 566 566 } … … 575 575 // Verify the returned psImage structure member Nchildren is set to zero. 576 576 if (original->children != NULL && original->children->n > 0) { 577 psError( __func__,"psImageFreeChildren didn't set number of children to zero.");577 psError(PS_ERR_UNKNOWN,true,"psImageFreeChildren didn't set number of children to zero."); 578 578 return 25; 579 579 } … … 586 586 preSubsetStruct.col0 != original->col0) { 587 587 588 psError( __func__,"psImageFreeChildren modified parent's non-children elements.");588 psError(PS_ERR_UNKNOWN,true,"psImageFreeChildren modified parent's non-children elements."); 589 589 return 27; 590 590 } … … 626 626 627 627 if (subset == NULL) { 628 psError( __func__,"psImageSubsection returned a NULL with a subset of %s.",628 psError(PS_ERR_UNKNOWN,true,"psImageSubsection returned a NULL with a subset of %s.", 629 629 sectionStr); 630 630 return 10*i+1; … … 632 632 633 633 if (subset->type.type != PS_TYPE_U32) { 634 psError( __func__,"psImageSubsection output type was not proper(%d, should be %d).",634 psError(PS_ERR_UNKNOWN,true,"psImageSubsection output type was not proper(%d, should be %d).", 635 635 subset->type.type, PS_TYPE_U32); 636 636 return 10*i+2; … … 638 638 639 639 if (subset->col0 != x1[i] || subset->row0 != y1[i]) { 640 psError( __func__,"psImageSubsection didn't set properly col0/row0 (%d/%d, should be %d/%d).",640 psError(PS_ERR_UNKNOWN,true,"psImageSubsection didn't set properly col0/row0 (%d/%d, should be %d/%d).", 641 641 subset->col0,subset->row0,x1[i],y1[i]); 642 642 return 10*i+3; … … 644 644 645 645 if (subset->parent != original) { 646 psError( __func__,"psImageSubsection didn't set parent.");646 psError(PS_ERR_UNKNOWN,true,"psImageSubsection didn't set parent."); 647 647 return 10*i+4; 648 648 } 649 649 650 650 if (subset->children != NULL) { 651 psError( __func__,"psImageSubsection didn't set children to NULL.");651 psError(PS_ERR_UNKNOWN,true,"psImageSubsection didn't set children to NULL."); 652 652 return 10*i+5; 653 653 } 654 654 655 655 if (original->children == NULL || original->children->n != i+1) { 656 psError( __func__,"psImageSubsection didn't increment number of children by one per subset.");656 psError(PS_ERR_UNKNOWN,true,"psImageSubsection didn't increment number of children by one per subset."); 657 657 return 10*i+6; 658 658 } … … 660 660 661 661 if (original->children->data[i] != subset) { 662 psError( __func__,"psImageSubsection didn't properly store the children pointer.");662 psError(PS_ERR_UNKNOWN,true,"psImageSubsection didn't properly store the children pointer."); 663 663 return 10*i+7; 664 664 } … … 667 667 psS32 numRows = y2[i]-y1[i]+1; 668 668 if (subset->numCols != numCols || subset->numRows != numRows) { 669 psError( __func__,"psImageSubsection output size was not proper(%dx%d, should be %dx%d).",669 psError(PS_ERR_UNKNOWN,true,"psImageSubsection output size was not proper(%dx%d, should be %dx%d).", 670 670 subset->numCols, subset->numRows, numCols, numRows); 671 671 return 10*i+8; … … 675 675 for (psS32 col=0;col<numCols;col++) { 676 676 if (subset->data.U32[row][col] != original->data.U32[row+y1[i]][col+x1[i]]) { 677 psError( __func__,"psImageSubset output #1 was wrong at %dx%d (%d vs %d).",677 psError(PS_ERR_UNKNOWN,true,"psImageSubset output #1 was wrong at %dx%d (%d vs %d).", 678 678 row,col,subset->data.U32[row][col], original->data.U32[row+y1[i]][col+x1[i]]); 679 679 return 10*i+9; … … 686 686 subset = psImageSubsection(original,"[64:32,32:64]"); 687 687 if (subset != NULL) { 688 psError( __func__,"psImageSubsection didn't return NULL when x1 > x2.");688 psError(PS_ERR_UNKNOWN,true,"psImageSubsection didn't return NULL when x1 > x2."); 689 689 return 10*i+10; 690 690 } … … 693 693 subset = psImageSubsection(original,"[32:64,64:32]"); 694 694 if (subset != NULL) { 695 psError( __func__,"psImageSubsection didn't return NULL when y1 > y2.");695 psError(PS_ERR_UNKNOWN,true,"psImageSubsection didn't return NULL when y1 > y2."); 696 696 return 10*i+11; 697 697 } … … 700 700 subset = psImageSubsection(original,"[64:256,32:64]"); // assumes c<256 701 701 if (subset != NULL) { 702 psError( __func__,"psImageSubsection didn't return NULL when x2 > c.");702 psError(PS_ERR_UNKNOWN, true,"psImageSubsection didn't return NULL when x2 > c."); 703 703 return 10*i+12; 704 704 } … … 707 707 subset = psImageSubsection(original,"[32:64,64:256]"); // assumes r==256 708 708 if (subset != NULL) { 709 psError( __func__,"psImageSubsection didn't return NULL when y2 > r.");709 psError(PS_ERR_UNKNOWN, true,"psImageSubsection didn't return NULL when y2 > r."); 710 710 return 10*i+13; 711 711 } … … 714 714 subset = psImageSubsection(original,"32:64,32:64"); 715 715 if (subset != NULL) { 716 psError( __func__,"psImageSubsection didn't return NULL when subsection was '32:64,32:64'.");716 psError(PS_ERR_UNKNOWN, true,"psImageSubsection didn't return NULL when subsection was '32:64,32:64'."); 717 717 return 10*i+14; 718 718 } … … 721 721 subset = psImageSubsection(original,"[32-64,32-64]"); 722 722 if (subset != NULL) { 723 psError( __func__,"psImageSubsection didn't return NULL when subsection was '[32-64,32-64]'.");723 psError(PS_ERR_UNKNOWN, true,"psImageSubsection didn't return NULL when subsection was '[32-64,32-64]'."); 724 724 return 10*i+15; 725 725 } … … 728 728 subset = psImageSubsection(original,"[32:64,32]"); 729 729 if (subset != NULL) { 730 psError( __func__,"psImageSubsection didn't return NULL when subsection was '[32:64,32]'.");730 psError(PS_ERR_UNKNOWN, true,"psImageSubsection didn't return NULL when subsection was '[32:64,32]'."); 731 731 return 10*i+16; 732 732 } … … 735 735 subset = psImageSubsection(NULL,"[32:64,32:64]"); 736 736 if (subset != NULL) { 737 psError( __func__,"psImageSubsection didn't return NULL when image was NULL.");737 psError(PS_ERR_UNKNOWN, true,"psImageSubsection didn't return NULL when image was NULL."); 738 738 return 10*i+17; 739 739 } … … 742 742 subset = psImageSubsection(original,NULL); 743 743 if (subset != NULL) { 744 psError( __func__,"psImageSubsection didn't return NULL when subsection was NULL.");744 psError(PS_ERR_UNKNOWN, true,"psImageSubsection didn't return NULL when subsection was NULL."); 745 745 return 10*i+18; 746 746 }
Note:
See TracChangeset
for help on using the changeset viewer.
