IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 4, 2007, 10:25:32 AM (19 years ago)
Author:
gusciora
Message:

Improved test coverage.

File:
1 edited

Legend:

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

    r12607 r13614  
    1212 *  @author  Eric Van Alst, MHPCC
    1313 *
    14  *  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
    15  *  @date  $Date: 2007-03-27 22:52:02 $
     14 *  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
     15 *  @date  $Date: 2007-06-04 20:25:32 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    6464    {
    6565        psMemId id = psMemGetId();
    66 
    6766        psF64 lmst = psTimeToLMST(NULL, 0);
    68         is_double(lmst, NAN, "psTimeToLMST(time,0) returned NAN");
    69 
     67        is_double(lmst, NAN, "psTimeToLMST(NULL, 0) returned NAN");
    7068        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    7169    }
     
    8078        time->nsec = testTime1NanosecondsUTC;
    8179        time->leapsecond = false;
    82 
    8380        psF64 lmst = psTimeToLMST(time, 0.0);
    8481        is_double_tol(lmst, testTime1LMST0, ERROR_TOL, "psTimeToLMST() returned the correct time");
    85 
    8682        psFree(time);
    8783        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     
    9086
    9187    // psTimeToLMST()
    92     // Attempt to get LMST with invalid input time UT1
     88    // Attempt to get LMST with unallowed input time UT1
    9389    // Following should generate error message for incorrect type
    9490    // XXX: We do not test the error generation
     
    10096        time->leapsecond = false;
    10197        time->type = PS_TIME_UT1;
    102 
    10398        psF64 lmst = psTimeToLMST(time,0.0);
    10499        is_double(lmst, NAN, "psTimeToLMST() generated a NAN for incorrect type");
    105 
    106100        psFree(time);
    107101        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     
    115109    {
    116110        psMemId id = psMemGetId();
    117 
    118111        psS64 delta = psTimeLeapSecondDelta(NULL, NULL);
    119112        is_long(delta, 0, "psTimeLeapSecondDelta(NULL, NULL) returned 0");
    120 
    121         ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    122     }
    123 
    124 
     113        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     114    }
     115
     116
     117    // psTimeLeapSecondDelta()
    125118    // Set test time 1
    126119    // Attempt to get delta with NULL time2 argument
     
    133126        time1->nsec = testTime1NanosecondsUTC;
    134127        time1->leapsecond = false;
    135 
    136128        psS64 delta = psTimeLeapSecondDelta(time1, NULL);
    137129        is_long(delta, 0, "psTimeLeapSecondDelta(time1, NULL) returned 0");
    138 
    139         psFree(time1);
    140         ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    141     }
    142 
    143 
    144     // Set test time 2 with invalid time
    145     // Attempt to get delta with invalid time2
    146     // Following should generate an error message for invalid time
     130        psFree(time1);
     131        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     132    }
     133
     134
     135    // psTimeLeapSecondDelta()
     136    // Set test time 2 with unallowed time
     137    // Attempt to get delta with unallowed time2
     138    // Following should generate an error message for unallowed time
    147139    // XXX: We do not test the error generation
    148140    {
     
    156148        time2->nsec = 2e9;
    157149        time2->leapsecond = false;
    158 
    159150        psS64 delta = psTimeLeapSecondDelta(time1, time2);
    160151        is_long(delta, 0, "psTimeLeapSecondDelta(time1, time2) returned 0 with incorrect time2");
    161 
    162152        psFree(time1);
    163153        psFree(time2);
     
    166156
    167157
     158    // psTimeLeapSecondDelta()
    168159    // Set test time 2 valid
    169     // Attempt to get delta with invalid time1
    170     // Following should generate an error message for invalid time
     160    // Attempt to get delta with unallowed time1
     161    // Following should generate an error message for unallowed time
    171162    // XXX: We do not test the error generation
    172163    {
     
    181172        time1->sec = 0;
    182173        time1->nsec = 2e9;
    183 
    184174        psS64 delta = psTimeLeapSecondDelta(time1,time2);
    185175        is_long(delta, 0, "psTimeLeapSecondDelta(time1, time2) returned 0 with incorrect time1");
    186 
    187176        psFree(time1);
    188177        psFree(time2);
     
    191180
    192181
     182    // psTimeLeapSecondDelta()
    193183    // Set test time 1 to greater time
    194184    {
     
    202192        time2->sec = testTime2SecondsUTC;
    203193        time2->nsec = testTime2NanosecondsUTC;
    204 
    205194        psS64 delta = psTimeLeapSecondDelta(time1,time2);
    206195        is_long(delta, testTimeLeapSecondDelta1, "psTimeLeapSecondDelta() produced the correct result");
    207 
    208196        psFree(time1);
    209197        psFree(time2);
     
    212200
    213201
     202    // psTimeLeapSecondDelta()
    214203    // Set test time 1 to lesser time
    215204    {
     
    222211        time2->sec = testTime2SecondsUTC;
    223212        time2->nsec = testTime2NanosecondsUTC;
    224 
    225213        psS64 delta = psTimeLeapSecondDelta(time2, time1);
    226214        is_long(delta, testTimeLeapSecondDelta1, "psTimeLeapSecondDelta() produced the correct result");
    227 
    228215        psFree(time1);
    229216        psFree(time2);
     
    232219
    233220
     221    // psTimeLeapSecondDelta()
    234222    // Attempt to get delta with times equal
    235223    {
     
    239227        time1->nsec = testTime1NanosecondsUTC;
    240228        time1->leapsecond = false;
    241 
    242229        psS64 delta = psTimeLeapSecondDelta(time1,time1);
    243230        is_long(delta, 0, "psTimeLeapSecondDelta() produced the correct result");
    244 
    245231        psFree(time1);
    246232        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     
    254240    {
    255241        psMemId id = psMemGetId();
    256 
    257242        bool leapsecond = psTimeIsLeapSecond(NULL);
    258243        is_bool(leapsecond, false, "psTimeIsLeapSecond(NULL) returned correct value");
    259 
    260         ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    261     }
    262 
    263 
    264     // psTimeIsLeapSecond()
    265     // Set time
     244        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     245    }
     246
     247
     248    // psTimeIsLeapSecond()
    266249    // Attempt to determine if leap second with non-UTC time
    267     // Following should generate an error message for invalid type
     250    // Following should generate an error message for unallowed type
    268251    // XXX: We do not test the error generation
    269252    {
     
    273256        time->nsec = testTime1NanosecondsUTC;
    274257        time->leapsecond = false;
    275 
    276258        bool leapsecond = psTimeIsLeapSecond(time);
    277259        is_bool(leapsecond, false, "psTimeIsLeapSecond() returned false with incorrect type");
    278 
    279260        psFree(time);
    280261        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     
    292273        time->leapsecond = false;
    293274        time->type = PS_TIME_UTC;
    294 
    295275        bool leapsecond = psTimeIsLeapSecond(time);
    296276        is_bool(leapsecond, false, "psTimeIsLeapSecond() returned false");
    297 
    298277        psFree(time);
    299278        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     
    309288        time->sec = testTime3SecondsUTC;
    310289        time->nsec = testTime3NanosecondsUTC;
    311 
    312290        bool leapsecond = psTimeIsLeapSecond(time);
    313291        is_bool(leapsecond, true, "psTimeIsLeapSecond() returned true");
    314 
    315292        psFree(time);
    316293        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     
    327304        time->nsec = testTime3NanosecondsUTC;
    328305        time->sec--;
    329 
    330306        bool leapsecond = psTimeIsLeapSecond(time);
    331307        is_bool(leapsecond, false, "psTimeIsLeapSecond() returned false");
    332 
    333308        psFree(time);
    334309        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     
    343318        time->sec = testTime3SecondsUTC;
    344319        time->nsec = testTime3NanosecondsUTC;
    345         time->sec ++;
    346 
     320        time->sec++;
    347321        bool leapsecond = psTimeIsLeapSecond(time);
    348322        is_bool(leapsecond, false, "psTimeIsLeapSecond() returned false");
    349 
    350323        psFree(time);
    351324        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     
    354327
    355328    // psTimeFromTT()
    356     // Attempt to create psTime with invalid time
    357     // Following should generate an error message for invalid time
     329    // Attempt to create psTime with unallowed time
     330    // Following should generate an error message for unallowed time
    358331    // XXX: We do not test the error generation
    359332    {
     
    389362
    390363    // psTimeFromUTC()
    391     // Attempt to create psTime with invalid time
    392     // Following should generate an error message for invalid time
     364    // Attempt to create psTime with unallowed time
     365    // Following should generate an error message for unallowed time
    393366    // XXX: We do not test the error generation
    394367    {
Note: See TracChangeset for help on using the changeset viewer.