Changeset 13614 for trunk/psLib/test/astro
- Timestamp:
- Jun 4, 2007, 10:25:32 AM (19 years ago)
- Location:
- trunk/psLib/test/astro
- Files:
-
- 3 edited
-
tap_psTime_01.c (modified) (30 diffs)
-
tap_psTime_02.c (modified) (24 diffs)
-
tap_psTime_04.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/astro/tap_psTime_01.c
r12607 r13614 23 23 * @author Eric Van Alst, MHPCC 24 24 * 25 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $26 * @date $Date: 2007-0 3-27 22:52:02 $25 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 26 * @date $Date: 2007-06-04 20:25:32 $ 27 27 * 28 28 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 131 131 psLogSetFormat("HLNM"); 132 132 psLogSetLevel(PS_LOG_INFO); 133 plan_tests(1 78);133 plan_tests(198); 134 134 // Initialize library internal structures 135 135 psLibInit("pslib.config"); 136 136 137 137 138 // Test psTimeAlloc() 138 // Allocate new psTime with unallowed time type 139 // Following should generate error message 140 { 141 psMemId id = psMemGetId(); 142 psTime *time = psTimeAlloc(-100); 143 ok(time == NULL, "psTimeAlloc(-100) returned NULL"); 144 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 145 } 146 147 148 // Test psTimeAlloc(TAI) 139 149 { 140 150 psMemId id = psMemGetId(); … … 151 161 } 152 162 153 // Allocate new psTime with invalid time type 154 // Following should generate error message 155 { 156 psMemId id = psMemGetId(); 157 psTime *time = psTimeAlloc(-100); 158 ok(time == NULL, "psTimeAlloc(-100) returned NULL"); 159 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 160 } 163 164 // Test psTimeAlloc(UTC) 165 { 166 psMemId id = psMemGetId(); 167 psTime *time = psTimeAlloc(PS_TIME_UTC); 168 ok(time != NULL, "psTimeAlloc() did not return NULL"); 169 skip_start(time == NULL, 4, "Skipping tests because psTimeAlloc() failed"); 170 ok(time->type == PS_TIME_UTC, "psTimeAlloc() correctly set psTime->type"); 171 ok(time->sec == 0, "psTimeAlloc() correctly set psTime->sec"); 172 ok(time->nsec == 0, "psTimeAlloc() correctly set psTime->nsec"); 173 ok(time->leapsecond == false, "psTimeAlloc() correctly set psTime->leapsecond"); 174 psFree(time); 175 skip_end(); 176 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 177 } 178 179 180 // Test psTimeAlloc(UT1) 181 { 182 psMemId id = psMemGetId(); 183 psTime *time = psTimeAlloc(PS_TIME_UT1); 184 ok(time != NULL, "psTimeAlloc() did not return NULL"); 185 skip_start(time == NULL, 4, "Skipping tests because psTimeAlloc() failed"); 186 ok(time->type == PS_TIME_UT1, "psTimeAlloc() correctly set psTime->type"); 187 ok(time->sec == 0, "psTimeAlloc() correctly set psTime->sec"); 188 ok(time->nsec == 0, "psTimeAlloc() correctly set psTime->nsec"); 189 ok(time->leapsecond == false, "psTimeAlloc() correctly set psTime->leapsecond"); 190 psFree(time); 191 skip_end(); 192 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 193 } 194 195 196 // Test psTimeAlloc(TT) 197 { 198 psMemId id = psMemGetId(); 199 psTime *time = psTimeAlloc(PS_TIME_TT); 200 ok(time != NULL, "psTimeAlloc() did not return NULL"); 201 skip_start(time == NULL, 4, "Skipping tests because psTimeAlloc() failed"); 202 ok(time->type == PS_TIME_TT, "psTimeAlloc() correctly set psTime->type"); 203 ok(time->sec == 0, "psTimeAlloc() correctly set psTime->sec"); 204 ok(time->nsec == 0, "psTimeAlloc() correctly set psTime->nsec"); 205 ok(time->leapsecond == false, "psTimeAlloc() correctly set psTime->leapsecond"); 206 psFree(time); 207 skip_end(); 208 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 209 } 210 161 211 162 212 // Test psTimeGetNow() 213 // Attempt to get time with unallowed type 214 // Following should generate an error message for unallowed time type 215 { 216 psMemId id = psMemGetId(); 217 psTime *timeNow = psTimeGetNow(-100); 218 ok(timeNow == NULL, "psTimeGetNow(-100) returned NULL"); 219 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 220 } 221 222 223 // Test psTimeGetNow(TAI) 163 224 { 164 225 psMemId id = psMemGetId(); … … 167 228 skip_start(time == NULL, 4, "Skipping tests because psTimeGetNow() failed"); 168 229 ok(timeNow->type == PS_TIME_TAI, "psTimeGetNow() correctly set psTime->type"); 230 ok(timeNow->sec != 0, "psTimeAlloc() set psTime->sec to something"); 231 ok(timeNow->nsec != 0, "psTimeAlloc() set psTime->nsec to something"); 169 232 psFree(timeNow); 170 233 skip_end(); … … 172 235 } 173 236 174 // Attempt to get time with invalid type175 // Following should generate an error message for invalid time type176 {177 psMemId id = psMemGetId();178 psTime *timeNow = psTimeGetNow(-100);179 ok(timeNow == NULL, "psTimeGetNow(-100) returned NULL");180 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");181 }182 237 183 238 // Test psTimeGetUT1Delta() … … 191 246 } 192 247 193 // Attempt to convert invalid time248 // Attempt to convert unallowed time 194 249 // Following should generate an error message for incorrect time 195 250 { … … 205 260 } 206 261 207 // Attempt to convert time with invalid bulletin262 // Attempt to convert time with unallowed bulletin 208 263 // Following should generate an error message for incorrect bulletin 209 264 { … … 360 415 time->nsec = testTime1NanosecondsUTC; 361 416 psF64 mjd = psTimeToMJD(time); 362 363 417 is_double_tol(mjd, 53207.765929, ERROR_TOL, "psTimeToMJD() returned correct time after 1/1/1970 epoch"); 364 365 psFree(time);366 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");367 } 418 psFree(time); 419 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 420 } 421 368 422 369 423 // psTimeToMJD() … … 375 429 time->nsec = testTime4NanosecondsUTC; 376 430 psF64 mjd = psTimeToMJD(time); 377 378 431 is_double_tol(mjd, testTime4MJD, ERROR_TOL, "psTimeToMJD() returned correct time before 1/1/1970 epoch"); 379 380 432 psFree(time); 381 433 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 390 442 psMemId id = psMemGetId(); 391 443 psF64 jd = psTimeToJD(NULL); 392 393 444 is_double(jd, NAN, "psTimeToJD(NULL) returned NULL"); 394 445 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 395 446 } 447 396 448 397 449 // psTimeToJD() … … 406 458 time->leapsecond = false; 407 459 psF64 jd = psTimeToJD(time); 408 409 460 is_double(jd, NAN, "psTimeToJD() returned NAN for incorrect time"); 410 411 461 psFree(time); 412 462 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 422 472 time->nsec = testTime1NanosecondsUTC; 423 473 psF64 jd = psTimeToJD(time); 424 425 474 is_double_tol(jd, 2453208.265929, ERROR_TOL, "psTimeToJD() returned the correct time after 1/1/1970 epoch"); 426 427 475 psFree(time); 428 476 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 438 486 time->nsec = testTime4NanosecondsUTC; 439 487 psF64 jd = psTimeToJD(time); 440 441 488 is_double_tol(jd, testTime4JD, ERROR_TOL, "psTimeToJD() returned the correct time before 1/1/1970 epoch"); 442 443 489 psFree(time); 444 490 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 453 499 psMemId id = psMemGetId(); 454 500 char *timeStr = psTimeToISO(NULL); 455 456 501 ok(timeStr == NULL, "psTimeToISO(NULL) returned NULL"); 457 458 502 psFree(timeStr); 459 503 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 460 504 } 505 461 506 462 507 // Test psTimeToISO() … … 471 516 time->nsec = 2e9; 472 517 char *timeStr = psTimeToISO(time); 473 474 518 ok(timeStr == NULL, "psTimeToISO(time) returned NULL for incorrect time"); 475 476 519 psFree(time); 477 520 psFree(timeStr); … … 490 533 time->nsec = testTime5NanosecondsUTC; 491 534 char *timeStr = psTimeToISO(time); 492 493 535 ok(timeStr == NULL, "psTimeToISO(time) returned NULL for time prior to year 0000"); 494 495 536 psFree(time); 496 537 psFree(timeStr); … … 527 568 time->nsec = testTime1NanosecondsUTC; 528 569 char *timeStr = psTimeToISO(time); 529 530 570 is_str(timeStr, testTime1Str, "psTimeToISO(time) returned correct time (no leapsecond)"); 531 532 571 psFree(timeStr); 533 572 psFree(time); … … 546 585 time->leapsecond = true; 547 586 char *timeStr = psTimeToISO(time); 548 549 587 is_str(timeStr, testTime1StrLeap, "psTimeToISO(time) returned correct time (with leapsecond)"); 550 551 588 psFree(timeStr); 552 589 psFree(time); … … 580 617 time->nsec = 2e9; 581 618 struct timeval *timevalTime = psTimeToTimeval(time); 582 583 619 ok(timevalTime == NULL, "psTimeToTimeval() returned NULL for incorrect time"); 584 585 620 psFree(time); 586 621 psFree(timevalTime); … … 599 634 time->nsec = 0; 600 635 struct timeval *timevalTime = psTimeToTimeval(time); 601 602 636 ok(timevalTime == NULL, "psTimeToTimeval() returned NULL for incorrect time"); 603 604 637 psFree(time); 605 638 psFree(timevalTime); … … 617 650 time->nsec = testTime1NanosecondsUTC; 618 651 struct timeval *timevalTime = psTimeToTimeval(time); 619 620 652 is_long(timevalTime->tv_sec, testTime1TimevalSec, "psTimeToTimeval()->tv_sec"); 621 653 is_long(timevalTime->tv_usec, testTime1TimevalUsec, "psTimeToTimeval()->tv_usec"); 622 623 654 psFree(time); 624 655 psFree(timevalTime); … … 632 663 psMemId id = psMemGetId(); 633 664 psTime *time = psTimeFromMJD(testTime1MJDTAI); 634 635 665 ok(time->type == PS_TIME_TAI, "psTimeFromMJD() returned the correct type"); 636 666 is_long(time->sec, testTime1SecondsTAI, "psTimeFromMJD()->sec"); 637 638 667 psFree(time); 639 668 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 646 675 psMemId id = psMemGetId(); 647 676 psTime *time = psTimeFromMJD(testTime4MJD); 648 649 677 ok(time->type == PS_TIME_TAI, "psTimeFromMJD() returned the correct type"); 650 678 is_long(time->sec, testTime4SecondsUTC, "psTimeFromMJD()->sec"); 651 652 679 psFree(time); 653 680 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 660 687 psMemId id = psMemGetId(); 661 688 psTime *time = psTimeFromJD(testTime1JDTAI); 662 663 689 ok(time->type == PS_TIME_TAI, "psTimeFromJD() returned the correct type"); 664 690 is_long(time->sec, testTime1SecondsTAI, "psTimeFromJD()->sec"); 665 666 691 psFree(time); 667 692 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 843 868 844 869 // psTimeConvert() 845 // Attempt to convert to incorrect type846 // Following should generate an error message for incorrect type870 // Following should generate an error message for incorrect type output 871 // Input psTime struct is PS_TIME_TAI 847 872 // XXX: We don't test whether the error message is generated 848 873 { … … 850 875 psTime *time1 = psTimeAlloc(PS_TIME_TAI); 851 876 psTime *time2 = psTimeConvert(time1,-100); 852 853 877 ok(time2 == NULL, "psTimeConvert(time1, -100) returned NULL"); 854 855 psFree(time1); 878 psFree(time1); 879 psFree(time2); 880 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 881 } 882 883 884 // psTimeConvert() 885 // Following should generate an error message for incorrect type output 886 // Input psTime struct is PS_TIME_UTC 887 // XXX: We don't test whether the error message is generated 888 { 889 psMemId id = psMemGetId(); 890 psTime *time1 = psTimeAlloc(PS_TIME_UTC); 891 psTime *time2 = psTimeConvert(time1,-100); 892 ok(time2 == NULL, "psTimeConvert(time1, -100) returned NULL"); 893 psFree(time1); 894 psFree(time2); 856 895 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 857 896 } … … 860 899 // psTimeConvert() 861 900 // Following should generate an error message for incorrect type 862 // XXX: We don't test whether the error message is generated863 {864 psMemId id = psMemGetId();865 ps Time *time1 = psTimeAlloc(PS_TIME_TAI);866 time1->type = PS_TIME_UTC;901 // Input psTime struct is PS_TIME_TT 902 // XXX: We don't test whether the error message is generated 903 { 904 psMemId id = psMemGetId(); 905 psTime *time1 = psTimeAlloc(PS_TIME_TT); 867 906 psTime *time2 = psTimeConvert(time1,-100); 868 869 907 ok(time2 == NULL, "psTimeConvert(time1, -100) returned NULL"); 870 871 psFree(time1); 872 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 873 } 874 875 876 // psTimeConvert() 877 // Following should generate an error message for incorrect type 878 // XXX: We don't test whether the error message is generated 879 { 880 psMemId id = psMemGetId(); 881 psTime *time1 = psTimeAlloc(PS_TIME_TAI); 882 time1->type = PS_TIME_TT; 883 psTime *time2 = psTimeConvert(time1,-100); 884 885 ok(time2 == NULL, "psTimeConvert(time1, -100) returned NULL"); 886 887 psFree(time1); 888 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 889 } 890 891 892 // psTimeConvert() 893 // Following should generate an error message for incorrect type 908 psFree(time1); 909 psFree(time2); 910 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 911 } 912 913 914 // psTimeConvert() 915 // Following should generate an error message for incorrect type input 894 916 // XXX: We don't test whether the error message is generated 895 917 { … … 898 920 time1->type = -100; 899 921 psTime *time2 = psTimeConvert(time1,PS_TIME_TAI); 900 901 922 ok(time2 == NULL, "psTimeConvert(time1, PS_TIME_TAI) returned NULL"); 902 903 psFree(time 1);923 psFree(time1); 924 psFree(time2); 904 925 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 905 926 } … … 915 936 time1->nsec = 2e9; 916 937 psTime *time2 = psTimeConvert(time1, PS_TIME_TAI); 917 918 938 ok(time2 == NULL, "psTimeConvert(time1, PS_TIME_TAI) returns NULL for incorrect psTime object"); 919 920 psFree(time 1);939 psFree(time1); 940 psFree(time2); 921 941 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 922 942 } … … 932 952 time1->type = PS_TIME_TAI; 933 953 time1->leapsecond = false; 934 935 954 psTime *time2 = psTimeConvert(time1, PS_TIME_TAI); 936 955 ok(time2 == time1, "psTimeConvert(time, ...) returns time for conversion to same type"); -
trunk/psLib/test/astro/tap_psTime_02.c
r12607 r13614 12 12 * @author Eric Van Alst, MHPCC 13 13 * 14 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $15 * @date $Date: 2007-0 3-27 22:52:02 $14 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2007-06-04 20:25:32 $ 16 16 * 17 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 64 64 { 65 65 psMemId id = psMemGetId(); 66 67 66 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"); 70 68 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 71 69 } … … 80 78 time->nsec = testTime1NanosecondsUTC; 81 79 time->leapsecond = false; 82 83 80 psF64 lmst = psTimeToLMST(time, 0.0); 84 81 is_double_tol(lmst, testTime1LMST0, ERROR_TOL, "psTimeToLMST() returned the correct time"); 85 86 82 psFree(time); 87 83 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 90 86 91 87 // psTimeToLMST() 92 // Attempt to get LMST with invalid input time UT188 // Attempt to get LMST with unallowed input time UT1 93 89 // Following should generate error message for incorrect type 94 90 // XXX: We do not test the error generation … … 100 96 time->leapsecond = false; 101 97 time->type = PS_TIME_UT1; 102 103 98 psF64 lmst = psTimeToLMST(time,0.0); 104 99 is_double(lmst, NAN, "psTimeToLMST() generated a NAN for incorrect type"); 105 106 100 psFree(time); 107 101 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 115 109 { 116 110 psMemId id = psMemGetId(); 117 118 111 psS64 delta = psTimeLeapSecondDelta(NULL, NULL); 119 112 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() 125 118 // Set test time 1 126 119 // Attempt to get delta with NULL time2 argument … … 133 126 time1->nsec = testTime1NanosecondsUTC; 134 127 time1->leapsecond = false; 135 136 128 psS64 delta = psTimeLeapSecondDelta(time1, NULL); 137 129 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 time145 // Attempt to get delta with invalid time2146 // Following should generate an error message for invalid time130 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 147 139 // XXX: We do not test the error generation 148 140 { … … 156 148 time2->nsec = 2e9; 157 149 time2->leapsecond = false; 158 159 150 psS64 delta = psTimeLeapSecondDelta(time1, time2); 160 151 is_long(delta, 0, "psTimeLeapSecondDelta(time1, time2) returned 0 with incorrect time2"); 161 162 152 psFree(time1); 163 153 psFree(time2); … … 166 156 167 157 158 // psTimeLeapSecondDelta() 168 159 // Set test time 2 valid 169 // Attempt to get delta with invalid time1170 // Following should generate an error message for invalid time160 // Attempt to get delta with unallowed time1 161 // Following should generate an error message for unallowed time 171 162 // XXX: We do not test the error generation 172 163 { … … 181 172 time1->sec = 0; 182 173 time1->nsec = 2e9; 183 184 174 psS64 delta = psTimeLeapSecondDelta(time1,time2); 185 175 is_long(delta, 0, "psTimeLeapSecondDelta(time1, time2) returned 0 with incorrect time1"); 186 187 176 psFree(time1); 188 177 psFree(time2); … … 191 180 192 181 182 // psTimeLeapSecondDelta() 193 183 // Set test time 1 to greater time 194 184 { … … 202 192 time2->sec = testTime2SecondsUTC; 203 193 time2->nsec = testTime2NanosecondsUTC; 204 205 194 psS64 delta = psTimeLeapSecondDelta(time1,time2); 206 195 is_long(delta, testTimeLeapSecondDelta1, "psTimeLeapSecondDelta() produced the correct result"); 207 208 196 psFree(time1); 209 197 psFree(time2); … … 212 200 213 201 202 // psTimeLeapSecondDelta() 214 203 // Set test time 1 to lesser time 215 204 { … … 222 211 time2->sec = testTime2SecondsUTC; 223 212 time2->nsec = testTime2NanosecondsUTC; 224 225 213 psS64 delta = psTimeLeapSecondDelta(time2, time1); 226 214 is_long(delta, testTimeLeapSecondDelta1, "psTimeLeapSecondDelta() produced the correct result"); 227 228 215 psFree(time1); 229 216 psFree(time2); … … 232 219 233 220 221 // psTimeLeapSecondDelta() 234 222 // Attempt to get delta with times equal 235 223 { … … 239 227 time1->nsec = testTime1NanosecondsUTC; 240 228 time1->leapsecond = false; 241 242 229 psS64 delta = psTimeLeapSecondDelta(time1,time1); 243 230 is_long(delta, 0, "psTimeLeapSecondDelta() produced the correct result"); 244 245 231 psFree(time1); 246 232 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 254 240 { 255 241 psMemId id = psMemGetId(); 256 257 242 bool leapsecond = psTimeIsLeapSecond(NULL); 258 243 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() 266 249 // Attempt to determine if leap second with non-UTC time 267 // Following should generate an error message for invalid type250 // Following should generate an error message for unallowed type 268 251 // XXX: We do not test the error generation 269 252 { … … 273 256 time->nsec = testTime1NanosecondsUTC; 274 257 time->leapsecond = false; 275 276 258 bool leapsecond = psTimeIsLeapSecond(time); 277 259 is_bool(leapsecond, false, "psTimeIsLeapSecond() returned false with incorrect type"); 278 279 260 psFree(time); 280 261 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 292 273 time->leapsecond = false; 293 274 time->type = PS_TIME_UTC; 294 295 275 bool leapsecond = psTimeIsLeapSecond(time); 296 276 is_bool(leapsecond, false, "psTimeIsLeapSecond() returned false"); 297 298 277 psFree(time); 299 278 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 309 288 time->sec = testTime3SecondsUTC; 310 289 time->nsec = testTime3NanosecondsUTC; 311 312 290 bool leapsecond = psTimeIsLeapSecond(time); 313 291 is_bool(leapsecond, true, "psTimeIsLeapSecond() returned true"); 314 315 292 psFree(time); 316 293 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 327 304 time->nsec = testTime3NanosecondsUTC; 328 305 time->sec--; 329 330 306 bool leapsecond = psTimeIsLeapSecond(time); 331 307 is_bool(leapsecond, false, "psTimeIsLeapSecond() returned false"); 332 333 308 psFree(time); 334 309 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 343 318 time->sec = testTime3SecondsUTC; 344 319 time->nsec = testTime3NanosecondsUTC; 345 time->sec ++; 346 320 time->sec++; 347 321 bool leapsecond = psTimeIsLeapSecond(time); 348 322 is_bool(leapsecond, false, "psTimeIsLeapSecond() returned false"); 349 350 323 psFree(time); 351 324 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 354 327 355 328 // psTimeFromTT() 356 // Attempt to create psTime with invalid time357 // Following should generate an error message for invalid time329 // Attempt to create psTime with unallowed time 330 // Following should generate an error message for unallowed time 358 331 // XXX: We do not test the error generation 359 332 { … … 389 362 390 363 // psTimeFromUTC() 391 // Attempt to create psTime with invalid time392 // Following should generate an error message for invalid time364 // Attempt to create psTime with unallowed time 365 // Following should generate an error message for unallowed time 393 366 // XXX: We do not test the error generation 394 367 { -
trunk/psLib/test/astro/tap_psTime_04.c
r12415 r13614 18 18 * @author David Robbins, MHPCC 19 19 * 20 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $21 * @date $Date: 2007-0 3-13 00:23:20$20 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 21 * @date $Date: 2007-06-04 20:25:32 $ 22 22 * 23 23 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 34 34 psLogSetFormat("HLNM"); 35 35 psLogSetLevel(PS_LOG_INFO); 36 plan_tests(1 6);36 plan_tests(19); 37 37 38 38 … … 114 114 } 115 115 116 116 117 // testTideUT1Corr() 118 // Verify NULL return with NULL input 119 // XXX: Verify error 117 120 { 118 121 psMemId id = psMemGetId(); 119 psTime *tide = NULL; 122 psTime *empty = psTime_TideUT1Corr(NULL); 123 ok(empty == NULL, "psTime_TideUT1Corr() returned NULL for NULL input time"); 124 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 125 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 126 } 127 128 129 // testTideUT1Corr() 130 // 131 { 132 psMemId id = psMemGetId(); 120 133 psTime *noTide = psTimeAlloc(PS_TIME_UTC); 121 134 noTide->sec = 1049160600; 122 135 noTide->nsec = 0; 123 136 noTide->leapsecond = false; 124 // Following should generate error message 125 // XXX: We do not test error generation here 126 psTime *empty = empty = psTime_TideUT1Corr(tide); 127 ok(empty == NULL, "psTime_TideUT1Corr() returned NULL for NULL input time"); 128 129 empty = psTime_TideUT1Corr(noTide); 137 psTime *empty = psTime_TideUT1Corr(noTide); 130 138 is_long(empty->sec, 1049160599, "psTime_TideUT1Corr() returned correct ->sec"); 131 139 is_long(empty->nsec, 656981971, "psTime_TideUT1Corr() returned correct ->nsec"); 132 133 140 ok(p_psTimeFinalize(), "p_psTimeFinalize() successful"); 134 135 141 psFree(empty); 136 142 psFree(noTide); 137 143 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 144 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 138 145 } 139 146 }
Note:
See TracChangeset
for help on using the changeset viewer.
