IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 2, 2005, 11:03:20 AM (21 years ago)
Author:
evanalst
Message:

Update test case for psPlaneTransformAlloc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/astronomy/tst_psCoord.c

    r3365 r3366  
    66*  @author GLG, MHPCC
    77*
    8 *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
    9 *  @date $Date: 2005-03-02 19:41:31 $
     8*  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
     9*  @date $Date: 2005-03-02 21:03:20 $
    1010*
    1111*  XXX: THe psProject() and psDeproject() functions do not work fully.  They
     
    2222#include "pslib.h"
    2323static psS32 testSphereTransformAlloc( void );
    24 static psS32 test1b( void );
     24static psS32 testPlaneTransformAlloc( void );
    2525static psS32 test1c( void );
    2626static psS32 test2( void );
     
    4444testDescription tests[] = {
    4545                              {testSphereTransformAlloc, 819, "psSphereTransformAlloc()", 0, false},
    46                               {test1b, 0000, "psPlaneTransformAlloc()", 0, false},
     46                              {testPlaneTransformAlloc, 826, "psPlaneTransformAlloc()", 0, false},
    4747                              {test1c, 0000, "psPlaneDistortAlloc()", 0, false},
    4848                              {test2, 0000, "psPlaneTransformApply()", 0, false},
     
    145145#define NY_TERMS 4
    146146#define NZ_TERMS 5
    147 psS32 test1b( void )
    148 {
    149     psS32 testStatus = 0;
     147
     148psS32 testPlaneTransformAlloc( void )
     149{
     150    //    psS32 testStatus = 0;
     151    // Allocate psPlaneTransform with known x and y terms
    150152    psPlaneTransform *myPT = psPlaneTransformAlloc(NX_TERMS, NY_TERMS);
    151153
     154    // Verify returned value is not NULL
     155    if(myPT == NULL) {
     156        psError(PS_ERR_UNKNOWN,true,"Function returned NULL not expected.");
     157        return 1;
     158    }
     159
     160    // Verify returned transform has members set properly
    152161    if (myPT->x->nX != NX_TERMS) {
    153         printf("ERROR: myPT->x->nX is %d, should be %d\n", myPT->x->nX, NX_TERMS);
    154         testStatus = 1;
     162        psError(PS_ERR_UNKNOWN,true,"myPT->x->nX is %d, should be %d",
     163                myPT->x->nX, NX_TERMS);
     164        return 2;
    155165    }
    156166    if (myPT->y->nX != NX_TERMS) {
    157         printf("ERROR: myPT->y->nX is %d, should be %d\n", myPT->y->nX, NX_TERMS);
    158         testStatus = 1;
    159     }
    160 
     167        psError(PS_ERR_UNKNOWN,true,"myPT->y->nX is %d, should be %d",
     168                myPT->y->nX, NX_TERMS);
     169        return 3;
     170    }
    161171    if (myPT->x->nY != NY_TERMS) {
    162         printf("ERROR: myPT->x->nY is %d, should be %d\n", myPT->x->nY, NY_TERMS);
    163         testStatus = 1;
     172        psError(PS_ERR_UNKNOWN,true,"myPT->x->nY is %d, should be %d",
     173                myPT->x->nY, NY_TERMS);
     174        return 4;
    164175    }
    165176    if (myPT->y->nY != NY_TERMS) {
    166         printf("ERROR: myPT->y->nY is %d, should be %d\n", myPT->y->nY, NY_TERMS);
    167         testStatus = 1;
    168     }
     177        psError(PS_ERR_UNKNOWN,true,"myPT->y->nY is %d, should be %d",
     178                myPT->y->nY, NY_TERMS);
     179        return 5;
     180    }
     181
     182    // Free plane transform
    169183    psFree(myPT);
    170184
    171     printf("-------------------------------------------------------------------\n");
    172     printf("Calling psPlaneTransformAlloc() with negative-order polynomial request.  Should generate error, return NULL.\n");
     185    // Attempt to specify negative x terms and verify NULL returned and errror message generated
     186    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message: negative x terms");
    173187    myPT = psPlaneTransformAlloc(-1.0, 1.0);
    174188    if (myPT != NULL) {
    175         printf("TEST ERROR: psPlaneTransformAlloc() did not return NULL.\n");
    176         testStatus = false;
    177         myPT = NULL;
    178     }
    179 
    180     printf("-------------------------------------------------------------------\n");
    181     printf("Calling psPlaneTransformAlloc() with negative-order polynomial request.  Should generate error, return NULL.\n");
     189        psError(PS_ERR_UNKNOWN,true,"psPlaneTransformAlloc() did not return NULL.");
     190        return 6;
     191    }
     192
     193    // Attempt to specify negative y terms and verify NULL returned and error message generated
     194    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message: negative y terms");
    182195    myPT = psPlaneTransformAlloc(1.0, -1.0);
    183196    if (myPT != NULL) {
    184         printf("TEST ERROR: psPlaneTransformAlloc() did not return NULL.\n");
    185         testStatus = false;
    186         myPT = NULL;
    187     }
    188     printf("-------------------------------------------------------------------\n");
    189 
     197        psError(PS_ERR_UNKNOWN,true,"psPlaneTransformAlloc() did not return NULL.");
     198        return 7;
     199    }
    190200
    191201    psFree(myPT);
    192     return(testStatus);
    193 }
     202
     203    return 0;
     204}
     205
     206
    194207psS32 test1c( void )
    195208{
Note: See TracChangeset for help on using the changeset viewer.