IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4212


Ignore:
Timestamp:
Jun 10, 2005, 11:46:46 AM (21 years ago)
Author:
desonia
Message:

fixed bug in psPixels and tested psVectorExtend.

Location:
trunk/psLib
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/collections/psCollectionsErrors.dat

    r3959 r4212  
    1616psVector_SORT_NULL                     psVectorSort can not sort a NULL psVector.
    1717psVector_UNSUPPORTED_TYPE              Input psVector is an unsupported type (0x%x).
     18psVector_NULL                          The input psVector can not be NULL.
     19psVector_EXTENDSIZE_NEG                The input number of elements to extend must be non-negative.
    1820#
    1921psBitSet_ALLOC_NEG_SIZE                The number of bit in a psBitSet (%d) must be greater than zero.
  • trunk/psLib/src/collections/psCollectionsErrors.h

    r4162 r4212  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-06-08 23:40:45 $
     9 *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-06-10 21:46:46 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    3737#define PS_ERRORTEXT_psVector_SORT_NULL "psVectorSort can not sort a NULL psVector."
    3838#define PS_ERRORTEXT_psVector_UNSUPPORTED_TYPE "Input psVector is an unsupported type (0x%x)."
     39#define PS_ERRORTEXT_psVector_NULL "The input psVector can not be NULL."
     40#define PS_ERRORTEXT_psVector_EXTENDSIZE_NEG "The input number of elements to extend must be non-negative."
    3941#define PS_ERRORTEXT_psBitSet_ALLOC_NEG_SIZE "The number of bit in a psBitSet (%d) must be greater than zero."
    4042#define PS_ERRORTEXT_psBitSet_SET_NULL "Can not operate on a NULL psBitSet."
  • trunk/psLib/src/collections/psPixels.c

    r4203 r4212  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-06-09 23:51:49 $
     9 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-06-10 21:46:46 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    132132
    133133    // determine the output image size
    134     int numRows = x1-x0;
    135     int numCols = y1-y0;
     134    int numRows = y1-y0;
     135    int numCols = x1-x0;
    136136    if (numRows < 1 || numCols < 1) {
    137137        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    138138                PS_ERRORTEXT_psPixels_REGION_INVALID,
    139                 x0,x1,y0,y1);
     139                y0,y1,x0,x1);
    140140        psFree(out);
    141141        return NULL;
     
    150150        return NULL;
    151151    }
    152     *(psS32*)&out->row0 = x0;
    153     *(psS32*)&out->col0 = y0;
     152    *(psS32*)&out->row0 = y0;
     153    *(psS32*)&out->col0 = x0;
    154154
    155155    // initialize image to all zeros
     
    169169        // pixel in region?
    170170        if (x >= x0 && x < x1 && y >= y0 && y < y1) {
    171             outData[x-x0][y-y0] |= maskVal;
     171            outData[y-y0][x-x0] |= maskVal;
    172172        }
    173173    }
  • trunk/psLib/src/collections/psVector.c

    r3786 r4212  
    99*  @author Robert DeSonia, MHPCC
    1010*
    11 *  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2005-04-29 02:25:09 $
     11*  @version $Revision: 1.42 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2005-06-10 21:46:46 $
    1313*
    1414*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    5454
    5555    elementSize = PSELEMTYPE_SIZEOF(elemType);
     56    if (elementSize < 1) {
     57        psError(PS_ERR_BAD_PARAMETER_TYPE, true,
     58                PS_ERRORTEXT_psVector_UNSUPPORTED_TYPE, elemType);
     59        return NULL;
     60    }
     61
    5662
    5763    // Create vector struct
     
    121127    in->n = n;
    122128    return in;
     129}
     130
     131psVector *psVectorExtend(psVector *vector, int delta, int nExtend)
     132{
     133    // can't handle a NULL vector (don't know the data type to allocate)
     134    if (vector == NULL) {
     135        psError(PS_ERR_BAD_PARAMETER_NULL, true,
     136                PS_ERRORTEXT_psVector_NULL);
     137        return NULL;
     138    }
     139
     140    // requirement on delta; if < 1, set to 10.
     141    if (delta < 1) {
     142        delta = 10;
     143    }
     144
     145    // adjust the allocated size, if needed. (if nExtend < 1, this is will never happen)
     146    if (nExtend > 0) {
     147        unsigned int minAlloc = vector->n + nExtend + nExtend;
     148        if (vector->nalloc < minAlloc) {
     149            unsigned int nAlloc = delta + vector->nalloc;
     150            // make sure the delta is large enough hold twice the extended length.
     151            if (nAlloc < minAlloc) {
     152                nAlloc = minAlloc;
     153            }
     154            vector = psVectorRealloc(vector, nAlloc);
     155        }
     156    } else if (nExtend < -vector->n) {
     157        // For the case of a negative nExtend, need to check that we are not decreasing
     158        // vector beyond its own length (i.e., creating a negative length).
     159        nExtend = -vector->n;
     160    }
     161
     162    // increment the length by the value specified
     163    vector->n += nExtend;
     164
     165    return vector;
    123166}
    124167
  • trunk/psLib/src/collections/psVector.h

    r4162 r4212  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-06-08 23:40:45 $
     13 *  @version $Revision: 1.35 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-06-10 21:46:46 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    8888    psVector* psVec,                   ///< Vector to reallocate.
    8989    psU32 nalloc                       ///< Total number of elements to make available.
     90);
     91
     92/** Extend a vector's length.
     93 *
     94 *  Increments a vector's length, n, by the specified number of elements.
     95 *  If the allocated storage is less than the current vector's length plus
     96 *  twice the number of elements to be added, it is reallocated larger by
     97 *  a given amount.
     98 *
     99 *  @return psVector*      Pointer to the adjusted psVector
     100 */
     101psVector *psVectorExtend(
     102    psVector *vector,                  ///< Vector to extend
     103    int delta,                         ///< Amount to expand allocation, if necessary
     104    int nExtend                        ///< Number of elements to add to vector length
    90105);
    91106
  • trunk/psLib/src/mathtypes/psVector.c

    r3786 r4212  
    99*  @author Robert DeSonia, MHPCC
    1010*
    11 *  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2005-04-29 02:25:09 $
     11*  @version $Revision: 1.42 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2005-06-10 21:46:46 $
    1313*
    1414*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    5454
    5555    elementSize = PSELEMTYPE_SIZEOF(elemType);
     56    if (elementSize < 1) {
     57        psError(PS_ERR_BAD_PARAMETER_TYPE, true,
     58                PS_ERRORTEXT_psVector_UNSUPPORTED_TYPE, elemType);
     59        return NULL;
     60    }
     61
    5662
    5763    // Create vector struct
     
    121127    in->n = n;
    122128    return in;
     129}
     130
     131psVector *psVectorExtend(psVector *vector, int delta, int nExtend)
     132{
     133    // can't handle a NULL vector (don't know the data type to allocate)
     134    if (vector == NULL) {
     135        psError(PS_ERR_BAD_PARAMETER_NULL, true,
     136                PS_ERRORTEXT_psVector_NULL);
     137        return NULL;
     138    }
     139
     140    // requirement on delta; if < 1, set to 10.
     141    if (delta < 1) {
     142        delta = 10;
     143    }
     144
     145    // adjust the allocated size, if needed. (if nExtend < 1, this is will never happen)
     146    if (nExtend > 0) {
     147        unsigned int minAlloc = vector->n + nExtend + nExtend;
     148        if (vector->nalloc < minAlloc) {
     149            unsigned int nAlloc = delta + vector->nalloc;
     150            // make sure the delta is large enough hold twice the extended length.
     151            if (nAlloc < minAlloc) {
     152                nAlloc = minAlloc;
     153            }
     154            vector = psVectorRealloc(vector, nAlloc);
     155        }
     156    } else if (nExtend < -vector->n) {
     157        // For the case of a negative nExtend, need to check that we are not decreasing
     158        // vector beyond its own length (i.e., creating a negative length).
     159        nExtend = -vector->n;
     160    }
     161
     162    // increment the length by the value specified
     163    vector->n += nExtend;
     164
     165    return vector;
    123166}
    124167
  • trunk/psLib/src/mathtypes/psVector.h

    r4162 r4212  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-06-08 23:40:45 $
     13 *  @version $Revision: 1.35 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-06-10 21:46:46 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    8888    psVector* psVec,                   ///< Vector to reallocate.
    8989    psU32 nalloc                       ///< Total number of elements to make available.
     90);
     91
     92/** Extend a vector's length.
     93 *
     94 *  Increments a vector's length, n, by the specified number of elements.
     95 *  If the allocated storage is less than the current vector's length plus
     96 *  twice the number of elements to be added, it is reallocated larger by
     97 *  a given amount.
     98 *
     99 *  @return psVector*      Pointer to the adjusted psVector
     100 */
     101psVector *psVectorExtend(
     102    psVector *vector,                  ///< Vector to extend
     103    int delta,                         ///< Amount to expand allocation, if necessary
     104    int nExtend                        ///< Number of elements to add to vector length
    90105);
    91106
  • trunk/psLib/src/types/psPixels.c

    r4203 r4212  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-06-09 23:51:49 $
     9 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-06-10 21:46:46 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    132132
    133133    // determine the output image size
    134     int numRows = x1-x0;
    135     int numCols = y1-y0;
     134    int numRows = y1-y0;
     135    int numCols = x1-x0;
    136136    if (numRows < 1 || numCols < 1) {
    137137        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    138138                PS_ERRORTEXT_psPixels_REGION_INVALID,
    139                 x0,x1,y0,y1);
     139                y0,y1,x0,x1);
    140140        psFree(out);
    141141        return NULL;
     
    150150        return NULL;
    151151    }
    152     *(psS32*)&out->row0 = x0;
    153     *(psS32*)&out->col0 = y0;
     152    *(psS32*)&out->row0 = y0;
     153    *(psS32*)&out->col0 = x0;
    154154
    155155    // initialize image to all zeros
     
    169169        // pixel in region?
    170170        if (x >= x0 && x < x1 && y >= y0 && y < y1) {
    171             outData[x-x0][y-y0] |= maskVal;
     171            outData[y-y0][x-x0] |= maskVal;
    172172        }
    173173    }
  • trunk/psLib/test/collections/tst_psVector.c

    r3682 r4212  
    1414 *  @author  Ross Harman, MHPCC
    1515 *
    16  *  @version $Revision: 1.8 $  $Name: not supported by cvs2svn $
    17  *  @date  $Date: 2005-04-07 20:27:41 $
     16 *  @version $Revision: 1.9 $  $Name: not supported by cvs2svn $
     17 *  @date  $Date: 2005-06-10 21:46:46 $
    1818 *
    1919 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2121 */
    2222
     23#include "psTest.h"
    2324#include "pslib_strict.h"
    24 #include "psTest.h"
    25 
    26 psS32 main(psS32 argc,
    27            char* argv[])
    28 {
    29 
    30 
    31     // Test A - Create S32 vector
    32     printPositiveTestHeader(stdout,"psVector", "Create S32 vector");
     25
     26static psS32 testVectorAlloc(void);
     27static psS32 testVectorRealloc(void);
     28static psS32 testVectorExtend(void);
     29
     30testDescription tests[] = {
     31                              {testVectorAlloc,-1,"psVectorAlloc",0,false},
     32                              {testVectorRealloc,-2,"psVectorRealloc",0,false},
     33                              {testVectorExtend,-3,"psVectorExtend",0,false},
     34                              {NULL}
     35                          };
     36
     37psS32 main(psS32 argc, char* argv[])
     38{
     39    psLogSetLevel(PS_LOG_INFO);
     40
     41    if ( ! runTestSuite(stderr,"psVector",tests,argc,argv) ) {
     42        return 1;
     43    }
     44    return 0;
     45}
     46
     47psS32 testVectorAlloc(void)
     48{
    3349    psVector *psVec = psVectorAlloc(5, PS_TYPE_S32);
    34     printf("Vector size = %d\n", psVec->nalloc);
    35     printf("Vector type = %d\n", psVec->type.type);
    36     printf("Vector dimen = %d\n", psVec->type.dimen);
    37     printFooter(stdout, "psVector", "Create S32 vector", true);
    38 
     50
     51    if (psVec == NULL) {
     52        fprintf(stderr,"ERROR: Return is NULL\n");
     53        return 1;
     54    }
     55    if (psVec->nalloc != 5) {
     56        fprintf(stderr,"Vector size = %d\n", psVec->nalloc);
     57        return 1;
     58    }
     59    if (psVec->n != psVec->nalloc) {
     60        fprintf(stderr,"Vector population = %d\n", psVec->n);
     61        return 2;
     62    }
     63
     64    if (psVec->type.type != PS_TYPE_S32) {
     65        fprintf(stderr,"Vector type = %d\n", psVec->type.type);
     66        return 3;
     67    }
     68    if (psVec->type.dimen != PS_DIMEN_VECTOR) {
     69        fprintf(stderr,"Vector dimen = %d\n", psVec->type.dimen);
     70        return 4;
     71    }
    3972
    4073    // Test B - Add data to integer vector
    41     printPositiveTestHeader(stdout, "psVector", "Add data to S32 vector");
    4274    for(psS32 i = 0; i < 5; i++) {
    4375        psVec->data.S32[i] = i*10;
    44         printf("Elem %d = %d\n", i, psVec->data.S32[i]);
    45     }
    46     printf("Vector size = %d\n", psVec->nalloc);
    47     printf("Vector population = %d\n", psVec->n);
    48     printFooter(stdout, "psVector", "Add data to S32 vector", true);
    49 
     76    }
     77
     78    psVector* vecZero = psVectorAlloc(0, PS_TYPE_S32);
     79    if(vecZero == NULL) {
     80        fprintf(stderr,"ERROR: Return is NULL\n");
     81        return 5;
     82    }
     83    if (vecZero->nalloc != 0) {
     84        fprintf(stderr,"Vector size = %d\n", vecZero->nalloc);
     85        return 6;
     86    }
     87    if (vecZero->n != vecZero->nalloc) {
     88        fprintf(stderr,"Vector population = %d\n", vecZero->n);
     89        return 7;
     90    }
     91
     92    psLogMsg(__func__,PS_LOG_INFO, "Following should be an error.");
     93    psVector* vecBogus = psVectorAlloc(10, 0);
     94    if (vecBogus != NULL) {
     95        fprintf(stderr,"Huh!  bogus type generated a psVector?");
     96        return 20;
     97    }
     98
     99    psFree(psVec);
     100    psFree(vecZero);
     101
     102    return 0;
     103}
     104
     105psS32 testVectorRealloc(void)
     106{
     107    // create new psVector
     108    psVector *psVec = psVectorAlloc(5, PS_TYPE_S32);
     109    if (psVec == NULL) {
     110        fprintf(stderr,"ERROR: Return is NULL\n");
     111        return 30;
     112    }
     113    for(psS32 i = 0; i < 5; i++) {
     114        psVec->data.S32[i] = i*10;
     115    }
    50116
    51117    // Test C - Reallocate S32 vector bigger
    52     printPositiveTestHeader(stdout,"psVector", "Reallocate S32 vector bigger");
    53118    psVec = psVectorRealloc(psVec,10);
    54     printf("Adding more elements to S32 vector...\n");
     119    if (psVec == NULL) {
     120        fprintf(stderr,"ERROR: Return is NULL\n");
     121        return 1;
     122    }
     123    if (psVec->nalloc != 10) {
     124        fprintf(stderr,"Vector size = %d\n", psVec->nalloc);
     125        return 1;
     126    }
     127    if (psVec->n != 5) {
     128        fprintf(stderr,"Vector population = %d\n", psVec->n);
     129        return 2;
     130    }
     131
     132    if (psVec->type.type != PS_TYPE_S32) {
     133        fprintf(stderr,"Vector type = %d\n", psVec->type.type);
     134        return 3;
     135    }
     136    if (psVec->type.dimen != PS_DIMEN_VECTOR) {
     137        fprintf(stderr,"Vector dimen = %d\n", psVec->type.dimen);
     138        return 4;
     139    }
     140
    55141    for(psS32 i = 5; i < 10; i++) {
    56142        psVec->data.S32[i] = i*10;
    57143        psVec->n++;
    58         printf("Elem %d = %d\n", i, psVec->data.S32[i]);
    59     }
    60     printf("Vector size = %d\n", psVec->nalloc);
    61     printf("Vector population = %d\n", psVec->n);
    62     printFooter(stdout, "psVector", "Reallocate S32 vector bigger", true);
    63 
     144    }
     145
     146    for(psS32 i = 0; i < 10; i++) {
     147        if (psVec->data.S32[i] != i*10) {
     148            fprintf(stderr,"Elem %d = %d, expected %d\n", i, psVec->data.S32[i], i*10);
     149            return 5;
     150        }
     151    }
    64152
    65153    // Test D - Reallocate S32 vector smaller
    66     printPositiveTestHeader(stdout,"psVector","Reallocate S32 vector smaller");
    67154    psVec = psVectorRealloc(psVec,3);
    68     printf("Vector size = %d\n", psVec->nalloc);
     155    if (psVec == NULL) {
     156        fprintf(stderr,"ERROR: Return is NULL\n");
     157        return 9;
     158    }
     159    if (psVec->nalloc != 3) {
     160        fprintf(stderr,"Vector size = %d\n", psVec->nalloc);
     161        return 10;
     162    }
     163    if (psVec->n != 3) {
     164        fprintf(stderr,"Vector population = %d\n", psVec->n);
     165        return 11;
     166    }
     167
    69168    for(psS32 i = 0; i < 3; i++) {
    70         printf("Elem %d = %d\n", i, psVec->data.S32[i]);
    71     }
    72     printf("Vector size = %d\n", psVec->nalloc);
    73     printf("Vector population = %d\n", psVec->n);
    74     printFooter(stdout, "psVector", "Reallocate integer S32 smaller", true);
    75 
     169        if (psVec->data.S32[i] != i*10) {
     170            fprintf(stderr,"Elem %d = %d, expected %d\n", i, psVec->data.S32[i], i*10);
     171            return 12;
     172        }
     173    }
     174
     175    psVec = psVectorRealloc(psVec,0);
     176    if (psVec == NULL) {
     177        fprintf(stderr,"ERROR: Return is NULL\n");
     178        return 20;
     179    }
     180    if (psVec->nalloc != 0) {
     181        fprintf(stderr,"Vector size = %d\n", psVec->nalloc);
     182        return 21;
     183    }
     184    if (psVec->n != 0) {
     185        fprintf(stderr,"Vector population = %d\n", psVec->n);
     186        return 22;
     187    }
     188
     189    psVector* vecBogus = psVectorRealloc(NULL, 6);
     190    if (vecBogus != NULL) {
     191        fprintf(stderr,"Huh!  bogus type generated a psVector?");
     192        return 25;
     193    }
    76194
    77195    // Test E - Free S32 vector
    78     printPositiveTestHeader(stdout, "psVector", "Free S32 vector");
    79196    psFree(psVec);
    80     psS32 leaks = psMemCheckLeaks(0, NULL, stdout, false);
    81     if(leaks != 0) {
    82         printf("ERROR: Found %d memory leaks\n",leaks);
    83     }
    84     psS32 nBad = psMemCheckCorruption(0);
    85     if(nBad) {
    86         printf("ERROR: Found %d bad memory blocks\n", nBad);
    87     }
    88     printFooter(stdout, "psVector" ,"Free S32 vector", true);
    89 
    90 
    91     // Test F - Attempt to create a S32 vector with zero size
    92     printNegativeTestHeader(stdout,"psVector", "Attempt to create a S32 vector with zero size",
    93                             "Invalid value for nalloc", 0);
    94     psLogMsg(__func__,PS_LOG_INFO, "Following should be an error message.");
    95     psVector *vecBad = psVectorAlloc(0, PS_TYPE_S32);
    96     if(vecBad != NULL) {
    97         printf("ERROR: Return is not NULL\n");
    98     }
    99     printFooter(stdout, "psVector", "Attempt to create a S32 vector with zero size", true);
    100 
    101 
    102     // Test G - Attempt to realloc a null S32 vector
    103     printNegativeTestHeader(stdout,"psVector", "Attempt to realloc a null S32 vector",
    104                             "Null input vector", 0);
    105     psLogMsg(__func__,PS_LOG_INFO, "Following should be an error message.");
    106     psVectorRealloc(NULL,6);
    107     printFooter(stdout, "psVector", "Attempt to realloc a null S32 vector", true);
    108 
    109     return 0;
    110 }
     197
     198    return 0;
     199}
     200
     201psS32 testVectorExtend(void)
     202{
     203    // create new psVector
     204    psVector *psVec = psVectorAlloc(5, PS_TYPE_S32);
     205    if (psVec == NULL) {
     206        fprintf(stderr,"ERROR: Return is NULL\n");
     207        return 1;
     208    }
     209
     210    psVec->n = 0;
     211
     212    psVec = psVectorExtend(psVec, 0, 2);
     213    if (psVec == NULL) {
     214        fprintf(stderr,"ERROR: Return is NULL\n");
     215        return 2;
     216    }
     217    if (psVec->nalloc != 5) { // no growth should occur
     218        fprintf(stderr,"Vector size = %d\n", psVec->nalloc);
     219        return 3;
     220    }
     221    if (psVec->n != 2) {
     222        fprintf(stderr,"Vector population = %d\n", psVec->n);
     223        return 4;
     224    }
     225
     226    psVec = psVectorExtend(psVec, 0, 2);
     227    if (psVec == NULL) {
     228        fprintf(stderr,"ERROR: Return is NULL\n");
     229        return 10;
     230    }
     231    if (psVec->nalloc != 15) { // growth should occur
     232        fprintf(stderr,"Vector size = %d\n", psVec->nalloc);
     233        return 11;
     234    }
     235    if (psVec->n != 4) {
     236        fprintf(stderr,"Vector population = %d\n", psVec->n);
     237        return 12;
     238    }
     239
     240    psVec = psVectorExtend(psVec, 0, -2);
     241    if (psVec == NULL) {
     242        fprintf(stderr,"ERROR: Return is NULL\n");
     243        return 20;
     244    }
     245    if (psVec->nalloc != 15) { // no growth
     246        fprintf(stderr,"Vector size = %d\n", psVec->nalloc);
     247        return 21;
     248    }
     249    if (psVec->n != 2) {
     250        fprintf(stderr,"Vector population = %d\n", psVec->n);
     251        return 22;
     252    }
     253
     254    psVec = psVectorExtend(psVec, 0, -20);
     255    if (psVec == NULL) {
     256        fprintf(stderr,"ERROR: Return is NULL\n");
     257        return 30;
     258    }
     259    if (psVec->nalloc != 15) { // no growth
     260        fprintf(stderr,"Vector size = %d\n", psVec->nalloc);
     261        return 31;
     262    }
     263    if (psVec->n != 0) {
     264        fprintf(stderr,"Vector population = %d\n", psVec->n);
     265        return 32;
     266    }
     267
     268    psFree(psVec);
     269
     270    return 0;
     271}
  • trunk/psLib/test/collections/verified/tst_psVector.stderr

    r3127 r4212  
    1 <DATE><TIME>|<HOST>|I|main
    2     Following should be an error message.
    3 <DATE><TIME>|<HOST>|I|main
    4     Following should be an error message.
     1/***************************** TESTPOINT ******************************************\
     2*             TestFile: tst_psVector.c                                             *
     3*            TestPoint: psVector{psVectorAlloc}                                    *
     4*             TestType: Positive                                                   *
     5\**********************************************************************************/
     6
     7<DATE><TIME>|<HOST>|I|testVectorAlloc
     8    Following should be an error.
     9<DATE><TIME>|<HOST>|E|psVectorAlloc (FILE:LINENO)
     10    Input psVector is an unsupported type (0x0).
     11
     12---> TESTPOINT PASSED (psVector{psVectorAlloc} | tst_psVector.c)
     13
     14/***************************** TESTPOINT ******************************************\
     15*             TestFile: tst_psVector.c                                             *
     16*            TestPoint: psVector{psVectorRealloc}                                  *
     17*             TestType: Positive                                                   *
     18\**********************************************************************************/
     19
    520<DATE><TIME>|<HOST>|E|psVectorRealloc (FILE:LINENO)
    621    psVectorRealloc must a given a non-NULL psVector to resize.  Desired datatype unknown.
     22
     23---> TESTPOINT PASSED (psVector{psVectorRealloc} | tst_psVector.c)
     24
     25/***************************** TESTPOINT ******************************************\
     26*             TestFile: tst_psVector.c                                             *
     27*            TestPoint: psVector{psVectorExtend}                                   *
     28*             TestType: Positive                                                   *
     29\**********************************************************************************/
     30
     31
     32---> TESTPOINT PASSED (psVector{psVectorExtend} | tst_psVector.c)
     33
Note: See TracChangeset for help on using the changeset viewer.