IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 12, 2007, 2:02:14 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_02.c

    r12406 r12413  
    1212 *  @author  Eric Van Alst, MHPCC
    1313 *
    14  *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
    15  *  @date  $Date: 2007-03-12 21:00:25 $
     14 *  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
     15 *  @date  $Date: 2007-03-13 00:02:14 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2020#include <stdio.h>
    2121#include <string.h>
     22#include <math.h>
    2223#include <pslib.h>
     24
    2325#include "tap.h"
    2426#include "pstap.h"
     
    4951const psU32 testTime3NanosecondsUTC = 0;
    5052
    51 psS32 main(psS32 argc, char* argv[])
     53int main(int argc, char* argv[])
    5254{
    5355    psLogSetLevel(PS_LOG_INFO);
    5456    psLogSetFormat("HLNM");
    55     plan_tests(50);
     57    plan_tests(54);
    5658    psLibInit("pslib.config");
    5759
     
    6264    {
    6365        psMemId id = psMemGetId();
     66
    6467        psF64 lmst = psTimeToLMST(NULL, 0);
    65         ok(isnan(lmst), "psTimeToLMST(time,0) returned NULL");
     68        ok_double(lmst, NAN, "psTimeToLMST(time,0) returned NAN");
     69
    6670        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    6771    }
     
    7680        time->nsec = testTime1NanosecondsUTC;
    7781        time->leapsecond = false;
     82
    7883        psF64 lmst = psTimeToLMST(time, 0.0);
    79         ok(fabs(lmst-testTime1LMST0) < ERROR_TOL, "psTimeToLMST() returned the correct time");
     84        ok_double_tol(lmst, testTime1LMST0, ERROR_TOL, "psTimeToLMST() returned the correct time");
     85
    8086        psFree(time);
    8187        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     
    94100        time->leapsecond = false;
    95101        time->type = PS_TIME_UT1;
     102
    96103        psF64 lmst = psTimeToLMST(time,0.0);
    97         ok(isnan(lmst), "psTimeToLMST() generated a NAN for incorrect type");
     104        ok_double(lmst, NAN, "psTimeToLMST() generated a NAN for incorrect type");
     105
    98106        psFree(time);
    99107        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     
    107115    {
    108116        psMemId id = psMemGetId();
     117
    109118        psS64 delta = psTimeLeapSecondDelta(NULL, NULL);
    110         ok(delta == 0, "psTimeLeapSecondDelta(NULL, NULL) returned 0");
     119        is_long(delta, 0, "psTimeLeapSecondDelta(NULL, NULL) returned 0");
     120
    111121        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    112122    }
     
    125135
    126136        psS64 delta = psTimeLeapSecondDelta(time1, NULL);
    127         ok(delta == 0, "psTimeLeapSecondDelta(time1, NULL) returned 0");
     137        is_long(delta, 0, "psTimeLeapSecondDelta(time1, NULL) returned 0");
     138
    128139        psFree(time1);
    129140        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     
    146157        time2->leapsecond = false;
    147158
    148         psS64 delta = psTimeLeapSecondDelta(time1,time2);
    149         ok(delta == 0, "psTimeLeapSecondDelta(time1, time2) returned 0 with incorrect time2");
     159        psS64 delta = psTimeLeapSecondDelta(time1, time2);
     160        is_long(delta, 0, "psTimeLeapSecondDelta(time1, time2) returned 0 with incorrect time2");
     161
    150162        psFree(time1);
    151163        psFree(time2);
     
    171183
    172184        psS64 delta = psTimeLeapSecondDelta(time1,time2);
    173         ok(delta == 0, "psTimeLeapSecondDelta(time1, time2) returned 0 with incorrect time1");
     185        is_long(delta, 0, "psTimeLeapSecondDelta(time1, time2) returned 0 with incorrect time1");
     186
    174187        psFree(time1);
    175188        psFree(time2);
     
    191204
    192205        psS64 delta = psTimeLeapSecondDelta(time1,time2);
    193         ok(delta == testTimeLeapSecondDelta1, "psTimeLeapSecondDelta() produced the correct result");
     206        is_long(delta, testTimeLeapSecondDelta1, "psTimeLeapSecondDelta() produced the correct result");
     207
    194208        psFree(time1);
    195209        psFree(time2);
     
    208222        time2->sec = testTime2SecondsUTC;
    209223        time2->nsec = testTime2NanosecondsUTC;
    210         psS64 delta = psTimeLeapSecondDelta(time2,time1);
    211         ok(delta == testTimeLeapSecondDelta1, "psTimeLeapSecondDelta() produced the correct result");
     224
     225        psS64 delta = psTimeLeapSecondDelta(time2, time1);
     226        is_long(delta, testTimeLeapSecondDelta1, "psTimeLeapSecondDelta() produced the correct result");
     227
    212228        psFree(time1);
    213229        psFree(time2);
     
    225241
    226242        psS64 delta = psTimeLeapSecondDelta(time1,time1);
    227         ok(delta == 0, "psTimeLeapSecondDelta() produced the correct result");
     243        is_long(delta, 0, "psTimeLeapSecondDelta() produced the correct result");
     244
    228245        psFree(time1);
    229246        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     
    237254    {
    238255        psMemId id = psMemGetId();
    239         psBool leapsecond = psTimeIsLeapSecond(NULL);
    240         ok(!leapsecond, "psTimeIsLeapSecond(NULL) returned correct value");
     256
     257        bool leapsecond = psTimeIsLeapSecond(NULL);
     258        is_bool(leapsecond, false, "psTimeIsLeapSecond(NULL) returned correct value");
     259
    241260        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    242261    }
     
    254273        time->nsec = testTime1NanosecondsUTC;
    255274        time->leapsecond = false;
    256         psBool leapsecond = psTimeIsLeapSecond(time);
    257         ok(!leapsecond, "psTimeIsLeapSecond() returned false with incorrect type");
     275
     276        bool leapsecond = psTimeIsLeapSecond(time);
     277        is_bool(leapsecond, false, "psTimeIsLeapSecond() returned false with incorrect type");
     278
    258279        psFree(time);
    259280        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     
    271292        time->leapsecond = false;
    272293        time->type = PS_TIME_UTC;
    273         psBool leapsecond = psTimeIsLeapSecond(time);
    274         ok(!leapsecond, "psTimeIsLeapSecond() returned false");
     294
     295        bool leapsecond = psTimeIsLeapSecond(time);
     296        is_bool(leapsecond, false, "psTimeIsLeapSecond() returned false");
     297
    275298        psFree(time);
    276299        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     
    286309        time->sec = testTime3SecondsUTC;
    287310        time->nsec = testTime3NanosecondsUTC;
    288         psBool leapsecond = psTimeIsLeapSecond(time);
    289         ok(leapsecond, "psTimeIsLeapSecond() returned true");
     311
     312        bool leapsecond = psTimeIsLeapSecond(time);
     313        is_bool(leapsecond, true, "psTimeIsLeapSecond() returned true");
     314
    290315        psFree(time);
    291316        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     
    302327        time->nsec = testTime3NanosecondsUTC;
    303328        time->sec--;
    304         psBool leapsecond = psTimeIsLeapSecond(time);
    305         ok(!leapsecond, "psTimeIsLeapSecond() returned false");
     329
     330        bool leapsecond = psTimeIsLeapSecond(time);
     331        is_bool(leapsecond, false, "psTimeIsLeapSecond() returned false");
     332
    306333        psFree(time);
    307334        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     
    317344        time->nsec = testTime3NanosecondsUTC;
    318345        time->sec ++;
    319         psBool leapsecond = psTimeIsLeapSecond(time);
    320         ok(!leapsecond, "psTimeIsLeapSecond() returned false");
     346
     347        bool leapsecond = psTimeIsLeapSecond(time);
     348        is_bool(leapsecond, false, "psTimeIsLeapSecond() returned false");
     349
    321350        psFree(time);
    322351        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     
    330359    {
    331360        psMemId id = psMemGetId();
     361
    332362        psTime *time = psTimeFromTT(0,2e9);
    333363        ok(time == NULL, "psTimeFromTT() returned NULL with incorrect time");
     364
    334365        psFree(time);
    335366        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     
    341372    {
    342373        psMemId id = psMemGetId();
     374
    343375        psTime *time = psTimeFromTT(testTime1SecondsUTC,testTime1NanosecondsUTC);
    344376        ok(time != NULL, "psTimeFromTT() returned non-NULL with valid time");
     
    346378
    347379        ok(time->type == PS_TIME_TT, "psTimeFromTT() returned correct type");
    348         ok((time->sec == testTime1SecondsUTC) && (time->nsec == testTime1NanosecondsUTC),
    349            "psTimeFromTT() returned correct ->sec and ->nsec");
     380        is_long(time->sec, testTime1SecondsUTC, "psTimeFromTT() returned correct ->sec");
     381        is_long(time->nsec, testTime1NanosecondsUTC, "psTimeFromTT() returned correct ->nsec");
     382        is_bool(time->leapsecond, false, "psTimeFromUTC() returned the correct leapsecond flag");
    350383        skip_end();
     384
    351385        psFree(time);
    352386        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     
    360394    {
    361395        psMemId id = psMemGetId();
     396
    362397        psTime *time = psTimeFromUTC(0, 2e9, true);
    363398        ok(time == NULL, "psTimeFromUTC() returned NULL with incorrect time input");
     399
    364400        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    365401    }
     
    374410        skip_start(time == NULL, 3, "Skipping tests because psTimeFromUTC() returned NULL");
    375411        ok(time->type == PS_TIME_UTC, "psTimeFromUTC() returned the correct type");
    376         ok((time->sec == testTime1SecondsUTC) && (time->nsec == testTime1NanosecondsUTC),
    377            "psTimeFromUTC() returned the correct ->sec and ->nsec");
    378         ok(!time->leapsecond, "psTimeFromUTC() returned the correct leapsecond flag");
    379         psFree(time);
     412        is_long(time->sec, testTime1SecondsUTC, "psTimeFromUTC() returned the correct ->sec and ->nsec");
     413        is_long(time->nsec, testTime1NanosecondsUTC, "psTimeFromUTC() returned the correct ->sec and ->nsec");
     414        is_bool(time->leapsecond, false, "psTimeFromUTC() returned the correct leapsecond flag");
    380415        skip_end();
     416
     417        psFree(time);
    381418        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    382419    }
     
    387424    {
    388425        psMemId id = psMemGetId();
     426
    389427        psTime *time = psTimeFromUTC(testTime3SecondsUTC, testTime3NanosecondsUTC, false);
    390428        ok(time != NULL, "psTimeFromUTC() returned non-NULL with correct input");
    391429        skip_start(time == NULL, 5, "Skipping tests because psTimeFromUTC() returned NULL");
    392430        ok(time->type == PS_TIME_UTC, "psTimeFromUTC() returned the correct type");
    393         ok((time->sec == testTime3SecondsUTC) && (time->nsec == testTime3NanosecondsUTC),
    394            "psTimeFromUTC() returned the correct ->sec and ->nsec");
    395         ok(time->leapsecond, "psTimeFromUTC() returned the correct leapsecond flag");
     431        is_long(time->sec, testTime3SecondsUTC, "psTimeFromUTC() returned the correct ->sec");
     432        is_long(time->nsec, testTime3NanosecondsUTC, "psTimeFromUTC() returned the correct ->nsec");
     433        is_bool(time->leapsecond, true, "psTimeFromUTC() returned the correct leapsecond flag");
    396434        psFree(time);
    397435        skip_end();
     436
    398437        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    399438    }
Note: See TracChangeset for help on using the changeset viewer.