IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 12414 for trunk/psLib


Ignore:
Timestamp:
Mar 12, 2007, 2:19:21 PM (19 years ago)
Author:
jhoblitt
Message:

use ok_[foo] macros
ws

File:
1 edited

Legend:

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

    r12407 r12414  
    1111 *  @author  Eric Van Alst, MHPCC
    1212 *
    13  *  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
    14  *  @date  $Date: 2007-03-12 21:11:21 $
     13 *  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
     14 *  @date  $Date: 2007-03-13 00:19:21 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    172172//const char testTimeB2StrUT1[] = "1998-12-31T23:59:58,2Z";
    173173
    174 psS32 main(psS32 argc, char* argv[])
     174int main(int argc, char* argv[])
    175175{
    176176    psLogSetFormat("HLNM");
    177177    psLogSetLevel(PS_LOG_INFO);
    178     plan_tests(72);
     178    plan_tests(77);
    179179    psLibInit("pslib.config");
    180180
     
    185185    {
    186186        psMemId id = psMemGetId();
     187
    187188        ok(psTimeMath(NULL, -1.1) == NULL, "psTimeMath(NULL, -1.1) returned NULL");
     189
    188190        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    189191    }
     
    199201        time->sec = 0;
    200202        time->nsec = 2e9;
     203
    201204        ok(psTimeMath(time, -1.1) == NULL, "psTimeMath() returns NULL for unallowable time input");
     205
    202206        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    203207    }
     
    211215        time->sec = testTime1SecondsUTC;
    212216        time->nsec = testTime1NanosecondsUTC;
     217
    213218        psTime *newTime = psTimeMath(time, deltaTime1);
    214219        ok(newTime != NULL, "psTimeMath() returns non-NULL for allowable time input (PS_TIME_UTC)");
    215220        skip_start(newTime == NULL, 2, "Skipping tests because psTimeMath() returned NULL");
    216221        ok(newTime->type == PS_TIME_UTC, "psTimeMath() returns the correct type (PS_TIME_UTC)");
    217         ok((newTime->sec == newTestTime1SecondsUTC) && (newTime->nsec == newTestTime1NanosecondsUTC),
    218            "psTimeMath() returns the correct ->sec and ->nsec (PS_TIME_UTC)");
     222        is_long(newTime->sec, newTestTime1SecondsUTC, "psTimeMath() returns the correct ->sec");
     223        is_long(newTime->nsec, newTestTime1NanosecondsUTC, "psTimeMath() returns the correct ->nsec");
    219224        skip_end();
     225
    220226        psFree(newTime);
    221227        psFree(time);
     
    228234    {
    229235        psMemId id = psMemGetId();
    230         psTime *time = psTimeAlloc(PS_TIME_UTC);
     236        psTime *time = psTimeAlloc(PS_TIME_TAI);
    231237        time->sec = testTime1SecondsTAI;
    232238        time->nsec = testTime1NanosecondsTAI;
    233         time->type = PS_TIME_TAI;
     239
    234240        psTime *newTime = psTimeMath(time, deltaTime1);
    235241        ok(newTime != NULL, "psTimeMath() returns non-NULL for allowable time input (PS_TIME_TAI)");
    236242        skip_start(newTime == NULL, 2, "Skipping tests because psTimeMath() returned NULL");
    237243        ok(newTime->type == PS_TIME_TAI, "psTimeMath() returns the correct type (PS_TIME_TAI)");
    238         ok((newTime->sec == newTestTime1SecondsTAI) && (newTime->nsec == newTestTime1NanosecondsTAI),
    239            "psTimeMath() returns the correct ->sec and ->nsec (PS_TIME_TAI)");
     244        is_long(newTime->sec, newTestTime1SecondsTAI, "psTimeMath() returns the correct ->sec");
     245        is_long(newTime->nsec, newTestTime1NanosecondsTAI, "psTimeMath() returns the correct ->nsec");
    240246        skip_end();
     247
    241248        psFree(newTime);
    242249        psFree(time);
     
    249256    {
    250257        psMemId id = psMemGetId();
    251         psTime *time = psTimeAlloc(PS_TIME_UTC);
     258        psTime *time = psTimeAlloc(PS_TIME_TT);
    252259        time->sec = testTime1SecondsTT;
    253260        time->nsec = testTime1NanosecondsTT;
    254         time->type = PS_TIME_TT;
     261
    255262        psTime *newTime = psTimeMath(time,deltaTime2);
    256263        ok(newTime != NULL, "psTimeMath() returns non-NULL for allowable time input (PS_TIME_TT)");
    257264        skip_start(newTime == NULL, 2, "Skipping tests because psTimeMath() returned NULL");
    258265        ok(newTime->type == PS_TIME_TT, "psTimeMath() returns the correct type (PS_TIME_TT)");
    259         ok((newTime->sec == newTestTime1SecondsTT) && (newTime->nsec == newTestTime1NanosecondsTT),
    260            "psTimeMath() returns the correct ->sec and ->nsec (PS_TIME_TT)");
     266        is_long(newTime->sec, newTestTime1SecondsTT, "psTimeMath() returns the correct ->sec (PS_TIME_TT)");
     267        is_long(newTime->nsec, newTestTime1NanosecondsTT, "psTimeMath() returns the correct ->nsec (PS_TIME_TT)");
    261268        skip_end();
     269
    262270        psFree(newTime);
    263271        psFree(time);
     
    270278    {
    271279        psMemId id = psMemGetId();
    272         psTime *time = psTimeAlloc(PS_TIME_UTC);
     280        psTime *time = psTimeAlloc(PS_TIME_UT1);
    273281        time->sec = testTime1SecondsUT1;
    274282        time->nsec = testTime1NanosecondsUT1;
    275         time->type = PS_TIME_UT1;
     283
    276284        psTime *newTime = psTimeMath(time,deltaTime2);
    277285        ok(newTime != NULL, "psTimeMath() returns non-NULL for allowable time input (PS_TIME_UT1)");
    278286        skip_start(newTime == NULL, 2, "Skipping tests because psTimeMath() returned NULL");
    279287        ok(newTime->type == PS_TIME_UT1, "psTimeMath() returns the correct type (PS_TIME_UT1)");
    280         ok((newTime->sec == newTestTime1SecondsUT1) && (newTime->nsec == newTestTime1NanosecondsUT1),
    281            "psTimeMath() returns the correct ->sec and ->nsec (PS_TIME_UT1)");
     288        is_long(newTime->sec, newTestTime1SecondsUT1, "psTimeMath() returns the correct ->sec (PS_TIME_UT1)");
     289        is_long(newTime->nsec, newTestTime1NanosecondsUT1, "psTimeMath() returns the correct ->nsec (PS_TIME_UT1)");
    282290        skip_end();
     291
    283292        psFree(newTime);
    284293        psFree(time);
     
    294303        time->sec = testTime2SecondsUTC;
    295304        time->nsec = testTime2NanosecondsUTC;
    296         time->type = PS_TIME_UTC;
    297         psTime *newTime = psTimeMath(time,deltaTime3);
     305
     306        psTime *newTime = psTimeMath(time, deltaTime3);
    298307        ok(newTime != NULL, "psTimeMath() returns non-NULL for allowable time input (PS_TIME_UTC)");
    299308        skip_start(newTime == NULL, 2, "Skipping tests because psTimeMath() returned NULL");
    300309        ok(newTime->type == PS_TIME_UTC, "psTimeMath() returns the correct type (PS_TIME_UTC)");
    301         ok((newTime->sec == newTestTime2SecondsUTC) && (newTime->nsec == newTestTime2NanosecondsUTC),
    302            "psTimeMath() returns the correct ->sec and ->nsec (PS_TIME_UTC)");
     310        is_long(newTime->sec, newTestTime2SecondsUTC, "psTimeMath() returns the correct ->sec (PS_TIME_UTC)");
     311        is_long(newTime->nsec, newTestTime2NanosecondsUTC, "psTimeMath() returns the correct ->nsec (PS_TIME_UTC)");
    303312        skip_end();
     313
    304314        psFree(newTime);
    305315        psFree(time);
     
    314324    {
    315325        psMemId id = psMemGetId();
     326
    316327        psF64 delta = psTimeDelta(NULL, NULL);
    317         ok(fabs(delta-0.0) < ERROR_TOL, "psTimeDelta(NULL, NULL) returned 0.0");
     328        ok_double_tol(delta, 0.0, ERROR_TOL, "psTimeDelta(NULL, NULL) returned 0.0");
     329
    318330        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    319331    }
     
    327339        psMemId id = psMemGetId();
    328340        psTime *time1 = psTimeAlloc(PS_TIME_UTC);
     341
    329342        psF64 delta = psTimeDelta(time1, NULL);
    330         ok(fabs(delta-0.0) < ERROR_TOL, "psTimeDelta(time1, NULL) returned 0.0");
     343        ok_double_tol(delta, 0.0, ERROR_TOL, "psTimeDelta(time1, NULL) returned 0.0");
     344
    331345        psFree(time1);
    332346        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     
    344358        time1->sec = 0;
    345359        time1->nsec = 2e9;
     360
    346361        psF64 delta = psTimeDelta(time1, time2);
    347         ok(fabs(delta-0.0) < ERROR_TOL, "psTimeDelta(time1, NULL) returned 0.0 for unallowed time1 arg");
     362        ok_double_tol(delta, 0.0, ERROR_TOL, "psTimeDelta(time1, NULL) returned 0.0 for unallowed time1 arg");
     363
    348364        psFree(time1);
    349365        psFree(time2);
     
    364380        time2->sec = 0;
    365381        time2->nsec = 2e9;
     382
    366383        psF64 delta = psTimeDelta(time1, time2);
    367         ok(fabs(delta-0.0) < ERROR_TOL, "psTimeDelta(time1, NULL) returned 0.0 for unallowed time2 arg");
     384        ok_double_tol(delta, 0.0,  ERROR_TOL, "psTimeDelta(time1, NULL) returned 0.0 for unallowed time2 arg");
     385
    368386        psFree(time1);
    369387        psFree(time2);
     
    386404        time2->sec = newTestTime1SecondsUTC;
    387405        time2->nsec = newTestTime1NanosecondsUTC;
     406
    388407        psF64 delta = psTimeDelta(time1, time2);
    389         ok(fabs(delta-0.0) < ERROR_TOL, "psTimeDelta(time1, NULL) returned 0.0 for different time types");
     408        ok_double_tol(delta, 0.0, ERROR_TOL, "psTimeDelta(time1, NULL) returned 0.0 for different time types");
     409
    390410        psFree(time1);
    391411        psFree(time2);
     
    406426        time2->sec = newTestTime1SecondsUTC;
    407427        time2->nsec = newTestTime1NanosecondsUTC;
     428
    408429        psF64 delta = psTimeDelta(time2, time1);
    409         ok(fabs(delta-deltaTime1) < ERROR_TOL, "psTimeDelta(time1, NULL) returned correct delta for times of the same type");
     430        ok_double_tol(delta, deltaTime1, ERROR_TOL, "psTimeDelta(time1, NULL) returned correct delta for times of the same type");
     431
    410432        psFree(time1);
    411433        psFree(time2);
     
    427449        time2->nsec = newTestTime1NanosecondsTT;
    428450        time2->type = PS_TIME_TT;
     451
    429452        psF64 delta = psTimeDelta(time2,time1);
    430         ok(fabs(delta-deltaTime2) < ERROR_TOL, "psTimeDelta(time1, NULL) returned correct delta for times of the same type");
     453        ok_double_tol(delta, deltaTime2, ERROR_TOL, "psTimeDelta(time1, NULL) returned correct delta for times of the same type");
     454
    431455        psFree(time1);
    432456        psFree(time2);
     
    448472        time2->nsec = newTestTime2NanosecondsUTC;
    449473        time2->type = PS_TIME_UTC;
     474       
    450475        psF64 delta = psTimeDelta(time2,time1);
    451         ok(fabs(delta-deltaTime3) < ERROR_TOL, "psTimeDelta(time1, NULL) returned correct delta for times of the same type");
     476        ok_double_tol(delta, deltaTime3, ERROR_TOL, "psTimeDelta(time1, NULL) returned correct delta for times of the same type");
     477
    452478        psFree(time1);
    453479        psFree(time2);
Note: See TracChangeset for help on using the changeset viewer.