IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 24, 2006, 1:43:16 PM (20 years ago)
Author:
drobbin
Message:

Changed psArray & psVector to zero 'n' upon allocation. Used to set vector->n = nalloc.

Location:
trunk/psLib/test/mathtypes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/mathtypes/tst_psVector.c

    r6349 r6484  
    1414 *  @author  Ross Harman, MHPCC
    1515 *
    16  *  @version $Revision: 1.9 $  $Name: not supported by cvs2svn $
    17  *  @date  $Date: 2006-02-08 00:00:36 $
     16 *  @version $Revision: 1.10 $  $Name: not supported by cvs2svn $
     17 *  @date  $Date: 2006-02-24 23:43:16 $
    1818 *
    1919 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    7070        return 1;
    7171    }
    72     if (psVec->n != psVec->nalloc) {
     72    if (psVec->n != 0) {
    7373        fprintf(stderr,"Vector population = %ld\n", psVec->n);
    7474        return 2;
     
    126126    for(psS32 i = 0; i < 5; i++) {
    127127        psVec->data.S32[i] = i*10;
     128        psVec->n++;
    128129    }
    129130
     
    202203    }
    203204
     205    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");
    204206    psVector* vecBogus = psVectorRealloc(NULL, 6);
    205207    if (vecBogus != NULL) {
     
    319321        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "VectorInit failed.  U8 Case \n");
    320322    }
    321     if ( !psVectorInit(in2, PS_MAX_U64) ) {
     323
     324    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");
     325    if ( psVectorInit(in2, PS_MAX_U64) ) {
    322326        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "VectorInit failed.  U16 Case \n");
    323327    }
     
    328332        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "VectorInit failed.  U64 Case \n");
    329333    }
    330     if ( !psVectorInit(in5, PS_MAX_S16 ) ) {
     334
     335    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");
     336    if ( psVectorInit(in5, PS_MAX_S16 ) ) {
    331337        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "VectorInit failed.  S8 Case \n");
    332338    }
     
    463469    vec->n = 0;
    464470
    465     if ( !psVectorSet(vec, 0, 10) )
     471    if ( !psVectorSet(vec, 0, 10) ) {
    466472        fprintf(stderr, "VectorSet failed to set S32 at position 0\n");
    467     if ( psVectorSet(vec, 10, 10) )
     473    }
     474    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");
     475    if ( psVectorSet(vec, 10, 10) ) {
    468476        fprintf(stderr, "VectorSet Improperly set S32 at out of range position\n");
    469     if ( !psVectorSet(vec, 1, 4) )
     477    }
     478    if ( !psVectorSet(vec, 1, 4) ) {
    470479        fprintf(stderr, "VectorSet Failed to set S32 at position 1\n");
    471     if ( (psS32)psVectorGet(vec, 0) != 10 )
     480    }
     481    if ( (psS32)psVectorGet(vec, 0) != 10 ) {
    472482        fprintf(stderr,
    473483                "VectorGet Failed to return the correct S32 from position 0\n");
    474     if ( (psS32)psVectorGet(vec, -1) != 4 )
     484    }
     485    if ( (psS32)psVectorGet(vec, -1) != 4 ) {
    475486        fprintf(stderr,
    476487                "VectorGet Failed to return the correct S32 from tail using -1\n");
     488    }
    477489
    478490    psFree(vec);
     
    485497    long numPix2 = 0;
    486498    psVector *vec = NULL;
     499
     500    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");
    487501    numPix = psVectorCountPixelMask(vec, 1);
    488 
    489502    if (numPix != -1) {
    490503        psError(PS_ERR_BAD_PARAMETER_VALUE, false,
     
    507520    vec2->data.U8[3] = 1;
    508521    vec2->data.U8[4] = 0;
     522    vec->n = 5;
     523    vec2->n = 5;
     524
     525    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");
    509526    numPix = psVectorCountPixelMask(vec, 1);
    510527    numPix2 = psVectorCountPixelMask(vec2, 1);
  • trunk/psLib/test/mathtypes/tst_psVectorSort_02.c

    r4547 r6484  
    1414 *  @author  Ross Harman, MHPCC
    1515 *
    16  *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
    17  *  @date  $Date: 2005-07-13 02:47:00 $
     16 *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
     17 *  @date  $Date: 2006-02-24 23:43:16 $
    1818 *
    1919 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    9898    for(psS32 m=0; m<5; m++) {
    9999        in->data.U8[m]= 20-m;
     100        in->n++;
    100101    }
    101102    out = psVectorAlloc(3,PS_TYPE_U32);
     103    out->n = 3;
    102104    out = psVectorSortIndex(out,in);
    103105    if(out->n != 5) {
     
    151153    in = psVectorAlloc(5,PS_TYPE_U8);
    152154    out = psVectorAlloc(5,PS_TYPE_U32);
     155    in->n = 5;
     156    out->n = 5;
    153157    tempVect = out;
    154158    in->type.type = PS_TYPE_BOOL;
  • trunk/psLib/test/mathtypes/verified/tst_psVector.stderr

    r6350 r6484  
    1818\**********************************************************************************/
    1919
     20<HOST>|I|testVectorRealloc
     21    Following should generate error message
    2022<HOST>|E|psVectorRealloc (FILE:LINENO)
    2123    psVectorRealloc must a given a non-NULL psVector to resize.  Desired datatype unknown.
     
    3840\**********************************************************************************/
    3941
     42<HOST>|I|testVectorInit
     43    Following should generate error message
    4044<HOST>|E|psVectorInit (FILE:LINENO)
    4145    Error:  U16 Value out of Range.
    42 <HOST>|E|testVectorInit (FILE:LINENO)
    43     VectorInit failed.  U16 Case
     46<HOST>|I|testVectorInit
     47    Following should generate error message
    4448<HOST>|E|psVectorInit (FILE:LINENO)
    4549    Error:  S8 Value out of Range.
    46 <HOST>|E|testVectorInit (FILE:LINENO)
    47     VectorInit failed.  S8 Case
    4850
    4951---> TESTPOINT PASSED (psVector{psVectorInit} | tst_psVector.c)
     
    8284\**********************************************************************************/
    8385
     86<HOST>|I|testVectorGetSet
     87    Following should generate error message
    8488<HOST>|E|psVectorSet (FILE:LINENO)
    8589    Invalid position.  Number too large
     
    9397\**********************************************************************************/
    9498
     99<HOST>|I|testVectorCountPixelMask
     100    Following should generate error message
    95101<HOST>|E|psVectorCountPixelMask (FILE:LINENO)
    96102    The input psVector can not be NULL.
     103<HOST>|I|testVectorCountPixelMask
     104    Following should generate error message
    97105<HOST>|E|psVectorCountPixelMask (FILE:LINENO)
    98106    psVector type does not match the specified psMaskType!
Note: See TracChangeset for help on using the changeset viewer.