IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 28, 2004, 1:26:49 PM (22 years ago)
Author:
desonia
Message:

changed function prototypes to match changes in the SDRS.

File:
1 edited

Legend:

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

    r1682 r1920  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.25 $ $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 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2626
    2727testDescription 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}
    4634                          };
    4735
     
    119107            }
    120108
    121             if (image->nChildren != 0) {
    122                 psError(__func__,"psImageAlloc returned non-zero number of children");
    123                 psFree(image);
    124                 return 6;
    125             }
    126 
    127109            if (image->children != NULL) {
    128                 psError(__func__,"psImageAlloc returned non-NULL children vector");
     110                psError(__func__,"psImageAlloc returned non-NULL children array");
    129111                psFree(image);
    130112                return 7;
     
    259241                }
    260242            }
    261 
    262             // #548: Verify no memory leaks or corruption are detected after a valid psImage structure with no
    263             // children is freed.
    264243            psFree(image);
    265244        }
    266245    }
    267246
    268     // #548: Verify program execution doesn't stop, if the input psImage structure pointer is null.
    269     psFree(NULL);
    270 
    271247    // #548: Verify no memory leaks or corruption are detected after a valid psImage structure with multiple
    272     // children isfreed.
     248    // children is freed.
    273249    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);
    276252
    277253    psFree(image);
     
    300276    memcpy(&preSubsetStruct,original,sizeof(psImage));
    301277
    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    }
    305296
    306297    psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure contains expected values in the "
     
    322313    }
    323314
    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 
    333315    psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure member type is equal to the input "
    334316             "psImage structure member type.");
     
    367349    }
    368350
    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 
    377351    psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure member children is null.");
    378352
     
    386360             "out at parent[Nchildren-1].");
    387361
    388     if (original->nChildren != preSubsetStruct.nChildren+2) {
    389         psError(__func__,"psImageSubset didn't increment nChildren 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.");
    390364        return 12;
    391365    }
    392     if (original->children[0] != subset2 || original->children[1] != subset3) {
     366    if (original->children->data[0] != subset2 || original->children->data[1] != subset3) {
    393367        psError(__func__,"psImageSubset didn't properly store the children pointers.");
    394368        return 13;
     
    400374
    401375    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);
    403377    if (subset1 != NULL) {
    404378        psError(__func__,"psImageSubset didn't return NULL when input image was NULL.");
     
    412386    memcpy(&preSubsetStruct,original,sizeof(psImage));
    413387    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);
    415389    if (subset1 != NULL) {
    416390        psError(__func__,"psImageSubset didn't return NULL when numRows=0.");
     
    418392    }
    419393    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);
    421395    if (subset1 != NULL) {
    422396        psError(__func__,"psImageSubset didn't return NULL when numCols=0.");
     
    434408
    435409    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);
    437411    if (subset1 != NULL) {
    438412        psError(__func__,"psImageSubset didn't return NULL when subset origin was outside of "
     
    441415    }
    442416    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);
    444418    if (subset1 != NULL) {
    445419        psError(__func__,"psImageSubset didn't return NULL when subset origin was outside of "
     
    448422    }
    449423    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);
    451425    if (subset1 != NULL) {
    452426        psError(__func__,"psImageSubset didn't return NULL when subset origin was outside of "
     
    455429    }
    456430    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);
    458432    if (subset1 != NULL) {
    459433        psError(__func__,"psImageSubset didn't return NULL when subset origin was outside of "
     
    468442
    469443    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);
    471445    if (subset1 != NULL) {
    472446        psError(__func__,"psImageSubset didn't return NULL when subset was outside of image (via rows).");
     
    474448    }
    475449    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);
    477451    if (subset1 != NULL) {
    478452        psError(__func__,"psImageSubset didn't return NULL when subset was outside of image (via cols).");
     
    480454    }
    481455    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);
    483457    if (subset1 != NULL) {
    484458        psError(__func__,"psImageSubset didn't return NULL when subset was outside of image (via row+cols).");
     
    494468
    495469    // Verify the returned psImage structure member Nchildren is set to zero.
    496     if (original->nChildren != 0) {
    497         psError(__func__,"psImageFreeChildren didn't set nChildren to zero.");
     470    if (original->children != NULL && original->children->n > 0) {
     471        psError(__func__,"psImageFreeChildren didn't set number of children to zero.");
    498472        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;
    505473    }
    506474
Note: See TracChangeset for help on using the changeset viewer.