IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 13623


Ignore:
Timestamp:
Jun 4, 2007, 3:10:22 PM (19 years ago)
Author:
gusciora
Message:

Improved test coverage, added memory leak checks, etc.

Location:
trunk/psLib/test/astro
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/astro/tap_psCoord.c

    r13084 r13623  
    55*  @author GLG, MHPCC
    66*
    7 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    8 *  @date $Date: 2007-05-01 00:08:52 $
     7*  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     8*  @date $Date: 2007-06-05 01:10:22 $
    99*
    1010*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    5050        psPlaneTransform *myPT = psPlaneTransformAlloc(ORDER_X, ORDER_Y);
    5151        ok(myPT != NULL, "psPlaneTransformAlloc() returned non-NULL");
    52         skip_start(myPT == NULL, 6, "Skipping tests because psPlaneTransformAlloc() returned NULL");
     52        skip_start(myPT == NULL, 4, "Skipping tests because psPlaneTransformAlloc() returned NULL");
    5353        ok(myPT->x->nX == ORDER_X, "psPlaneTransform->x->nX set correctly");
    5454        ok(myPT->y->nX == ORDER_X, "psPlaneTransform->y->nX set correctly");
     
    6464
    6565        myPT = psPlaneTransformAlloc(1, -1);
    66         ok(myPT == NULL, "psPlaneTransformAlloc(1, -11) returned NULL");
     66        ok(myPT == NULL, "psPlaneTransformAlloc(1, -1) returned NULL");
    6767        psFree(myPT);
    6868
     
    127127            in->yErr = 0.0;
    128128
    129             // XXX: psPlane *out = psPlaneTransformApply(out, pt, in); causes a seg-fault.  Why?
     129            // XXX: psPlane *out = psPlaneTransformApply(out, pt, in); causes a seg-fault.
     130            // Why?
    130131            psPlane *out = psPlaneTransformApply(NULL, pt, in);
    131132            if(out == NULL) {
     
    154155
    155156    // psPlaneTransformApply should generate error message for NULL psPlaneTransform
    156     if (1) {
     157    {
    157158        psMemId id = psMemGetId();
    158159        psPlane* in = psPlaneAlloc();
     
    165166
    166167    // psPlaneTransformApply should generate error message for NULL x coeff psPlaneTransform
    167     if (1) {
     168    {
    168169        psMemId id = psMemGetId();
    169170        psPlane *in = psPlaneAlloc();
     
    180181
    181182    // psPlaneTransformApply Should generate error message for NULL y coeff psPlaneTransform");
    182     if (1) {
     183    {
    183184        psMemId id = psMemGetId();
    184185        psPlane* in = psPlaneAlloc();
     
    195196
    196197    // psPlaneTransformApply() should generate error message for NULL psPlane");
    197     if (1) {
     198    {
    198199        psMemId id = psMemGetId();
    199200        psPlaneTransform* pt = psPlaneTransformAlloc(2,2);
  • trunk/psLib/test/astro/tap_psCoord02.c

    r13084 r13623  
    77*  XXX: These tests should probably be split among several files
    88*
    9 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    10 *  @date $Date: 2007-05-01 00:08:52 $
     9*  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
     10*  @date $Date: 2007-06-05 01:10:22 $
    1111*
    1212*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    449449        // We calling psPlaneTransformInvert with acceptable linear transformations
    450450        for (psS32 n = 0 ; n < NUM_TRANSFORMS ; n++)
    451     {
    452         if (n == 0) {
     451        {
     452            if (n == 0) {
    453453                // I ensure that we test the identity transformation since this was
    454454                // giving us probs before.
  • trunk/psLib/test/astro/tap_psEarthOrientation_corrections.c

    r13084 r13623  
    7171void testAberration(void)
    7272{
    73 //    diag("  >>>Test 2:  psAberration ");
     73    // psAberration()
    7474    psSphere *apparent = NULL;
    7575    psSphere *empty = NULL;
     
    152152void testGravDef(void)
    153153{
    154 //    diag("  >>>Test 3:  psGravityDeflection ");
    155     //Test for psGravityDeflection
    156     //Return properly allocated psEarthPole
    157     /*
     154    // psGravityDeflection
     155    // Test for psGravityDeflection
     156    // Return properly allocated psEarthPole
     157    /* XXX: Fix this
    158158        psSphere *apparent = NULL;
    159159        psSphere *empty = NULL;
     
    282282void testEOC_Corrs(void)
    283283{
    284 //    diag("  >>>Test 4: psEOC Correction Functions");
     284    // psEOC Correction Functions");
    285285    //Tests for psEOC_PrecessionCorr
    286     /*
     286    /* XXX: Fix this
    287287        psTime *empty = NULL;
    288288        psTime *time2 = psTimeAlloc(PS_TIME_UTC);
  • trunk/psLib/test/astro/tap_psEarthOrientation_motion.c

    r12607 r13623  
    1111 *
    1212 */
    13 
    1413#include <pslib.h>
    1514#include <string.h>
    16 
    1715#include "tap.h"
    1816#include "pstap.h"
     
    2220static void testSphereRots(void);
    2321static void testSpherePrecess(void);
    24 
    2522#define MJD_1900  15021.0        // Modified Julian Day 1/1/1900 00:00:00
    2623#define MJD_2100  88069.0        // Modified Julian Day 1/1/2100 00:00:00
     
    3027    psLogSetFormat("HLNM");
    3128    psLogSetLevel(PS_LOG_INFO);
    32     plan_tests(48);
    33 
    34 //    diag("Tests for psEarthOrientation Motion Functions");
    35 
     29    plan_tests(78);
     30
     31    // Tests for psEarthOrientation Motion Functions
    3632    // Initialize library internal structures
    3733    psLibInit("pslib.config");
     
    4238    testSpherePrecess();
    4339
    44     // Cleanup library
    4540    psLibFinalize();
    46 
    4741    done();
    4842}
     
    5044void testPrecessionModel(void)
    5145{
    52 //    diag("  >>>Test 1:  psEOC_PrecessionModel");
     46    // psEOC_PrecessionModel
    5347
    5448    psEarthPole *ep = NULL;
    5549    psTime *testTime = NULL;
    5650
     51
    5752    //Test for psEarthPoleAlloc
    5853    //Return properly allocated psEarthPole
    5954    {
     55        psMemId id = psMemGetId();
    6056        ep = psEarthPoleAlloc();
    61         ok( ep != NULL,
    62             "psEarthPoleAlloc:               return properly allocated psEarthPole.");
     57        ok( ep != NULL, "psEarthPoleAlloc: return properly allocated psEarthPole.");
    6358        psFree(ep);
    6459        ep = NULL;
    65     }
     60        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     61    }
     62
     63
    6664    //Tests for psEOC_PrecessionModel
    6765    //Return NULL for NULL time input.
    6866    {
     67        psMemId id = psMemGetId();
    6968        ep = psEOC_PrecessionModel(NULL);
    70         ok( ep == NULL,
    71             "psEOC_PrecessionModel:          return NULL for NULL time input.");
    72     }
     69        ok( ep == NULL, "psEOC_PrecessionModel: return NULL for NULL time input.");
     70        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     71    }
     72
     73
    7374    //Return NULL for UT1 time input.
    7475    {
     76        psMemId id = psMemGetId();
    7577        testTime = psTimeAlloc(PS_TIME_UT1);
    7678        ep = psEOC_PrecessionModel(testTime);
    77         ok( ep == NULL,
    78             "psEOC_PrecessionModel:          return NULL for UT1 time input.");
    79     }
     79        ok( ep == NULL, "psEOC_PrecessionModel: return NULL for UT1 time input.");
     80        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     81    }
     82
     83
    8084    //Return NULL for invalid time input.
    8185    {
     86        psMemId id = psMemGetId();
    8287        psFree(testTime);
    8388        testTime = psTimeAlloc(PS_TIME_UTC);
     
    8792            "psEOC_PrecessionModel:          return NULL for invalid time input.");
    8893        testTime->nsec = 0;
    89     }
     94        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     95    }
     96
     97
    9098    //Return NULL for failed eoc init - missing file
    9199    //printf("\n filename = '%s' \n", p_psGetConfigFileName());
     
    93101    //to define where the real pslib config is.
    94102    {
     103        psMemId id = psMemGetId();
    95104        testTime->sec = 1049160600;
    96105        testTime->nsec = 0;
     
    103112        rename("../../etc/pslib/pslib_config.bak", "../../etc/pslib/pslib.config");
    104113        skip_end();
    105     }
     114        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     115    }
     116
    106117
    107118    //Return valid EarthPole for valid time input
    108119    {
     120        psMemId id = psMemGetId();
    109121        double x, y, s;
    110122        x = 2.857175590089105e-4;
     
    121133                      "psEOC_PrecessionModel:          return valid EarthPole for valid inputs (s).");
    122134        skip_end();
     135        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    123136    }
    124137
     
    147160void testPolarMotion(void)
    148161{
    149 //    diag("  >>>Test 2:  psEOC_GetPolarMotion ");
     162    // psEOC_GetPolarMotion()
    150163
    151164    psTime *in = psTimeAlloc(PS_TIME_UTC);
     
    155168    psEarthPole *polarMotion = NULL;
    156169
     170
    157171    //Tests for psEOC_GetPolarMotion
    158172    //Return NULL for NULL time input.
    159173    {
     174        psMemId id = psMemGetId();
    160175        polarMotion = psEOC_GetPolarMotion(NULL, PS_IERS_B);
    161         ok( polarMotion == NULL,
    162             "psEOC_GetPolarMotion:           return NULL for NULL time input.");
    163     }
     176        ok( polarMotion == NULL, "psEOC_GetPolarMotion: return NULL for NULL time input.");
     177        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     178    }
     179
     180
    164181    //Return NULL for invalid IERS table input
    165182    {
     183        psMemId id = psMemGetId();
    166184        polarMotion = psEOC_GetPolarMotion(NULL, PS_IERS_B+1);
    167         ok( polarMotion == NULL,
    168             "psEOC_GetPolarMotion:          return NULL for invalid IERS table input.");
    169     }
     185        ok( polarMotion == NULL, "psEOC_GetPolarMotion: return NULL for invalid IERS table input.");
     186        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     187    }
     188
     189
    170190    //Return NULL for invalid time input.
    171191    {
     192        psMemId id = psMemGetId();
    172193        in->nsec = 2e9;
    173194        polarMotion = psEOC_GetPolarMotion(in, PS_IERS_B);
    174         ok( polarMotion == NULL,
    175             "psEOC_GetPolarMotion:          return NULL for invalid time input.");
     195        ok( polarMotion == NULL, "psEOC_GetPolarMotion: return NULL for invalid time input.");
    176196        in->nsec = 0;
    177     }
     197        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     198    }
     199
     200
    178201    //Return NULL for failed eoc init - missing file
    179202    //XXX: Use the PS_CONFIG_FILE_DEFAULT macro, or PS_CONFIG_FILE environment variable
    180203    //to define where the real pslib config is.
    181204    {
     205        psMemId id = psMemGetId();
    182206        p_psEOCFinalize();
    183207        skip_start(rename("../../etc/pslib/pslib.config", "../../etc/pslib/pslib_config.bak"),
    184208                   1, "Skipping 1 tests because file rename failed!");
    185209        polarMotion = psEOC_GetPolarMotion(in, PS_IERS_B);
    186         ok( polarMotion == NULL,
    187             "psEOC_GetPolarMotion:          return NULL for failed eoc init.");
     210        ok( polarMotion == NULL, "psEOC_GetPolarMotion: return NULL for failed eoc init.");
    188211        rename("../../etc/pslib/pslib_config.bak", "../../etc/pslib/pslib.config");
    189212        skip_end();
    190     }
     213        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     214    }
     215
     216
    191217    //Return valid EarthPole for valid time input - IERS B
    192218    {
     219        psMemId id = psMemGetId();
    193220        double x, y, s;
    194221        x = -6.454389659777e-07;
     
    199226                     "Skipping 3 tests because psEarthPole is NULL!");
    200227        is_double_tol(polarMotion->x, x, 0.1,
    201                       "psEOC_GetPolarMotion:          return valid EarthPole for valid inputs "
     228                      "psEOC_GetPolarMotion: return valid EarthPole for valid inputs "
    202229                      "(x) - IERS B.");
    203230        is_double_tol(polarMotion->y, y, 0.1,
    204                       "psEOC_GetPolarMotion:          return valid EarthPole for valid inputs "
     231                      "psEOC_GetPolarMotion: return valid EarthPole for valid inputs "
    205232                      "(y) - IERS B.");
    206233        is_double_tol(polarMotion->s, s, 0.1,
    207                       "psEOC_GetPolarMotion:          return valid EarthPole for valid inputs "
     234                      "psEOC_GetPolarMotion: return valid EarthPole for valid inputs "
    208235                      "(s) - IERS B.");
    209236        skip_end();
    210237        psFree(polarMotion);
    211     }
     238        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     239    }
     240
     241
    212242    //Return valid EarthPole for valid time input - IERS A
    213243    {
     244        psMemId id = psMemGetId();
    214245        double x, y, s;
    215246        x = -6.45381397904e-07;
     
    220251                     "Skipping 3 tests because psEarthPole is NULL!");
    221252        is_double_tol(polarMotion->x, x, 0.1,
    222                       "psEOC_GetPolarMotion:          return valid EarthPole for valid inputs "
     253                      "psEOC_GetPolarMotion: return valid EarthPole for valid inputs "
    223254                      "(x) - IERS A.");
    224255        is_double_tol(polarMotion->y, y, 0.1,
    225                       "psEOC_GetPolarMotion:          return valid EarthPole for valid inputs "
     256                      "psEOC_GetPolarMotion: return valid EarthPole for valid inputs "
    226257                      "(y) - IERS A.");
    227258        is_double_tol(polarMotion->s, s, 0.1,
    228                       "psEOC_GetPolarMotion:          return valid EarthPole for valid inputs "
     259                      "psEOC_GetPolarMotion: return valid EarthPole for valid inputs "
    229260                      "(s) - IERS A.");
    230261        skip_end();
    231262        psFree(polarMotion);
    232     }
     263        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     264    }
     265
     266
    233267    //Return valid EarthPole for valid time input - IERS A
    234268    {
     269        psMemId id = psMemGetId();
    235270        psTime *firstTime = psTimeFromMJD(41684.50);
    236271        polarMotion = psEOC_GetPolarMotion(firstTime, PS_IERS_B);
    237272        ok( polarMotion != NULL,
    238             "psEOC_GetPolarMotion:          return valid EarthPole for valid inputs.");
     273            "psEOC_GetPolarMotion: return valid EarthPole for valid inputs.");
    239274        psFree(firstTime);
     275        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    240276    }
    241277
     
    264300void testSphereRots(void)
    265301{
    266 //    diag("  >>>Test 3:  psSphereRot Functions");
     302    // psSphereRot Functions
    267303    psSphereRot *out = NULL;
    268304    psEarthPole *in = NULL;
     
    276312    //Return NULL for NULL earthPole input
    277313    {
     314        psMemId id = psMemGetId();
    278315        out = psSphereRot_CEOtoGCRS(in);
    279         ok( out == NULL,
    280             "psSphereRot_CEOtoGCRS:         return NULL for NULL earthPole input.");
     316        ok( out == NULL, "psSphereRot_CEOtoGCRS: return NULL for NULL earthPole input.");
    281317        in = psEarthPoleAlloc();
    282     }
     318        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     319    }
     320
     321
    283322    in->x = 2.857175590089105e-4;
    284323    in->y = 2.3968739377734732e-5;
     
    286325    //Return correct psSphereRot for valid input
    287326    {
     327        psMemId id = psMemGetId();
    288328        out = psSphereRot_CEOtoGCRS(in);
    289329        skip_start(  out == NULL, 4,
    290330                     "Skipping 4 tests because psSphereRot output is NULL!");
    291331        is_double_tol( out->q0, q0, 0.0001,
    292                        "psSphereRot_CEOtoGCRS:         return correct psSphereRot for valid input (q0).");
     332                       "psSphereRot_CEOtoGCRS: return correct psSphereRot for valid input (q0).");
    293333        is_double_tol( out->q1, q1, 0.0001,
    294                        "psSphereRot_CEOtoGCRS:         return correct psSphereRot for valid input (q1).");
     334                       "psSphereRot_CEOtoGCRS: return correct psSphereRot for valid input (q1).");
    295335        is_double_tol( out->q2, q2, 0.0001,
    296                        "psSphereRot_CEOtoGCRS:         return correct psSphereRot for valid input (q2).");
     336                       "psSphereRot_CEOtoGCRS: return correct psSphereRot for valid input (q2).");
    297337        is_double_tol( out->q3, -q3, 0.0001,
    298                        "psSphereRot_CEOtoGCRS:         return correct psSphereRot for valid input (q3).");
    299         skip_end();
    300     }
     338                       "psSphereRot_CEOtoGCRS: return correct psSphereRot for valid input (q3).");
     339        skip_end();
     340        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     341    }
     342
    301343
    302344    //Tests for psSphereRot_TEOtoCEO
     
    311353    //Return NULL for NULL time input
    312354    {
     355        psMemId id = psMemGetId();
    313356        out = psSphereRot_TEOtoCEO(NULL, NULL);
    314         ok( out == NULL,
    315             "psSphereRot_TEOtoCEO:          return NULL for NULL time input.");
    316     }
     357        ok( out == NULL, "psSphereRot_TEOtoCEO: return NULL for NULL time input.");
     358        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     359    }
     360
     361
    317362    //Return NULL for invalid time input - large nsec, UTC time type
    318363    {
     364        psMemId id = psMemGetId();
    319365        time2->nsec = 3e9;
    320366        out = psSphereRot_TEOtoCEO(time2, NULL);
    321         ok( out == NULL,
    322             "psSphereRot_TEOtoCEO:          return NULL for invalid time input.");
    323     }
     367        ok( out == NULL, "psSphereRot_TEOtoCEO: return NULL for invalid time input.");
     368        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     369    }
     370
     371
    324372    //Return NULL for invalid time input - UT1 time type, large nsec
    325373    {
     374        psMemId id = psMemGetId();
    326375        psFree(time2);
    327376        time2 = psTimeAlloc(PS_TIME_UT1);
     
    329378        temp->s = 1.0;
    330379        out = psSphereRot_TEOtoCEO(time2, temp);
    331         ok( out == NULL,
    332             "psSphereRot_TEOtoCEO:          return NULL for invalid time input.");
    333     }
     380        ok( out == NULL, "psSphereRot_TEOtoCEO: return NULL for invalid time input.");
     381        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     382    }
     383
     384
    334385    //Return NULL for invalid earthPole input
    335386    {
     387        psMemId id = psMemGetId();
    336388        time2->nsec = 0;
    337389        psEarthPole *temp = psEarthPoleAlloc();
    338390        temp->s = -2.0;
    339391        out = psSphereRot_TEOtoCEO(time2, temp);
    340         ok( out == NULL,
    341             "psSphereRot_TEOtoCEO:          return NULL for invalid earthPole input.");
    342     }
     392        ok( out == NULL, "psSphereRot_TEOtoCEO: return NULL for invalid earthPole input.");
     393        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     394    }
     395
     396
    343397    //Return correct psSphereRot for valid inputs
    344398    double x, y, z;
     
    347401    z = 0.7496183628158023;
    348402    {
     403        psMemId id = psMemGetId();
    349404        psEarthPole *polarTideCorr = psEOC_PolarTideCorr(time);
    350405        out = psSphereRot_TEOtoCEO(time, polarTideCorr);
     
    356411        psCube *cube = psSphereToCube(result);
    357412        is_double_tol( cube->x, x, 0.0001,
    358                        "psSphereRot_TEOtoCEO:          return NULL for NULL time input. (x)");
     413                       "psSphereRot_TEOtoCEO: return NULL for NULL time input. (x)");
    359414        is_double_tol( cube->y, y, 0.0001,
    360                        "psSphereRot_TEOtoCEO:          return NULL for NULL time input. (y)");
    361         is_double_tol( cube->z, z, 0.0001,
    362                        "psSphereRot_TEOtoCEO:          return NULL for NULL time input. (z)");
     415                       "psSphereRot_TEOtoCEO: return NULL for NULL time input. (y)");
     416        is_double_tol( cube->z, z, 0.0001, "psSphereRot_TEOtoCEO: return NULL for NULL time input. (z)");
    363417        psFree(earthRot);
    364418        psFree(result);
     
    367421        skip_end();
    368422        psFree(polarTideCorr);
    369     }
     423        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     424    }
     425
    370426
    371427    //Tests for psSphereRot_ITRStoTEO
    372428    //Return NULL for NULL earthPole input
    373429    {
     430        psMemId id = psMemGetId();
    374431        psFree(out);
    375432        out = psSphereRot_ITRStoTEO(NULL);
     
    377434            "psSphereRot_ITRStoTEO:         return NULL for NULL earthPole input.");
    378435        in = psEarthPoleAlloc();
    379     }
     436        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     437    }
     438
     439
    380440    //Return correct psSphereRot for valid input
    381441    {
     442        psMemId id = psMemGetId();
    382443        q0 = -1.0567571848664005e-6;
    383444        q1 = 3.218036562931509e-7;
     
    391452                     "Skipping 4 tests because psSphereRot output is NULL!");
    392453        is_double_tol( out->q0, q0, 0.0001,
    393                        "psSphereRot_ITRStoTEO:         return correct psSphereRot for valid input (q0).");
     454                       "psSphereRot_ITRStoTEO: return correct psSphereRot for valid input (q0).");
    394455        is_double_tol( out->q1, q1, 0.0001,
    395                        "psSphereRot_ITRStoTEO:         return correct psSphereRot for valid input (q1).");
     456                       "psSphereRot_ITRStoTEO: return correct psSphereRot for valid input (q1).");
    396457        is_double_tol( out->q2, q2, 0.0001,
    397                        "psSphereRot_ITRStoTEO:         return correct psSphereRot for valid input (q2).");
     458                       "psSphereRot_ITRStoTEO: return correct psSphereRot for valid input (q2).");
    398459        is_double_tol( out->q3, q3, 0.0001,
    399                        "psSphereRot_ITRStoTEO:         return correct psSphereRot for valid input (q3).");
    400         skip_end();
     460                       "psSphereRot_ITRStoTEO: return correct psSphereRot for valid input (q3).");
     461        skip_end();
     462        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    401463    }
    402464
     
    428490void testSpherePrecess(void)
    429491{
    430 //    diag("  >>>Test 4:  psSpherePrecess");
     492    // psSpherePrecess
    431493    psSphereRot *rot = NULL;
    432494    psTime *fromTime = NULL;
     
    435497    psSphere* outputCoord = NULL;
    436498
     499
    437500    //Return NULL for NULL time inputs
    438501    {
     502        psMemId id = psMemGetId();
    439503        rot = psSpherePrecess(fromTime, toTime, PS_PRECESS_ROUGH);
    440         ok( rot == NULL,
    441             "psSpherePrecess:               return NULL for NULL time inputs.");
    442     }
     504        ok( rot == NULL, "psSpherePrecess: return NULL for NULL time inputs.");
     505        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     506    }
     507
     508
    443509    //Return NULL for invalid mode input
    444510    {
     511        psMemId id = psMemGetId();
    445512        fromTime    = psTimeFromMJD(MJD_2100);
    446513        toTime      = psTimeFromMJD(MJD_1900);
    447514        rot = psSpherePrecess(fromTime, toTime, -1);
    448         ok( rot == NULL,
    449             "psSpherePrecess:               return NULL for invalid mode input.");
    450     }
     515        ok( rot == NULL, "psSpherePrecess: return NULL for invalid mode input.");
     516        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     517    }
     518
     519
    451520    //Return correct psSphereRot for valid inputs, mode = ROUGH
    452521    {
     522        psMemId id = psMemGetId();
    453523        inputCoord->r = SPHERE_PRECESS_TP1_R;
    454524        inputCoord->d = SPHERE_PRECESS_TP1_D;
     
    463533                    "Skipping 2 tests because psSphereRot output is NULL!");
    464534        is_double_tol( outputCoord->r, SPHERE_PRECESS_TP1_EXPECT_R, ERROR_TOL,
    465                        "psSpherePrecess:               return correct psSphereRot for valid"
     535                       "psSpherePrecess: return correct psSphereRot for valid"
    466536                       " inputs and PS_PRECESS_ROUGH mode. (r)");
    467537        is_double_tol( outputCoord->d, SPHERE_PRECESS_TP1_EXPECT_D, ERROR_TOL,
    468                        "psSpherePrecess:               return correct psSphereRot for valid"
     538                       "psSpherePrecess: return correct psSphereRot for valid"
    469539                       " inputs and PS_PRECESS_ROUGH mode. (d)");
    470540        skip_end();
    471541        psFree(outputCoord);
    472542        psFree(rot);
    473     }
     543        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     544    }
     545
     546
    474547    //Return correct psSphereRot for valid inputs, mode = ROUGH
    475548    {
     549        psMemId id = psMemGetId();
    476550        inputCoord->r = SPHERE_PRECESS_TP2_R;
    477551        inputCoord->d = SPHERE_PRECESS_TP2_D;
     
    486560                    "Skipping 2 tests because psSphereRot output is NULL!");
    487561        is_double_tol( outputCoord->r, SPHERE_PRECESS_TP2_EXPECT_R, ERROR_TOL,
    488                        "psSpherePrecess:               return correct psSphereRot for valid"
     562                       "psSpherePrecess: return correct psSphereRot for valid"
    489563                       " inputs and PS_PRECESS_ROUGH mode. (r)");
    490564        is_double_tol( outputCoord->d, SPHERE_PRECESS_TP2_EXPECT_D, ERROR_TOL,
    491                        "psSpherePrecess:               return correct psSphereRot for valid"
     565                       "psSpherePrecess: return correct psSphereRot for valid"
    492566                       " inputs and PS_PRECESS_ROUGH mode. (d)");
    493567        skip_end();
    494568        psFree(outputCoord);
    495569        psFree(rot);
    496     }
     570        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     571    }
     572
     573
    497574    //Return correct psSphereRot for valid inputs, mode = ROUGH
    498575    {
     576        psMemId id = psMemGetId();
    499577        inputCoord->r = SPHERE_PRECESS_TP3_R;
    500578        inputCoord->d = SPHERE_PRECESS_TP3_D;
     
    509587                    "Skipping 2 tests because psSphereRot output is NULL!");
    510588        is_double_tol( outputCoord->r, SPHERE_PRECESS_TP3_EXPECT_R, ERROR_TOL,
    511                        "psSpherePrecess:               return correct psSphereRot for valid"
     589                       "psSpherePrecess: return correct psSphereRot for valid"
    512590                       " inputs and PS_PRECESS_ROUGH mode. (r)");
    513591        is_double_tol( outputCoord->d, SPHERE_PRECESS_TP3_EXPECT_D, ERROR_TOL,
    514                        "psSpherePrecess:               return correct psSphereRot for valid"
     592                       "psSpherePrecess: return correct psSphereRot for valid"
    515593                       " inputs and PS_PRECESS_ROUGH mode. (d)");
    516594        skip_end();
    517595        psFree(outputCoord);
    518596        psFree(rot);
    519     }
     597        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     598    }
     599
     600
    520601    //Return correct psSphereRot for valid inputs, mode = COMPLETE_A
    521602    {
     603        psMemId id = psMemGetId();
    522604        rot = psSpherePrecess(NULL, toTime, PS_PRECESS_COMPLETE_A);
    523605        outputCoord = psSphereRotApply(NULL, rot, inputCoord);
    524606        ok( outputCoord != NULL && rot != NULL,
    525             "psSpherePrecess:               return correct psSphereRot for valid"
     607            "psSpherePrecess: return correct psSphereRot for valid"
    526608            " inputs and PS_PRECESS_COMPLETE_A mode.");
    527609        psFree(outputCoord);
    528610        psFree(rot);
    529     }
     611        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     612    }
     613
     614
    530615    //Return correct psSphereRot for valid inputs, mode = COMPLETE_B
    531616    {
     617        psMemId id = psMemGetId();
    532618        rot = psSpherePrecess(NULL, toTime, PS_PRECESS_COMPLETE_B);
    533619        outputCoord = psSphereRotApply(NULL, rot, inputCoord);
    534620        ok( outputCoord != NULL && rot != NULL,
    535             "psSpherePrecess:               return correct psSphereRot for valid"
     621            "psSpherePrecess: return correct psSphereRot for valid"
    536622            " inputs and PS_PRECESS_COMPLETE_B mode.");
    537623        psFree(outputCoord);
    538624        psFree(rot);
    539     }
     625        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     626    }
     627
     628
    540629    //Return correct psSphereRot for valid inputs, mode = IAU2000A
    541630    {
     631        psMemId id = psMemGetId();
    542632        rot = psSpherePrecess(NULL, toTime, PS_PRECESS_IAU2000A);
    543633        outputCoord = psSphereRotApply(NULL, rot, inputCoord);
    544634        ok( outputCoord != NULL && rot != NULL,
    545             "psSpherePrecess:               return correct psSphereRot for valid"
     635            "psSpherePrecess: return correct psSphereRot for valid"
    546636            " inputs and PS_PRECESS_IAU2000A mode.");
     637        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    547638    }
    548639
  • trunk/psLib/test/astro/tap_psSphereOps_all.c

    r12607 r13623  
    1313 *
    1414 */
    15 
    1615#include <pslib.h>
    1716#include <string.h>
    18 
    1917#include "tap.h"
    2018#include "pstap.h"
    2119
    2220#define DEG_INC   30.0
    23 
    2421#define MJD_1900  15021.0        // Modified Julian Day 1/1/1900 00:00:00
    2522#define MJD_2000  51544.0        // Modified Julian Day 1/1/2000 00:00:00
    2623#define MJD_2100  88069.0        // Modified Julian Day 1/1/2100 00:00:00
    27 
    2824#define ERROR_TOL   0.0001
    29 
    3025#define ALPHA_P 4*M_PI/3
    3126#define DELTA_P M_PI/4
     
    3934{
    4035    psLogSetFormat("HLNM");
    41     plan_tests(57);
    42 //    diag("Tests for psSphereOps Functions");
    43 
     36    plan_tests(86);
    4437    testSphereRotCreate();
    4538    testSphereRotConvert();
    4639    testSphereOffsets();
    47 
    48     done();
    4940}
    5041
    5142void testSphereRotCreate(void)
    5243{
    53 //    diag("  >>>Test 1:  psSphereRot Creation Functions");
    54 
    55     // Allocate data structure
    56     psSphereRot* myST = NULL;
    57     myST = psSphereRotAlloc(ALPHA_P, DELTA_P, PHI_P);
     44    // ----------------------------------------------------------------
     45    //Tests for psSphereRotAlloc
     46    //Return NULL for NAN input alpha
     47    {
     48        psMemId id = psMemGetId();
     49        psSphereRot *s1 = psSphereRotAlloc(NAN, DELTA_P, PHI_P);
     50        ok( s1 == NULL, "psSphereRotAlloc(): return NULL for NAN input alpha");
     51        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     52    }
     53
     54
     55    //Return NULL for NAN input delta
     56    {
     57        psMemId id = psMemGetId();
     58        psSphereRot *s1 = psSphereRotAlloc(ALPHA_P, NAN, PHI_P);
     59        ok( s1 == NULL, "psSphereRotAlloc(): return NULL for NAN input delta");
     60        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     61    }
     62
     63
     64    //Return NULL for NAN input phi
     65    {
     66        psMemId id = psMemGetId();
     67        psSphereRot *s1 = psSphereRotAlloc(ALPHA_P, DELTA_P, NAN);
     68        ok( s1 == NULL, "psSphereRotAlloc(): return NULL for NAN input phi");
     69        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     70    }
     71
     72
    5873    double a0 = (ALPHA_P - PHI_P)/2.0;
    5974    double a1 = (ALPHA_P - PHI_P)/2.0;
     
    6580    double q2 = sin(a2)*cos(DELTA_P/2);
    6681    double q3 = cos(a3)*cos(DELTA_P/2);
    67 
    68     //Tests for psSphereRotAlloc
    69     //Return NULL for NAN input
    70     {
    71         psSphereRot *s1 = psSphereRotAlloc(ALPHA_P, NAN, PHI_P);
    72         ok( s1 == NULL,
    73             "psSphereRotAlloc:               return NULL for NAN input.");
    74     }
    75     //Return valid psSphereRot (allocated) for valid inputs
    76     {
    77         ok( myST != NULL && psMemCheckSphereRot(myST),
    78             "psSphereRotAlloc:               return allocated SphereRot for valid inputs.");
    79         is_double(q0, myST->q0,
    80                   "psSphereRotAlloc:               return correct q0 value.");
    81         is_double(q1, myST->q1,
    82                   "psSphereRotAlloc:               return correct q1 value.");
    83         is_double(q2, myST->q2,
    84                   "psSphereRotAlloc:               return correct q2 value.");
    85         is_double(q3, myST->q3,
    86                   "psSphereRotAlloc:               return correct q3 value.");
    87     }
     82    // Test psSphereRot() for valid inputs
     83    {
     84        psMemId id = psMemGetId();
     85        psSphereRot* myST = NULL;
     86        myST = psSphereRotAlloc(ALPHA_P, DELTA_P, PHI_P);
     87        ok(myST != NULL && psMemCheckSphereRot(myST),
     88            "psSphereRotAlloc:  return allocated SphereRot for valid inputs.");
     89        is_double(q0, myST->q0, "psSphereRotAlloc: return correct q0 value.");
     90        is_double(q1, myST->q1, "psSphereRotAlloc: return correct q1 value.");
     91        is_double(q2, myST->q2, "psSphereRotAlloc: return correct q2 value.");
     92        is_double(q3, myST->q3, "psSphereRotAlloc: return correct q3 value.");
     93        psFree(myST);
     94        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     95    }
     96
     97
     98    // ----------------------------------------------------------------
    8899    //Tests for psMemCheckSphereRot
    89100    //Make sure psMemCheckSphereRot works correctly - return false
    90     {
     101    //for non-psSphereRot input
     102    {
     103        psMemId id = psMemGetId();
    91104        int j = 2;
    92         ok( !psMemCheckSphereRot(&j),
    93             "psMemCheckSphereRot:            return false for non-SphereRot input.");
    94     }
     105        ok( !psMemCheckSphereRot(&j), "psMemCheckSphereRot: return false for non-SphereRot input.");
     106        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     107    }
     108
     109
     110    // ----------------------------------------------------------------
    95111    //Tests for psSphereRotQuat
    96     //Return NULL for NAN input
    97     {
     112    //Return NULL for NAN input q0
     113    {
     114        psMemId id = psMemGetId();
     115        psSphereRot *s1 = psSphereRotQuat(NAN, q1, q2, q3);
     116        ok( s1 == NULL, "psSphereRotQuat: return NULL for NAN input q0");
     117        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     118    }
     119
     120
     121    //Return NULL for NAN input q1
     122    {
     123        psMemId id = psMemGetId();
     124        psSphereRot *s1 = psSphereRotQuat(q0, NAN, q2, q3);
     125        ok( s1 == NULL, "psSphereRotQuat: return NULL for NAN input q1");
     126        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     127    }
     128
     129
     130    //Return NULL for NAN input q2
     131    {
     132        psMemId id = psMemGetId();
     133        psSphereRot *s1 = psSphereRotQuat(q0, q1, NAN, q3);
     134        ok( s1 == NULL, "psSphereRotQuat: return NULL for NAN input q2");
     135        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     136    }
     137
     138
     139    //Return NULL for NAN input q3
     140    {
     141        psMemId id = psMemGetId();
    98142        psSphereRot *s1 = psSphereRotQuat(q0, q1, q2, NAN);
    99         ok( s1 == NULL,
    100             "psSphereRotQuat:                return NULL for NAN input.");
    101     }
     143        ok( s1 == NULL, "psSphereRotQuat: return NULL for NAN input q3");
     144        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     145    }
     146
     147
    102148    //Return valid psSphereRot (allocated) for valid inputs
    103     psFree(myST);
    104     myST = NULL;
    105     myST = psSphereRotQuat(q0*2.0, q1*2.0, q2*2.0, q3*2.0);
    106     {
     149    psSphereRot* myST = psSphereRotQuat(q0*2.0, q1*2.0, q2*2.0, q3*2.0);
     150    {
     151        psMemId id = psMemGetId();
    107152        ok( myST != NULL && psMemCheckSphereRot(myST),
    108             "psSphereRotQuat:                return allocated SphereRot for valid inputs.");
    109         is_double(q0, myST->q0,
    110                   "psSphereRotQuat:               return correct q0 value.");
    111         is_double(q1, myST->q1,
    112                   "psSphereRotQuat:               return correct q1 value.");
    113         is_double(q2, myST->q2,
    114                   "psSphereRotQuat:               return correct q2 value.");
    115         is_double(q3, myST->q3,
    116                   "psSphereRotQuat:               return correct q3 value.");
    117     }
    118 
    119 
    120     //Check for Memory leaks
    121     {
    122         psFree(myST);
    123         checkMem();
    124     }
    125 
     153            "psSphereRotQuat: return allocated SphereRot for valid inputs.");
     154        is_double(q0, myST->q0, "psSphereRotQuat: return correct q0 value.");
     155        is_double(q1, myST->q1, "psSphereRotQuat: return correct q1 value.");
     156        is_double(q2, myST->q2, "psSphereRotQuat: return correct q2 value.");
     157        is_double(q3, myST->q3, "psSphereRotQuat: return correct q3 value.");
     158        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     159    }
    126160}
     161
    127162
    128163void testSphereRotConvert(void)
    129164{
    130 //    diag("  >>>Test 2:  psSphereRot Conversion Functions");
    131 
    132165    // Allocate data structure
    133166    psSphereRot* myST = NULL;
     
    147180    icrs->d = DEG_TO_RAD(90.0);
    148181
     182
     183    // ---------------------------------------------------------
    149184    //Tests for psSphereRotCombine
    150185    //Return NULL for NULL sphere input
    151186    {
     187        psMemId id = psMemGetId();
    152188        s1 = psSphereRotCombine(s1, myST, NULL);
    153         ok( s1 == NULL,
    154             "psSphereRotCombine:            return NULL for NULL input.");
    155     }
     189        ok( s1 == NULL, "psSphereRotCombine: return NULL for NULL input.");
     190        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     191    }
     192
     193
    156194    //Return NULL for NULL transform input
    157195    {
     196        psMemId id = psMemGetId();
    158197        s1 = psSphereRotCombine(s1, NULL, myST);
    159         ok( s1 == NULL,
    160             "psSphereRotCombine:            return NULL for NULL input.");
    161     }
     198        ok( s1 == NULL, "psSphereRotCombine: return NULL for NULL input.");
     199        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     200    }
     201    // XXX: Must test with legitimate input data.
     202
     203
     204    // ---------------------------------------------------------
    162205    //Tests for psSphereRotApply
    163206    //Return NULL for NULL sphere input
    164207    {
     208        psMemId id = psMemGetId();
    165209        out = psSphereRotApply(out, myST, NULL);
    166         ok( out == NULL,
    167             "psSphereRotApply:              return NULL for NULL sphere input.");
    168     }
     210        ok( out == NULL, "psSphereRotApply: return NULL for NULL sphere input.");
     211        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     212    }
     213
     214
    169215    //Return NULL for NULL transform input
    170216    {
     217        psMemId id = psMemGetId();
    171218        out = psSphereRotApply(out, NULL, sphere);
    172         ok( out == NULL,
    173             "psSphereRotApply:              return NULL for NULL transform input.");
    174     }
    175 
     219        ok( out == NULL, "psSphereRotApply: return NULL for NULL transform input.");
     220        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     221    }
     222
     223
     224    // ---------------------------------------------------------
    176225    //Tests for psSphereRotConjugate
    177226    //Return NULL for NULL inputs
    178227    {
     228        psMemId id = psMemGetId();
    179229        s1 = psSphereRotConjugate(s1, NULL);
    180         ok( s1 == NULL,
    181             "psSphereRotConjugate:          return NULL SphereRot for NULL inputs.");
     230        ok(s1 == NULL, "psSphereRotConjugate: return NULL SphereRot for NULL inputs");
     231        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    182232    }
    183233    //Return correct conjugate for valid inputs
    184234    {
     235        psMemId id = psMemGetId();
    185236        s1 = psSphereRotConjugate(s1, myST);
    186         skip_start(  s1 == NULL, 1,
    187                      "Skipping 1 tests because psSphereRot is NULL!");
     237        skip_start(s1 == NULL, 1, "Skipping 1 tests because psSphereRot is NULL!");
    188238        out = psSphereRotApply(out, myST, sphere);
    189         skip_start(  out == NULL || out->r == 0, 2,
    190                      "Skipping 1 tests because psSphereRotApply failed!");
     239        skip_start(out == NULL || out->r == 0, 2,
     240                  "Skipping 1 tests because psSphereRotApply failed!");
    191241        out2 = psSphereRotApply(out2, s1, out);
    192         is_double( out2->r, 0.0,
    193                    "psSphereRotConjugate:          return correct SphereRot values.");
    194         is_double( out2->d, 0.0,
    195                    "psSphereRotConjugate:          return correct SphereRot values.");
     242        is_double( out2->r, 0.0, "psSphereRotConjugate: return correct SphereRot values.");
     243        is_double( out2->d, 0.0, "psSphereRotConjugate: return correct SphereRot values.");
    196244        skip_end();
    197245        psFree(s1);
     
    202250        out2 = NULL;
    203251        skip_end();
    204     }
     252        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     253    }
     254
     255
     256    // ---------------------------------------------------------
    205257    //Tests for psSphereRotInvert
    206258    //Return correct inversion for valid inputs
    207259    {
     260        psMemId id = psMemGetId();
    208261        s1 = psSphereRotInvert(-PHI_P, -DELTA_P, -ALPHA_P);
    209         is_double(s1->q0, myST->q0,
    210                   "psSphereRotInvert:             return correct q0 value.");
    211         is_double(s1->q1, myST->q1,
    212                   "psSphereRotInvert:             return correct q1 value.");
    213         is_double(s1->q2, myST->q2,
    214                   "psSphereRotInvert:             return correct q2 value.");
    215         is_double(s1->q3, myST->q3,
    216                   "psSphereRotInvert:             return correct q3 value.");
     262        is_double(s1->q0, myST->q0, "psSphereRotInvert: return correct q0 value.");
     263        is_double(s1->q1, myST->q1, "psSphereRotInvert: return correct q1 value.");
     264        is_double(s1->q2, myST->q2, "psSphereRotInvert: return correct q2 value.");
     265        is_double(s1->q3, myST->q3, "psSphereRotInvert: return correct q3 value.");
    217266        psFree(s1);
    218267        s1 = NULL;
    219     }
    220 
     268        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     269    }
     270
     271
     272    // ---------------------------------------------------------
    221273    //Tests for psSphereRotICRSToEcliptic
    222274    //Return NULL for NULL input
    223275    {
     276        psMemId id = psMemGetId();
    224277        s1 = psSphereRotICRSToEcliptic(NULL);
    225         ok( s1 == NULL,
    226             "psSphereRotICRSToEcliptic:     return NULL SphereRot for NULL inputs.");
    227     }
     278        ok( s1 == NULL, "psSphereRotICRSToEcliptic: return NULL SphereRot for NULL inputs.");
     279        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     280    }
     281
     282
    228283    //Return NULL for Pre-MJD_1900 Date
    229284    {
     285        psMemId id = psMemGetId();
    230286        s1 = psSphereRotICRSToEcliptic(pre1900);
    231         ok( s1 == NULL,
    232             "psSphereRotICRSToEcliptic:     return NULL SphereRot for pre-1900 MJD date.");
    233     }
     287        ok( s1 == NULL, "psSphereRotICRSToEcliptic: return NULL SphereRot for pre-1900 MJD date.");
     288        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     289    }
     290
     291
    234292    //Return correct SphereRot for MJD_2000
    235293    {
     294        psMemId id = psMemGetId();
    236295        s1 = psSphereRotICRSToEcliptic(mjd2k);
    237         skip_start(  s1 == NULL, 2,
    238                      "Skipping 2 tests because psSphereRot is NULL!");
     296        skip_start(  s1 == NULL, 2, "Skipping 2 tests because psSphereRot is NULL!");
    239297        icrs->r = DEG_TO_RAD(0.0);
    240298        icrs->d = DEG_TO_RAD(90.0);
    241299        psSphere* ecliptic = psSphereRotApply(NULL, s1, icrs);
    242300        is_double_tol(DEG_TO_RAD(90.0), ecliptic->r, 0.00001,
    243                       "psSphereRotICRSToEcliptic:     return correct SphereRot for MJD_2000 date.");
     301                      "psSphereRotICRSToEcliptic: return correct SphereRot for MJD_2000 date.");
    244302        is_double_tol(DEG_TO_RAD(66.560719), ecliptic->d, 0.00001,
    245                       "psSphereRotICRSToEcliptic:     return correct SphereRot for MJD_2000 date.");
     303                      "psSphereRotICRSToEcliptic: return correct SphereRot for MJD_2000 date.");
    246304        psFree(ecliptic);
    247305        skip_end();
    248306        psFree(s1);
    249307        s1 = NULL;
    250     }
     308        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     309    }
     310
     311
     312    // --------------------------------------------------------------
    251313    //Tests for psSphereRotEclipticToICRS
    252314    //Return NULL for NULL input
    253315    {
     316        psMemId id = psMemGetId();
    254317        s1 = psSphereRotEclipticToICRS(NULL);
    255         ok( s1 == NULL,
    256             "psSphereRotEclipticToICRS:     return NULL SphereRot for NULL inputs.");
    257     }
     318        ok( s1 == NULL, "psSphereRotEclipticToICRS: return NULL SphereRot for NULL inputs.");
     319        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     320    }
     321
     322
    258323    //Return NULL for Pre-MJD_1900 Date
    259324    {
     325        psMemId id = psMemGetId();
    260326        s1 = psSphereRotEclipticToICRS(pre1900);
    261         ok( s1 == NULL,
    262             "psSphereRotEclipticToICRS:     return NULL SphereRot for pre-1900 MJD date.");
    263     }
     327        ok( s1 == NULL, "psSphereRotEclipticToICRS: return NULL SphereRot for pre-1900 MJD date.");
     328        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     329    }
     330
     331
    264332    //Return correct SphereRot for MJD_2000
    265333    {
     334        psMemId id = psMemGetId();
    266335        s1 = psSphereRotEclipticToICRS(mjd2k);
    267         skip_start(  s1 == NULL, 2,
    268                      "Skipping 2 tests because psSphereRot is NULL!");
     336        skip_start(  s1 == NULL, 2, "Skipping 2 tests because psSphereRot is NULL!");
    269337        psSphere* ecliptic = psSphereRotApply(NULL, s1, icrs);
    270338        s2 = psSphereRotICRSToEcliptic(mjd2k);
     
    272340        //XXX:  Pretty sure the following can be 180 degrees OR 0 degrees. (= the poles)
    273341        is_double_tol(DEG_TO_RAD(180.0), fromEcliptic->r, 0.00001,
    274                       "psSphereRotEclipticToICRS:     return correct SphereRot for MJD_2000 date.");
     342                      "psSphereRotEclipticToICRS: return correct SphereRot for MJD_2000 date.");
    275343        is_double_tol(DEG_TO_RAD(90.0), fromEcliptic->d, 0.00001,
    276                       "psSphereRotEclipticToICRS:     return correct SphereRot for MJD_2000 date.");
     344                      "psSphereRotEclipticToICRS: return correct SphereRot for MJD_2000 date.");
    277345        psFree(ecliptic);
    278346        psFree(fromEcliptic);
     
    282350        psFree(s2);
    283351        s2 = NULL;
    284     }
    285 
     352        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     353    }
     354
     355
     356    // --------------------------------------------------------------
    286357    //Tests for psSphereRotICRSToGalactic
    287358    //Return correct transformation
    288359    {
     360        psMemId id = psMemGetId();
    289361        s2 = psSphereRotICRSToGalactic();
    290362        galactic = psSphereRotApply(NULL, s2, icrs);
    291363        is_double_tol(DEG_TO_RAD(122.93192), galactic->r, 0.00001,
    292                       "psSphereRotICRSToGalactic:     return correct SphereRot.");
     364                      "psSphereRotICRSToGalactic: return correct SphereRot.");
    293365        is_double_tol(DEG_TO_RAD(27.12825), galactic->d, 0.00001,
    294                       "psSphereRotICRSToGalactic:     return correct SphereRot.");
    295     }
     366                      "psSphereRotICRSToGalactic: return correct SphereRot.");
     367        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     368    }
     369
     370
     371    // --------------------------------------------------------------
    296372    //Tests for psSphereRotGalacticToICRS
    297373    //Return correct transformation
    298374    {
     375        psMemId id = psMemGetId();
    299376        s1 = psSphereRotGalacticToICRS();
    300377        psSphere *test = psSphereRotApply(NULL, s1, galactic);
    301         //XXX:  Pretty sure the following can be 180 degrees OR 0 degrees. (= the poles)
     378        //XXX: Pretty sure the following can be 180 degrees OR 0 degrees. (= the poles)
    302379        is_double_tol(DEG_TO_RAD(180.0), test->r, 0.00001,
    303                       "psSphereRotGalacticToICRS:     return correct SphereRot.");
     380                      "psSphereRotGalacticToICRS: return correct SphereRot.");
    304381        is_double_tol(DEG_TO_RAD(90.0), test->d, 0.00001,
    305                       "psSphereRotGalacticToICRS:     return correct SphereRot.");
     382                      "psSphereRotGalacticToICRS: return correct SphereRot.");
    306383        psFree(test);
    307     }
    308 
    309     //Check for Memory leaks
     384        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     385    }
     386
    310387    {
    311388        psFree(galactic);
     
    317394        psFree(sphere);
    318395        psFree(myST);
    319         checkMem();
    320396    }
    321397
    322398}
     399
    323400
    324401void testSphereOffsets(void)
    325402{
    326 //    diag("  >>>Test 3:  psSphereGet/SetOffset Functions");
    327 
    328     // Allocate data structure
    329403    psSphereRot* myST = NULL;
    330404    myST = psSphereRotAlloc(ALPHA_P, DELTA_P, PHI_P);
     
    335409    psSphere *output = NULL;
    336410
     411    // -----------------------------------------------------------
    337412    //Tests for psSphereGetOffset
    338413    //Test Get for NULL position1
    339414    {
    340415        output = psSphereGetOffset(empty, origin, PS_LINEAR, PS_RADIAN);
    341         ok( output == NULL,
    342             "psSphereGetOffset:             return NULL for NULL position1 input.");
    343     }
     416        ok( output == NULL, "psSphereGetOffset: return NULL for NULL position1 input.");
     417    }
     418
     419
    344420    //Test Get for NULL position2
    345421    {
    346422        output = psSphereGetOffset(origin, empty, PS_LINEAR, PS_RADIAN);
    347         ok( output == NULL,
    348             "psSphereGetOffset:             return NULL for NULL position2 input.");
    349     }
     423        ok( output == NULL, "psSphereGetOffset: return NULL for NULL position2 input.");
     424    }
     425
     426
    350427    //Return NULL for position1 declination > 90 degrees
    351428    {
    352429        origin->d = 100.0;
    353430        output = psSphereGetOffset(origin, offset, PS_LINEAR, PS_RADIAN);
    354         ok( output == NULL,
    355             "psSphereGetOffset:             return NULL for position1->d > 90 degrees.");
    356     }
     431        ok( output == NULL, "psSphereGetOffset: return NULL for position1->d > 90 degrees.");
     432    }
     433
     434
    357435    //Return NULL for position1 declination > 90 degrees
    358436    {
     
    360438        offset->d = 100.0;
    361439        output = psSphereGetOffset(origin, offset, PS_LINEAR, PS_RADIAN);
    362         ok( output == NULL,
    363             "psSphereGetOffset:             return NULL for position2->d > 90 degrees.");
    364     }
     440        ok( output == NULL, "psSphereGetOffset: return NULL for position2->d > 90 degrees.");
     441    }
     442
     443
    365444    //Return NULL for invalid mode specification
    366445    {
    367446        offset->d = 0.0;
    368447        output = psSphereGetOffset(origin, offset, -1, PS_RADIAN);
    369         ok( output == NULL,
    370             "psSphereGetOffset:             return NULL for invalid mode input.");
    371     }
     448        ok( output == NULL, "psSphereGetOffset: return NULL for invalid mode input.");
     449    }
     450
     451
    372452    //Return NULL for invalid unit specification
    373453    {
    374454        output = psSphereGetOffset(origin, offset, PS_SPHERICAL, -1);
    375         ok( output == NULL,
    376             "psSphereGetOffset:             return NULL for invalid unit input.");
     455        ok( output == NULL, "psSphereGetOffset: return NULL for invalid unit input.");
    377456    }
    378457    //Return matching sphere offsets regardless of units
     
    383462        empty = psSphereGetOffset(origin, offset, PS_SPHERICAL, PS_DEGREE);
    384463        is_double_tol(DEG_TO_RAD(empty->r), MIN_TO_RAD(output->r), 0.0001,
    385                       "psSphereGetOffset:             return correct offset for differing units.");
     464                      "psSphereGetOffset: return correct offset for differing units.");
    386465        is_double_tol(DEG_TO_RAD(empty->d), MIN_TO_RAD(output->d), 0.0001,
    387                       "psSphereGetOffset:             return correct offset for differing units.");
     466                      "psSphereGetOffset: return correct offset for differing units.");
    388467        psFree(output);
    389468        psFree(empty);
     
    396475    {
    397476        output = psSphereSetOffset(empty, offset, PS_SPHERICAL, PS_DEGREE);
    398         ok( output == NULL,
    399             "psSphereSetOffset:             return NULL for NULL position input.");
     477        ok( output == NULL, "psSphereSetOffset: return NULL for NULL position input.");
    400478    }
    401479    //Return NULL for NULL offset
    402480    {
    403481        output = psSphereSetOffset(offset, empty, PS_SPHERICAL, PS_DEGREE);
    404         ok( output == NULL,
    405             "psSphereSetOffset:             return NULL for NULL offset input.");
     482        ok( output == NULL, "psSphereSetOffset: return NULL for NULL offset input.");
    406483    }
    407484    //Return NULL for invalid mode specification
    408485    {
    409486        output = psSphereSetOffset(origin, offset, -1, PS_RADIAN);
    410         ok( output == NULL,
    411             "psSphereSetOffset:             return NULL for for invalid mode input.");
     487        ok( output == NULL, "psSphereSetOffset: return NULL for for invalid mode input.");
    412488    }
    413489    //Return NULL for invalid unit specification
    414490    {
    415491        output = psSphereSetOffset(origin, offset, PS_SPHERICAL, PS_RADIAN+1);
    416         ok( output == NULL,
    417             "psSphereSetOffset:             return NULL for for invalid unit input.");
     492        ok( output == NULL, "psSphereSetOffset: return NULL for for invalid unit input.");
    418493    }
    419494    //Test Set using Spherical mode, Degree units
     
    424499    {
    425500        output = psSphereSetOffset(origin, offset, PS_SPHERICAL, PS_DEGREE);
    426         skip_start(  output == NULL, 2,
    427                      "Skipping 2 tests because Sphere output is NULL!");
    428         is_double(output->r, M_PI/4.0,
    429                   "psSphereSetOffset:             return correct spherical offset.");
    430         is_double(output->d, M_PI/6.0,
    431                   "psSphereSetOffset:             return correct spherical offset.");
     501        skip_start(output == NULL, 2, "Skipping 2 tests because Sphere output is NULL!");
     502        is_double(output->r, M_PI/4.0, "psSphereSetOffset: return correct spherical offset.");
     503        is_double(output->d, M_PI/6.0, "psSphereSetOffset: return correct spherical offset.");
    432504        skip_end();
    433505        psFree(output);
     
    441513        output = psSphereSetOffset(origin, offset, PS_LINEAR, PS_RADIAN);
    442514        empty = psSphereGetOffset(origin, output, PS_LINEAR, PS_RADIAN);
    443         skip_start(  empty == NULL, 2,
    444                      "Skipping 2 tests because Sphere output is NULL!");
     515        skip_start(empty == NULL, 2, "Skipping 2 tests because Sphere output is NULL!");
    445516        is_double_tol(empty->r, offset->r, 0.00001,
    446                       "psSphereGetOffset:             return correct spherical offset.");
     517                      "psSphereGetOffset: return correct spherical offset.");
    447518        is_double_tol(empty->d, offset->d, 0.00001,
    448                       "psSphereGetOffset:             return correct spherical offset.");
     519                      "psSphereGetOffset: return correct spherical offset.");
    449520        skip_end();
    450521        psFree(output);
     
    462533        empty->r = SEC_TO_RAD(empty->r);
    463534        empty->d = SEC_TO_RAD(empty->d);
    464         skip_start(  empty == NULL, 2,
    465                      "Skipping 2 tests because Sphere output is NULL!");
     535        skip_start(empty == NULL, 2, "Skipping 2 tests because Sphere output is NULL!");
    466536        is_double_tol(empty->r, (M_PI / 4.0), 0.0001,
    467                       "psSphereGetOffset:             return correct spherical offset.");
     537                      "psSphereGetOffset: return correct spherical offset.");
    468538        is_double_tol(empty->d, (M_PI / 6.0), 0.0001,
    469                       "psSphereGetOffset:             return correct spherical offset.");
     539                      "psSphereGetOffset: return correct spherical offset.");
    470540        skip_end();
    471541        psFree(output);
     
    481551        empty = psSphereSetOffset(origin, offset, PS_SPHERICAL, PS_RADIAN);
    482552        is_double_tol(empty->r, offset->r, 0.0001,
    483                       "psSphereSetOffset:             return correct offset for differing units.");
     553                      "psSphereSetOffset: return correct offset for differing units.");
    484554        is_double_tol(empty->d, offset->d, 0.0001,
    485                       "psSphereSetOffset:             return correct offset for differing units.");
     555                      "psSphereSetOffset: return correct offset for differing units.");
    486556        psFree(output);
    487557        psFree(empty);
     
    496566    }
    497567}
    498 
  • trunk/psLib/test/astro/tap_psTime_01.c

    r13614 r13623  
    2323 *  @author  Eric Van Alst, MHPCC
    2424 *
    25  *  @version $Revision: 1.6 $  $Name: not supported by cvs2svn $
    26  *  @date  $Date: 2007-06-04 20:25:32 $
     25 *  @version $Revision: 1.7 $  $Name: not supported by cvs2svn $
     26 *  @date  $Date: 2007-06-05 01:10:22 $
    2727 *
    2828 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    709709
    710710    // psTimeFromISO()
     711    // Convert valid ISO string
     712    {
     713        psMemId id = psMemGetId();
     714        psTime *time = psTimeFromISO(testTime1Str, PS_TIME_TAI);
     715        ok(time->type == PS_TIME_TAI, "psTimeFromISO() returned the correct type");
     716        is_long(time->sec, testTime1SecondsUTC, "psTimeFromISO()->sec");
     717        psFree(time);
     718        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     719    }
     720
     721
     722    // psTimeFromISO()
    711723    // Attempt to convert NULL string
    712724    // Following should generate error message for NULL ISO string");
     
    714726        psMemId id = psMemGetId();
    715727        psTime *time = psTimeFromISO(NULL, PS_TIME_TAI);
    716 
    717728        ok(time == NULL, "psTimeFromISO(NULL, PS_TIME_TAI) returned NULL");
    718 
    719         ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    720     }
    721 
    722 
    723     // psTimeFromISO()
    724     // Convert valid ISO string
    725     {
    726         psMemId id = psMemGetId();
    727         psTime *time = psTimeFromISO(testTime1Str, PS_TIME_TAI);
    728 
    729         ok(time->type == PS_TIME_TAI, "psTimeFromISO() returned the correct type");
    730         is_long(time->sec, testTime1SecondsUTC, "psTimeFromISO()->sec");
    731 
    732         psFree(time);
    733729        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    734730    }
     
    742738        psMemId id = psMemGetId();
    743739        psTime *time = psTimeFromISO("Here I am", PS_TIME_TAI);
    744 
    745740        ok(time == NULL, "psTimeFromISO() returned NULL for incorrect ISO string");
    746 
    747741        psFree(time);
    748742        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     
    757751        psMemId id = psMemGetId();
    758752        psTime *time = psTimeFromTimeval(NULL);
    759 
    760753        ok(time == NULL, "psTimeFromTimeval(NULL) returned NULL");
    761 
    762754        psFree(time);
    763755        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     
    773765        timevalTime->tv_usec = testTime1NanosecondsTAI / 1000;
    774766        psTime *time = psTimeFromTimeval(timevalTime);
    775 
    776         ok(time != NULL, "psTimeFromTimeval() returned NULL for correct timeval structure");
     767        ok(time != NULL, "psTimeFromTimeval() returned non-NULL for correct timeval structure");
    777768        skip_start(time == NULL, 3, "Skipping tests because psTimeFromTimeval() returned NULL");
    778769        ok(time->type == PS_TIME_TAI, "psTimeFromTimeval() returned the correct type");
     
    780771        is_long(time->nsec, testTime1NanosecondsTAI, "psTimeFromTimeval() returned the correct ->nsec");
    781772        skip_end();
    782 
    783773        psFree(timevalTime);
    784774        psFree(time);
     
    794784        psMemId id = psMemGetId();
    795785        psTime *time = psTimeFromTM(NULL);
    796 
    797786        ok(time == NULL, "psTimeFromTM(NULL) returned NULL");
    798 
    799787        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    800788    }
     
    802790
    803791    // psTimeFromTM()
    804     {
    805         psMemId id = psMemGetId();
    806         // Verify convert for valid tm structure
     792    // Verify convert for valid tm structure
     793    {
     794        psMemId id = psMemGetId();
    807795        struct tm *tmTime = (struct tm*)psAlloc(sizeof(struct tm));
    808796        tmTime->tm_year = testTime7TmYear;
     
    813801        tmTime->tm_sec  = testTime7TmSec;
    814802        psTime *time = psTimeFromTM(tmTime);
    815 
    816803        ok(time != NULL, "psTimeFromTM(NULL) returned non-NULL");
    817804        skip_start(time == NULL, 2, "Skipping tests because psTimeFromTM() returned NULL");
     
    819806        is_long(time->nsec, testTime7Nanoseconds, "psTimeFromTM() returned the correct ->nsec");
    820807        skip_end();
    821 
    822808        psFree(tmTime);
    823809        psFree(time);
     
    838824        tmTime->tm_sec  = testTime8TmSec;
    839825        psTime *time = psTimeFromTM(tmTime);
    840 
    841826        // XXX should test all fields here
    842827        ok(time != NULL, "psTimeFromTM(NULL) returned non-NULL");
     
    845830        is_long(time->nsec, testTime8Nanoseconds, "psTimeFromTM() returned the correct ->nsec");
    846831        skip_end();
    847 
    848832        psFree(tmTime);
    849833        psFree(time);
  • trunk/psLib/test/astro/tap_psTime_02.c

    r13614 r13623  
    1212 *  @author  Eric Van Alst, MHPCC
    1313 *
    14  *  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
    15  *  @date  $Date: 2007-06-04 20:25:32 $
     14 *  @version $Revision: 1.6 $  $Name: not supported by cvs2svn $
     15 *  @date  $Date: 2007-06-05 01:10:22 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    332332    {
    333333        psMemId id = psMemGetId();
    334 
    335334        psTime *time = psTimeFromTT(0,2e9);
    336335        ok(time == NULL, "psTimeFromTT() returned NULL with incorrect time");
    337 
    338336        psFree(time);
    339337        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     
    345343    {
    346344        psMemId id = psMemGetId();
    347 
    348345        psTime *time = psTimeFromTT(testTime1SecondsUTC,testTime1NanosecondsUTC);
    349346        ok(time != NULL, "psTimeFromTT() returned non-NULL with valid time");
    350347        skip_start(time == NULL, 2, "Skipping tests because psTimeFromTT() returned NULL");
    351 
    352348        ok(time->type == PS_TIME_TT, "psTimeFromTT() returned correct type");
    353349        is_long(time->sec, testTime1SecondsUTC, "psTimeFromTT() returned correct ->sec");
    354350        is_long(time->nsec, testTime1NanosecondsUTC, "psTimeFromTT() returned correct ->nsec");
    355         is_bool(time->leapsecond, false, "psTimeFromUTC() returned the correct leapsecond flag");
     351        is_bool(time->leapsecond, false, "psTimeFromTT() returned the correct leapsecond flag");
    356352        skip_end();
    357 
    358353        psFree(time);
    359354        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     
    367362    {
    368363        psMemId id = psMemGetId();
    369 
    370364        psTime *time = psTimeFromUTC(0, 2e9, true);
    371365        ok(time == NULL, "psTimeFromUTC() returned NULL with incorrect time input");
    372 
    373366        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    374367    }
     
    376369
    377370    // psTimeFromUTC()
    378     // Attempt to create psTime with valid non-leapsecond time and leapsecond flag true
     371    // Attempt to create psTime with valid leapsecond time but leapsecond
     372    // flag false
     373    {
     374        psMemId id = psMemGetId();
     375
     376        psTime *time = psTimeFromUTC(testTime3SecondsUTC, testTime3NanosecondsUTC, false);
     377        ok(time != NULL, "psTimeFromUTC() returned non-NULL with correct input");
     378        skip_start(time == NULL, 5, "Skipping tests because psTimeFromUTC() returned NULL");
     379        ok(time->type == PS_TIME_UTC, "psTimeFromUTC() returned the correct type");
     380        is_long(time->sec, testTime3SecondsUTC, "psTimeFromUTC() returned the correct ->sec");
     381        is_long(time->nsec, testTime3NanosecondsUTC, "psTimeFromUTC() returned the correct ->nsec");
     382        is_bool(time->leapsecond, true, "psTimeFromUTC() returned the correct leapsecond flag");
     383        psFree(time);
     384        skip_end();
     385
     386        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     387    }
     388
     389
     390    // psTimeFromUTC()
     391    // Attempt to create psTime with valid non-leapsecond time and
     392    // leapsecond flag true
    379393    {
    380394        psMemId id = psMemGetId();
     
    391405        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    392406    }
    393 
    394 
    395     // psTimeFromUTC()
    396     // Attempt to create psTime with valid leapsecond time but leapsecond flag false
    397     {
    398         psMemId id = psMemGetId();
    399 
    400         psTime *time = psTimeFromUTC(testTime3SecondsUTC, testTime3NanosecondsUTC, false);
    401         ok(time != NULL, "psTimeFromUTC() returned non-NULL with correct input");
    402         skip_start(time == NULL, 5, "Skipping tests because psTimeFromUTC() returned NULL");
    403         ok(time->type == PS_TIME_UTC, "psTimeFromUTC() returned the correct type");
    404         is_long(time->sec, testTime3SecondsUTC, "psTimeFromUTC() returned the correct ->sec");
    405         is_long(time->nsec, testTime3NanosecondsUTC, "psTimeFromUTC() returned the correct ->nsec");
    406         is_bool(time->leapsecond, true, "psTimeFromUTC() returned the correct leapsecond flag");
    407         psFree(time);
    408         skip_end();
    409 
    410         ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    411     }
    412407}
  • trunk/psLib/test/astro/tap_psTime_03.c

    r12607 r13623  
    1111 *  @author  Eric Van Alst, MHPCC
    1212 *
    13  *  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
    14  *  @date  $Date: 2007-03-27 22:52:02 $
     13 *  @version $Revision: 1.6 $  $Name: not supported by cvs2svn $
     14 *  @date  $Date: 2007-06-05 01:10:22 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    179179    psLibInit("pslib.config");
    180180
     181
    181182    // psTimeMath()
    182183    // Attempt to perform math operation on NULL time
     
    185186    {
    186187        psMemId id = psMemGetId();
    187 
    188188        ok(psTimeMath(NULL, -1.1) == NULL, "psTimeMath(NULL, -1.1) returned NULL");
    189 
    190189        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    191190    }
     
    201200        time->sec = 0;
    202201        time->nsec = 2e9;
    203 
    204202        ok(psTimeMath(time, -1.1) == NULL, "psTimeMath() returns NULL for unallowable time input");
    205 
    206203        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    207204    }
     
    215212        time->sec = testTime1SecondsUTC;
    216213        time->nsec = testTime1NanosecondsUTC;
    217 
    218214        psTime *newTime = psTimeMath(time, deltaTime1);
    219215        ok(newTime != NULL, "psTimeMath() returns non-NULL for allowable time input (PS_TIME_UTC)");
     
    223219        is_long(newTime->nsec, newTestTime1NanosecondsUTC, "psTimeMath() returns the correct ->nsec");
    224220        skip_end();
    225 
    226221        psFree(newTime);
    227222        psFree(time);
Note: See TracChangeset for help on using the changeset viewer.