Changeset 12413 for trunk/psLib/test/astro/tap_psTime_02.c
- Timestamp:
- Mar 12, 2007, 2:02:14 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/astro/tap_psTime_02.c (modified) (25 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/astro/tap_psTime_02.c
r12406 r12413 12 12 * @author Eric Van Alst, MHPCC 13 13 * 14 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $15 * @date $Date: 2007-03-1 2 21:00:25$14 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2007-03-13 00:02:14 $ 16 16 * 17 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 20 20 #include <stdio.h> 21 21 #include <string.h> 22 #include <math.h> 22 23 #include <pslib.h> 24 23 25 #include "tap.h" 24 26 #include "pstap.h" … … 49 51 const psU32 testTime3NanosecondsUTC = 0; 50 52 51 psS32 main(psS32argc, char* argv[])53 int main(int argc, char* argv[]) 52 54 { 53 55 psLogSetLevel(PS_LOG_INFO); 54 56 psLogSetFormat("HLNM"); 55 plan_tests(5 0);57 plan_tests(54); 56 58 psLibInit("pslib.config"); 57 59 … … 62 64 { 63 65 psMemId id = psMemGetId(); 66 64 67 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 66 70 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 67 71 } … … 76 80 time->nsec = testTime1NanosecondsUTC; 77 81 time->leapsecond = false; 82 78 83 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 80 86 psFree(time); 81 87 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 94 100 time->leapsecond = false; 95 101 time->type = PS_TIME_UT1; 102 96 103 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 98 106 psFree(time); 99 107 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 107 115 { 108 116 psMemId id = psMemGetId(); 117 109 118 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 111 121 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 112 122 } … … 125 135 126 136 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 128 139 psFree(time1); 129 140 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 146 157 time2->leapsecond = false; 147 158 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 150 162 psFree(time1); 151 163 psFree(time2); … … 171 183 172 184 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 174 187 psFree(time1); 175 188 psFree(time2); … … 191 204 192 205 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 194 208 psFree(time1); 195 209 psFree(time2); … … 208 222 time2->sec = testTime2SecondsUTC; 209 223 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 212 228 psFree(time1); 213 229 psFree(time2); … … 225 241 226 242 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 228 245 psFree(time1); 229 246 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 237 254 { 238 255 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 241 260 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 242 261 } … … 254 273 time->nsec = testTime1NanosecondsUTC; 255 274 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 258 279 psFree(time); 259 280 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 271 292 time->leapsecond = false; 272 293 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 275 298 psFree(time); 276 299 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 286 309 time->sec = testTime3SecondsUTC; 287 310 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 290 315 psFree(time); 291 316 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 302 327 time->nsec = testTime3NanosecondsUTC; 303 328 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 306 333 psFree(time); 307 334 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 317 344 time->nsec = testTime3NanosecondsUTC; 318 345 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 321 350 psFree(time); 322 351 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 330 359 { 331 360 psMemId id = psMemGetId(); 361 332 362 psTime *time = psTimeFromTT(0,2e9); 333 363 ok(time == NULL, "psTimeFromTT() returned NULL with incorrect time"); 364 334 365 psFree(time); 335 366 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 341 372 { 342 373 psMemId id = psMemGetId(); 374 343 375 psTime *time = psTimeFromTT(testTime1SecondsUTC,testTime1NanosecondsUTC); 344 376 ok(time != NULL, "psTimeFromTT() returned non-NULL with valid time"); … … 346 378 347 379 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"); 350 383 skip_end(); 384 351 385 psFree(time); 352 386 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 360 394 { 361 395 psMemId id = psMemGetId(); 396 362 397 psTime *time = psTimeFromUTC(0, 2e9, true); 363 398 ok(time == NULL, "psTimeFromUTC() returned NULL with incorrect time input"); 399 364 400 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 365 401 } … … 374 410 skip_start(time == NULL, 3, "Skipping tests because psTimeFromUTC() returned NULL"); 375 411 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"); 380 415 skip_end(); 416 417 psFree(time); 381 418 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 382 419 } … … 387 424 { 388 425 psMemId id = psMemGetId(); 426 389 427 psTime *time = psTimeFromUTC(testTime3SecondsUTC, testTime3NanosecondsUTC, false); 390 428 ok(time != NULL, "psTimeFromUTC() returned non-NULL with correct input"); 391 429 skip_start(time == NULL, 5, "Skipping tests because psTimeFromUTC() returned NULL"); 392 430 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"); 396 434 psFree(time); 397 435 skip_end(); 436 398 437 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 399 438 }
Note:
See TracChangeset
for help on using the changeset viewer.
