IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 3, 2004, 3:05:00 PM (22 years ago)
Author:
desonia
Message:

changed the psError signature to match SDRS. Also made misc. cleanups as
I was combing the files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/image/tst_psImageExtraction.c

    r2204 r2273  
    66*  @author Robert DeSonia, MHPCC
    77*
    8 *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
    9 *  @date $Date: 2004-10-27 00:57:33 $
     8*  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
     9*  @date $Date: 2004-11-04 01:05:00 $
    1010*
    1111*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    8787    \
    8888    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)", \
    9090                out->n,n); \
    9191        return TESTNUM*4+1; \
     
    9393    \
    9494    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)", \
    9696                out->n,n); \
    9797        return TESTNUM*4+2; \
     
    100100    for (psS32 i=0;i<out->n;i++) { \
    101101        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, \
    103103                    out->data.F64[i],image->data.TYPE[r/10+TRUTHPIX_Y][c/10+TRUTHPIX_X]); \
    104104            return TESTNUM*4+3; \
     
    106106        if (DIRECTION == PS_CUT_X_POS || DIRECTION == PS_CUT_X_NEG) { \
    107107            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.", \
    109109                        positions->data.U32[i],c/10+TRUTHPIX_X,i); \
    110110                return TESTNUM*4+4; \
     
    112112        } else { \
    113113            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.", \
    115115                        positions->data.U32[i],r/10+TRUTHPIX_Y,i); \
    116116                return TESTNUM*4+4; \
     
    165165                        stat );
    166166    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" );
    168168        return 101;
    169169    }
     
    184184                        NULL );
    185185    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" );
    187187        return 102;
    188188    }
     
    202202                        stat);
    203203    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" );
    205205        return 103;
    206206    }
     
    220220                        stat );
    221221    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" );
    223223        return 104;
    224224    }
     
    238238                        stat );
    239239    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" );
    241241        return 105;
    242242    }
     
    251251                        stat );
    252252    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" );
    254254        return 106;
    255255    }
     
    264264                        stat);
    265265    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" );
    267267        return 107;
    268268    }
     
    277277                        stat);
    278278    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" );
    280280        return 108;
    281281    }
     
    296296                        stat);
    297297    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" );
    299299        return 109;
    300300    }
     
    314314                        stat);
    315315    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" );
    317317        return 110;
    318318    }
     
    330330                         stat);
    331331    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.");
    333333        return 111;
    334334    }
     
    345345                        stat);
    346346    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.");
    348348        return 112;
    349349    }
     
    390390
    391391    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).",
    393393                subset2->numCols, subset2->numRows, c/2,r/2);
    394394        return 1;
     
    396396
    397397    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).",
    399399                subset3->numCols, subset3->numRows, c/2,r/2);
    400400        return 2;
     
    407407        for (psS32 col=0;col<c/2;col++) {
    408408            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).",
    410410                        row,col,subset2->data.U32[row][col], original->data.U32[row+r/4][col+c/4]);
    411411                return 3;
    412412            }
    413413            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).",
    415415                        row,col,subset2->data.U32[row][col], original->data.U32[row][col]);
    416416                return 4;
     
    423423
    424424    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).",
    426426                subset2->type.type, PS_TYPE_U32);
    427427        return 6;
    428428    }
    429429    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).",
    431431                subset3->type.type, PS_TYPE_U32);
    432432        return 7;
     
    437437
    438438    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).",
    440440                subset2->col0,subset2->row0,c/4,r/4);
    441441        return 8;
    442442    }
    443443    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).",
    445445                subset3->col0,subset3->row0,0,0);
    446446        return 9;
     
    451451
    452452    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.");
    454454        return 10;
    455455    }
     
    458458
    459459    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.");
    461461        return 11;
    462462    }
     
    467467
    468468    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.");
    470470        return 12;
    471471    }
    472472    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.");
    474474        return 13;
    475475    }
     
    482482    subset1 = psImageSubset(NULL,0,0,c/2,r/2);
    483483    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.");
    485485        return 14;
    486486    }
     
    494494    subset1 = psImageSubset(original,0,r/2,c/2,r/2);
    495495    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.");
    497497        return 15;
    498498    }
     
    500500    subset1 = psImageSubset(original,c/2,0,c/2,r/2);
    501501    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.");
    503503        return 16;
    504504    }
    505505    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.");
    507507        return 17;
    508508    }
     
    516516    subset1 = psImageSubset(original,0,0,c/2,r*2);
    517517    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 "
    519519                "image (via cols).");
    520520        return 18;
     
    523523    subset1 = psImageSubset(original,0,0,c*2,r/2);
    524524    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 "
    526526                "image (via rows).");
    527527        return 19;
     
    530530    subset1 = psImageSubset(original,-1,0,c/2,r/2);
    531531    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 "
    533533                "image (col0=-1).");
    534534        return 20;
     
    537537    subset1 = psImageSubset(original,0,-1,c/2,r/2);
    538538    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 "
    540540                "image (row0=-1).");
    541541        return 21;
     
    550550    subset1 = psImageSubset(original,0,0,c/2,r+1);
    551551    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).");
    553553        return 22;
    554554    }
     
    556556    subset1 = psImageSubset(original,0,0,c+1,r/2);
    557557    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).");
    559559        return 23;
    560560    }
     
    562562    subset1 = psImageSubset(original,0,0,c+1,r+1);
    563563    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).");
    565565        return 24;
    566566    }
     
    575575    // Verify the returned psImage structure member Nchildren is set to zero.
    576576    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.");
    578578        return 25;
    579579    }
     
    586586            preSubsetStruct.col0 != original->col0) {
    587587
    588         psError(__func__,"psImageFreeChildren modified parent's non-children elements.");
     588        psError(PS_ERR_UNKNOWN,true,"psImageFreeChildren modified parent's non-children elements.");
    589589        return 27;
    590590    }
     
    626626
    627627        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.",
    629629                    sectionStr);
    630630            return 10*i+1;
     
    632632
    633633        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).",
    635635                    subset->type.type, PS_TYPE_U32);
    636636            return 10*i+2;
     
    638638
    639639        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).",
    641641                    subset->col0,subset->row0,x1[i],y1[i]);
    642642            return 10*i+3;
     
    644644
    645645        if (subset->parent != original) {
    646             psError(__func__,"psImageSubsection didn't set parent.");
     646            psError(PS_ERR_UNKNOWN,true,"psImageSubsection didn't set parent.");
    647647            return 10*i+4;
    648648        }
    649649
    650650        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.");
    652652            return 10*i+5;
    653653        }
    654654
    655655        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.");
    657657            return 10*i+6;
    658658        }
     
    660660
    661661        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.");
    663663            return 10*i+7;
    664664        }
     
    667667        psS32 numRows = y2[i]-y1[i]+1;
    668668        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).",
    670670                    subset->numCols, subset->numRows, numCols, numRows);
    671671            return 10*i+8;
     
    675675            for (psS32 col=0;col<numCols;col++) {
    676676                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).",
    678678                            row,col,subset->data.U32[row][col], original->data.U32[row+y1[i]][col+x1[i]]);
    679679                    return 10*i+9;
     
    686686    subset = psImageSubsection(original,"[64:32,32:64]");
    687687    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.");
    689689        return 10*i+10;
    690690    }
     
    693693    subset = psImageSubsection(original,"[32:64,64:32]");
    694694    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.");
    696696        return 10*i+11;
    697697    }
     
    700700    subset = psImageSubsection(original,"[64:256,32:64]"); // assumes c<256
    701701    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.");
    703703        return 10*i+12;
    704704    }
     
    707707    subset = psImageSubsection(original,"[32:64,64:256]"); // assumes r==256
    708708    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.");
    710710        return 10*i+13;
    711711    }
     
    714714    subset = psImageSubsection(original,"32:64,32:64");
    715715    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'.");
    717717        return 10*i+14;
    718718    }
     
    721721    subset = psImageSubsection(original,"[32-64,32-64]");
    722722    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]'.");
    724724        return 10*i+15;
    725725    }
     
    728728    subset = psImageSubsection(original,"[32:64,32]");
    729729    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]'.");
    731731        return 10*i+16;
    732732    }
     
    735735    subset = psImageSubsection(NULL,"[32:64,32:64]");
    736736    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.");
    738738        return 10*i+17;
    739739    }
     
    742742    subset = psImageSubsection(original,NULL);
    743743    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.");
    745745        return 10*i+18;
    746746    }
Note: See TracChangeset for help on using the changeset viewer.