Changeset 12411 for trunk/psLib/test/astro/tap_psTime_01.c
- Timestamp:
- Mar 12, 2007, 1:19:41 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/astro/tap_psTime_01.c (modified) (52 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/astro/tap_psTime_01.c
r12395 r12411 23 23 * @author Eric Van Alst, MHPCC 24 24 * 25 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $26 * @date $Date: 2007-03-1 0 03:25:48$25 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 26 * @date $Date: 2007-03-12 23:19:41 $ 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 16);133 plan_tests(178); 134 134 // Initialize library internal structures 135 135 psLibInit("pslib.config"); … … 228 228 time->leapsecond = false; 229 229 psF64 ut1Delta = psTimeGetUT1Delta(time, PS_IERS_A); 230 ok(fabs(ut1Delta - testTime1UT1DeltaBullA) < ERROR_TOL, "psTimeGetUT1Delta() produced the correct result: bulletin A"); 231 // diag("ERROR: UT1 Delta %lf not as expected %lf test time 1 bulletin A", ut1Delta, testTime1UT1DeltaBullA); 230 231 ok_double_tol(ut1Delta, testTime1UT1DeltaBullA, ERROR_TOL, "psTimeGetUT1Delta() produced the correct result: bulletin A"); 232 232 233 psFree(time); 233 234 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 242 243 time->type = PS_TIME_UTC; 243 244 psF64 ut1Delta = psTimeGetUT1Delta(time, PS_IERS_B); 244 ok(fabs(ut1Delta - testTime1UT1DeltaBullB) < ERROR_TOL, "psTimeGetUT1Delta() produced the correct result: bulletin B"); 245 // diag("UT1 Delta %lf not as expected %lf test time 1 bulletin B", ut1Delta, testTime1UT1DeltaBullB); 245 246 ok_double_tol(ut1Delta, testTime1UT1DeltaBullB, ERROR_TOL, "psTimeGetUT1Delta() produced the correct result: bulletin B"); 247 246 248 psFree(time); 247 249 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 259 261 time->type = PS_TIME_UTC; 260 262 psF64 ut1Delta = psTimeGetUT1Delta(time,PS_IERS_A); 261 ok(fabs(ut1Delta - testTime2UT1DeltaBullA) < ERROR_TOL, "psTimeGetUT1Delta() produced the correct result: bulletin B"); 262 // diag("UT1 Delta %lf not as expected %lf test time 2 bulletin A", ut1Delta, testTime2UT1DeltaBullA); 263 264 ok_double_tol(ut1Delta, testTime2UT1DeltaBullA, ERROR_TOL, "psTimeGetUT1Delta() produced the correct result: bulletin B"); 265 263 266 psFree(time); 264 267 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 276 279 time->type = PS_TIME_UTC; 277 280 psF64 ut1Delta = psTimeGetUT1Delta(time,PS_IERS_B); 278 ok(fabs(ut1Delta - testTime2UT1DeltaBullB) < ERROR_TOL, "psTimeGetUT1Delta() produced the correct result: bulletin B"); 279 // diag("UT1 Delta %lf not as expected %lf test time 2 bulletin B", ut1Delta, testTime2UT1DeltaBullB); 281 282 ok_double_tol(ut1Delta, testTime2UT1DeltaBullB, ERROR_TOL, "psTimeGetUT1Delta() produced the correct result: bulletin B"); 283 280 284 psFree(time); 281 285 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 293 297 time->type = PS_TIME_UTC; 294 298 psF64 ut1Delta = psTimeGetUT1Delta(time,PS_IERS_A); 295 ok(fabs(ut1Delta - testTime3UT1DeltaBullA) < ERROR_TOL, "psTimeGetUT1Delta() produced the correct result: bulletin B"); 296 // diag("UT1 Delta %lf not as expected %lf test time 3 bulletin A", ut1Delta, testTime3UT1DeltaBullA); 299 300 ok_double_tol(ut1Delta, testTime3UT1DeltaBullA, ERROR_TOL, "psTimeGetUT1Delta() produced the correct result: bulletin B"); 301 297 302 psFree(time); 298 303 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 309 314 time->type = PS_TIME_UTC; 310 315 psF64 ut1Delta = psTimeGetUT1Delta(time,PS_IERS_B); 311 ok(fabs(ut1Delta - testTime3UT1DeltaBullB) < ERROR_TOL, "psTimeGetUT1Delta() produced the correct result: bulletin B"); 312 // diag("UT1 Delta %lf not as expected %lf test time 3 bulletin B", ut1Delta, testTime3UT1DeltaBullB); 316 317 ok_double_tol(ut1Delta, testTime3UT1DeltaBullB, ERROR_TOL, "psTimeGetUT1Delta() produced the correct result: bulletin B"); 318 313 319 psFree(time); 314 320 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 354 360 time->nsec = testTime1NanosecondsUTC; 355 361 psF64 mjd = psTimeToMJD(time); 356 ok(fabs(mjd - 53207.765929) < ERROR_TOL, "psTimeToMJD() returned correct time after 1/1/1970 epoch"); 357 // diag("Expected MJD = %lf not as expected %lf", mjd, testTime1MJD); 362 363 ok_double_tol(mjd, 53207.765929, ERROR_TOL, "psTimeToMJD() returned correct time after 1/1/1970 epoch"); 364 358 365 psFree(time); 359 366 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 368 375 time->nsec = testTime4NanosecondsUTC; 369 376 psF64 mjd = psTimeToMJD(time); 370 ok(fabs(mjd - testTime4MJD) < ERROR_TOL, "psTimeToMJD() returned correct time before 1/1/1970 epoch"); 371 // diag("Expected MJD = %lf not as expected %lf", mjd, testTime4MJD); 377 378 ok_double_tol(mjd, testTime4MJD, ERROR_TOL, "psTimeToMJD() returned correct time before 1/1/1970 epoch"); 379 372 380 psFree(time); 373 381 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 382 390 psMemId id = psMemGetId(); 383 391 psF64 jd = psTimeToJD(NULL); 392 384 393 ok(isnan(jd), "psTimeToJD(NULL) returned NULL"); 385 394 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 397 406 time->leapsecond = false; 398 407 psF64 jd = psTimeToJD(time); 408 399 409 ok(isnan(jd), "psTimeToJD() returned NAN for incorrect time"); 410 400 411 psFree(time); 401 412 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 411 422 time->nsec = testTime1NanosecondsUTC; 412 423 psF64 jd = psTimeToJD(time); 413 ok(fabs(jd - 2453208.265929) < ERROR_TOL, "psTimeToJD() returned the correct time after 1/1/1970 epoch"); 424 425 ok_double_tol(jd, 2453208.265929, ERROR_TOL, "psTimeToJD() returned the correct time after 1/1/1970 epoch"); 426 414 427 psFree(time); 415 428 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 425 438 time->nsec = testTime4NanosecondsUTC; 426 439 psF64 jd = psTimeToJD(time); 427 ok(fabs(jd - testTime4JD) < ERROR_TOL, "psTimeToJD() returned the correct time before 1/1/1970 epoch"); 440 441 ok_double_tol(jd, testTime4JD, ERROR_TOL, "psTimeToJD() returned the correct time before 1/1/1970 epoch"); 442 428 443 psFree(time); 429 444 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 438 453 psMemId id = psMemGetId(); 439 454 char *timeStr = psTimeToISO(NULL); 455 440 456 ok(timeStr == NULL, "psTimeToISO(NULL) returned NULL"); 457 441 458 psFree(timeStr); 442 459 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 454 471 time->nsec = 2e9; 455 472 char *timeStr = psTimeToISO(time); 473 456 474 ok(timeStr == NULL, "psTimeToISO(time) returned NULL for incorrect time"); 475 457 476 psFree(time); 458 477 psFree(timeStr); … … 471 490 time->nsec = testTime5NanosecondsUTC; 472 491 char *timeStr = psTimeToISO(time); 492 473 493 ok(timeStr == NULL, "psTimeToISO(time) returned NULL for time prior to year 0000"); 494 474 495 psFree(time); 475 496 psFree(timeStr); … … 506 527 time->nsec = testTime1NanosecondsUTC; 507 528 char *timeStr = psTimeToISO(time); 529 508 530 ok_str(timeStr, testTime1Str, "psTimeToISO(time) returned correct time (no leapsecond)"); 531 509 532 psFree(timeStr); 510 533 psFree(time); … … 523 546 time->leapsecond = true; 524 547 char *timeStr = psTimeToISO(time); 548 525 549 ok_str(timeStr, testTime1StrLeap, "psTimeToISO(time) returned correct time (with leapsecond)"); 550 526 551 psFree(timeStr); 527 552 psFree(time); … … 537 562 psMemId id = psMemGetId(); 538 563 struct timeval *timevalTime = psTimeToTimeval(NULL); 564 539 565 ok(timevalTime == NULL, "psTimeToTimeval(NULL) returned NULL"); 566 540 567 psFree(timevalTime); 541 568 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 553 580 time->nsec = 2e9; 554 581 struct timeval *timevalTime = psTimeToTimeval(time); 582 555 583 ok(timevalTime == NULL, "psTimeToTimeval() returned NULL for incorrect time"); 584 556 585 psFree(time); 557 586 psFree(timevalTime); … … 570 599 time->nsec = 0; 571 600 struct timeval *timevalTime = psTimeToTimeval(time); 601 572 602 ok(timevalTime == NULL, "psTimeToTimeval() returned NULL for incorrect time"); 603 573 604 psFree(time); 574 605 psFree(timevalTime); … … 586 617 time->nsec = testTime1NanosecondsUTC; 587 618 struct timeval *timevalTime = psTimeToTimeval(time); 588 ok(timevalTime->tv_sec == testTime1TimevalSec, "psTimeToTimeval() returned correct time"); 589 // diag("Timeval seconds %ld not as expectd %ld", timevalTime->tv_sec, testTime1TimevalSec);590 ok(timevalTime->tv_usec == testTime1TimevalUsec, "psTimeToTimeval() returned correct time");591 // diag("Timeval useconds %ld not as expected %ld", timevalTime->tv_usec, testTime1TimevalUsec); 619 620 is_long(timevalTime->tv_sec, testTime1TimevalSec, "psTimeToTimeval()->tv_sec"); 621 is_long(timevalTime->tv_usec, testTime1TimevalUsec, "psTimeToTimeval()->tv_usec"); 622 592 623 psFree(time); 593 624 psFree(timevalTime); … … 601 632 psMemId id = psMemGetId(); 602 633 psTime *time = psTimeFromMJD(testTime1MJDTAI); 634 603 635 ok(time->type == PS_TIME_TAI, "psTimeFromMJD() returned the correct type"); 604 ok(time->sec == testTime1SecondsTAI, "psTimeFromMJD() returned the correct ->sec"); 636 is_long(time->sec, testTime1SecondsTAI, "psTimeFromMJD()->sec"); 637 605 638 psFree(time); 606 639 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 613 646 psMemId id = psMemGetId(); 614 647 psTime *time = psTimeFromMJD(testTime4MJD); 648 615 649 ok(time->type == PS_TIME_TAI, "psTimeFromMJD() returned the correct type"); 616 ok(time->sec == testTime4SecondsUTC, "psTimeFromMJD() returned the correct ->sec"); 650 is_long(time->sec, testTime4SecondsUTC, "psTimeFromMJD()->sec"); 651 617 652 psFree(time); 618 653 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 622 657 // Test psTimeFromJD() 623 658 // Attempt to convert valid time to psTime 624 // XXX: This fails on the type test. Should it?625 659 { 626 660 psMemId id = psMemGetId(); 627 661 psTime *time = psTimeFromJD(testTime1JDTAI); 662 628 663 ok(time->type == PS_TIME_TAI, "psTimeFromJD() returned the correct type"); 629 ok(time->sec == testTime1SecondsTAI, "psTimeFromJD() returned the correct ->sec"); 664 is_long(time->sec, testTime1SecondsTAI, "psTimeFromJD()->sec"); 665 630 666 psFree(time); 631 667 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 635 671 // Test psTimeFromJD() 636 672 // Attempt to convert valid time before 1970 epoch 637 // XXX: This fails on the type test. Should it?638 673 { 639 674 psMemId id = psMemGetId(); 640 675 psTime *time = psTimeFromJD(testTime4JD); 641 is_int(time->type, PS_TIME_TAI, "psTimeFromJD() returned the correct type"); 642 is_int(time->sec, testTime4SecondsUTC, "psTimeFromJD() returned the correct ->sec"); 676 677 ok(time->type == PS_TIME_TAI, "psTimeFromJD() returned the correct type"); 678 is_long(time->sec, testTime4SecondsUTC, "psTimeFromJD() returned the correct ->sec"); 679 643 680 psFree(time); 644 681 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 649 686 // Attempt to convert NULL string 650 687 // Following should generate error message for NULL ISO string"); 651 // XXX: We don't test whether the error message is generated652 688 { 653 689 psMemId id = psMemGetId(); 654 690 psTime *time = psTimeFromISO(NULL, PS_TIME_TAI); 691 655 692 ok(time == NULL, "psTimeFromISO(NULL, PS_TIME_TAI) returned NULL"); 693 656 694 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 657 695 } … … 663 701 psMemId id = psMemGetId(); 664 702 psTime *time = psTimeFromISO(testTime1Str, PS_TIME_TAI); 703 665 704 ok(time->type == PS_TIME_TAI, "psTimeFromISO() returned the correct type"); 666 ok(time->sec == testTime1SecondsUTC, "psTimeFromISO() returned the correct ->sec"); 705 is_long(time->sec, testTime1SecondsUTC, "psTimeFromISO()->sec"); 706 667 707 psFree(time); 668 708 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 677 717 psMemId id = psMemGetId(); 678 718 psTime *time = psTimeFromISO("Here I am", PS_TIME_TAI); 719 679 720 ok(time == NULL, "psTimeFromISO() returned NULL for incorrect ISO string"); 721 680 722 psFree(time); 681 723 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 690 732 psMemId id = psMemGetId(); 691 733 psTime *time = psTimeFromTimeval(NULL); 734 692 735 ok(time == NULL, "psTimeFromTimeval(NULL) returned NULL"); 736 693 737 psFree(time); 694 738 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 704 748 timevalTime->tv_usec = testTime1NanosecondsTAI / 1000; 705 749 psTime *time = psTimeFromTimeval(timevalTime); 750 706 751 ok(time != NULL, "psTimeFromTimeval() returned NULL for correct timeval structure"); 707 752 skip_start(time == NULL, 3, "Skipping tests because psTimeFromTimeval() returned NULL"); 708 753 ok(time->type == PS_TIME_TAI, "psTimeFromTimeval() returned the correct type"); 709 ok(time->sec ==testTime1SecondsTAI, "psTimeFromTimeval() returned the correct ->sec");710 ok(time->nsec ==testTime1NanosecondsTAI, "psTimeFromTimeval() returned the correct ->nsec");754 is_long(time->sec, testTime1SecondsTAI, "psTimeFromTimeval() returned the correct ->sec"); 755 is_long(time->nsec, testTime1NanosecondsTAI, "psTimeFromTimeval() returned the correct ->nsec"); 711 756 skip_end(); 757 712 758 psFree(timevalTime); 713 759 psFree(time); … … 723 769 psMemId id = psMemGetId(); 724 770 psTime *time = psTimeFromTM(NULL); 771 725 772 ok(time == NULL, "psTimeFromTM(NULL) returned NULL"); 773 726 774 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 727 775 } … … 740 788 tmTime->tm_sec = testTime7TmSec; 741 789 psTime *time = psTimeFromTM(tmTime); 790 742 791 ok(time != NULL, "psTimeFromTM(NULL) returned non-NULL"); 743 792 skip_start(time == NULL, 2, "Skipping tests because psTimeFromTM() returned NULL"); 744 ok(time->sec ==testTime7Seconds, "psTimeFromTM() returned the correct ->sec");745 ok(time->nsec ==testTime7Nanoseconds, "psTimeFromTM() returned the correct ->nsec");793 is_long(time->sec, testTime7Seconds, "psTimeFromTM() returned the correct ->sec"); 794 is_long(time->nsec, testTime7Nanoseconds, "psTimeFromTM() returned the correct ->nsec"); 746 795 skip_end(); 796 747 797 psFree(tmTime); 748 798 psFree(time); … … 763 813 tmTime->tm_sec = testTime8TmSec; 764 814 psTime *time = psTimeFromTM(tmTime); 815 816 // XXX should test all fields here 765 817 ok(time != NULL, "psTimeFromTM(NULL) returned non-NULL"); 766 818 skip_start(time == NULL, 2, "Skipping tests because psTimeFromTM() returned NULL"); 767 ok(time->sec == testTime8Seconds, "psTimeFromTM() returned the correct ->sec"); 768 ok(time->nsec == testTime8Nanoseconds, "psTimeFromTM() returned the correct ->nsec"); 819 is_long(time->sec, testTime8Seconds, "psTimeFromTM() returned the correct ->sec"); 820 is_long(time->nsec, testTime8Nanoseconds, "psTimeFromTM() returned the correct ->nsec"); 821 skip_end(); 822 769 823 psFree(tmTime); 770 824 psFree(time); 771 skip_end();772 825 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 773 826 } … … 781 834 psMemId id = psMemGetId(); 782 835 psTime *time2 = psTimeConvert(NULL, PS_TIME_TAI); 836 783 837 ok(time2 == NULL, "psTimeConvert(NULL, PS_TIME_TAI) returned NULL"); 784 838 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 839 785 840 psFree(time2); 786 841 } … … 795 850 psTime *time1 = psTimeAlloc(PS_TIME_TAI); 796 851 psTime *time2 = psTimeConvert(time1,-100); 852 797 853 ok(time2 == NULL, "psTimeConvert(time1, -100) returned NULL"); 798 psFree(time1); 799 psFree(time 2);854 855 psFree(time1); 800 856 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 801 857 } … … 810 866 time1->type = PS_TIME_UTC; 811 867 psTime *time2 = psTimeConvert(time1,-100); 868 812 869 ok(time2 == NULL, "psTimeConvert(time1, -100) returned NULL"); 813 psFree(time1); 814 psFree(time 2);870 871 psFree(time1); 815 872 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 816 873 } … … 825 882 time1->type = PS_TIME_TT; 826 883 psTime *time2 = psTimeConvert(time1,-100); 884 827 885 ok(time2 == NULL, "psTimeConvert(time1, -100) returned NULL"); 828 psFree(time1); 829 psFree(time 2);886 887 psFree(time1); 830 888 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 831 889 } … … 840 898 time1->type = -100; 841 899 psTime *time2 = psTimeConvert(time1,PS_TIME_TAI); 900 842 901 ok(time2 == NULL, "psTimeConvert(time1, PS_TIME_TAI) returned NULL"); 843 psFree(time1); 844 psFree(time 2);902 903 psFree(time1); 845 904 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 846 905 } … … 851 910 // Following should generate an error message for incorrect time 852 911 // XXX: We don't test whether the error message is generated 853 // XXX: This generates memory errors and aborts, so I if'ed it out 854 if (0) { 912 { 855 913 psMemId id = psMemGetId(); 856 914 psTime *time1 = psTimeAlloc(PS_TIME_TAI); 857 915 time1->nsec = 2e9; 858 psTime *time2 = psTimeConvert(time1,PS_TIME_TAI); 859 ok(time2 == time1, "psTimeConvert(time1, PS_TIME_TAI) didn't return time1 for incorrect time"); 860 psFree(time1); 861 psFree(time2); 916 psTime *time2 = psTimeConvert(time1, PS_TIME_TAI); 917 918 ok(time2 == NULL, "psTimeConvert(time1, PS_TIME_TAI) returns NULL for incorrect psTime object"); 919 920 psFree(time1); 862 921 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 863 922 } … … 866 925 // psTimeConvert() 867 926 //Attempt to convert a time to the same type 868 // XXX: This generates memory errors and aborts, so I if'ed it out 869 if (0) { 927 { 870 928 psMemId id = psMemGetId(); 871 929 psTime *time1 = psTimeAlloc(PS_TIME_TAI); … … 874 932 time1->type = PS_TIME_TAI; 875 933 time1->leapsecond = false; 876 psTime *time2 = psTimeConvert(time1,PS_TIME_TAI); 877 ok(time2 == time1, "psTimeConvert() returned time for conversion to same type"); 878 ok((time2->sec == 1) && (time2->nsec == 2) && (time2->type == PS_TIME_TAI) && 879 (time2->leapsecond == false), "There were no time member changes when no change expected"); 880 psFree(time1); 881 psFree(time2); 934 935 psTime *time2 = psTimeConvert(time1, PS_TIME_TAI); 936 ok(time2 == time1, "psTimeConvert(time, ...) returns time for conversion to same type"); 937 is_long(time2->sec, 1, "time->sec"); 938 is_long(time2->nsec, 2, "time->nsec"); 939 ok(time2->type == PS_TIME_TAI, "time->type"); 940 is_bool(time2->leapsecond, false, "time->leapsecond"); 941 942 psFree(time1); 882 943 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 883 944 } … … 886 947 // psTimeConvert() 887 948 // Attempt to convert a UTC time to a TAI 888 // XXX: This generates memory errors and aborts, so I if'ed it out 889 if (0) { 890 psMemId id = psMemGetId(); 891 psTime *time1 = psTimeAlloc(PS_TIME_TAI); 949 { 950 psMemId id = psMemGetId(); 951 psTime *time1 = psTimeAlloc(PS_TIME_UTC); 892 952 time1->sec = testTime1SecondsUTC; 893 953 time1->nsec = testTime1NanosecondsUTC; 894 time1->type = PS_TIME_UTC;895 954 time1->leapsecond = false; 955 896 956 psTime *time2 = psTimeConvert(time1,PS_TIME_TAI); 897 ok(time2 == time1, "psTimeConvert() returned time for conversion to same type"); 957 ok(time2 == time1, "psTimeConvert(time, ...) returns time after conversion to a different type"); 958 is_long(time2->sec, testTime1SecondsTAI, "psTimeConvert() returned the correct ->sec"); 959 is_long(time2->nsec, testTime1NanosecondsTAI, "psTimeConvert() returned the correct ->nsec"); 898 960 ok(time2->type == PS_TIME_TAI, "psTimeConvert() returned the correct type"); 899 ok(time2->sec == testTime1SecondsTAI, "psTimeConvert() returned the correct ->sec"); 900 ok(time2->nsec == testTime1NanosecondsTAI, "psTimeConvert() returned the correct ->nsec"); 901 psFree(time1); 902 psFree(time2); 961 is_bool(time2->leapsecond, false, "time->leapsecond"); 962 963 psFree(time1); 903 964 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 904 965 } … … 907 968 // psTimeConvert() 908 969 // Attempt to convert a UTC time to a TT 909 // XXX: This generates memory errors and aborts, so I if'ed it out 910 if (0) { 911 psMemId id = psMemGetId(); 912 psTime *time1 = psTimeAlloc(PS_TIME_TAI); 970 { 971 psMemId id = psMemGetId(); 972 psTime *time1 = psTimeAlloc(PS_TIME_UTC); 913 973 time1->sec = testTime1SecondsUTC; 914 974 time1->nsec = testTime1NanosecondsUTC; 915 time1->type = PS_TIME_UTC;916 975 time1->leapsecond = false; 976 917 977 psTime *time2 = psTimeConvert(time1,PS_TIME_TT); 918 ok(time2 == time1, "psTimeConvert() returned time for conversion to same type"); 978 ok(time2 == time1, "psTimeConvert(time, ...) returns time after conversion to a different type"); 979 is_long(time2->sec, testTime1SecondsTT, "psTimeConvert() returned the correct ->sec"); 980 is_long(time2->nsec, testTime1NanosecondsTT, "psTimeConvert() returned the correct ->nsec"); 919 981 ok(time2->type == PS_TIME_TT, "psTimeConvert() returned the correct type"); 920 ok(time2->sec == testTime1SecondsTT, "psTimeConvert() returned the correct ->sec"); 921 ok(time2->nsec == testTime1NanosecondsTT, "psTimeConvert() returned the correct ->nsec"); 922 psFree(time1); 923 psFree(time2); 982 is_bool(time2->leapsecond, false, "time->leapsecond"); 983 984 psFree(time1); 924 985 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 925 986 } … … 928 989 // psTimeConvert() 929 990 // Attempt to convert a UTC time to UT1 930 // XXX: This generates memory errors and aborts, so I if'ed it out 931 if (0) { 932 psMemId id = psMemGetId(); 933 psTime *time1 = psTimeAlloc(PS_TIME_TAI); 991 { 992 psMemId id = psMemGetId(); 993 psTime *time1 = psTimeAlloc(PS_TIME_UTC); 934 994 time1->sec = testTime1SecondsUTC; 935 995 time1->nsec = testTime1NanosecondsUTC; 936 time1->type = PS_TIME_UTC;937 996 time1->leapsecond = false; 997 938 998 psTime *time2 = psTimeConvert(time1,PS_TIME_UT1); 939 ok(time1 == time2, "psTimeConvert() returned time for conversion to same type"); 999 ok(time2 == time1, "psTimeConvert(time, ...) returns time after conversion to a different type"); 1000 is_long(time2->sec, testTime1SecondsUT1, "psTimeConvert() returned the correct ->sec"); 1001 is_long(time2->nsec, testTime1NanosecondsUT1, "psTimeConvert() returned the correct ->nsec"); 940 1002 ok(time2->type == PS_TIME_UT1, "psTimeConvert() returned the correct type"); 941 ok(time2->sec == testTime1SecondsUT1, "psTimeConvert() returned the correct ->sec"); 942 ok(time2->nsec == testTime1NanosecondsUT1, "psTimeConvert() returned the correct ->nsec"); 943 psFree(time1); 944 psFree(time2); 1003 is_bool(time2->leapsecond, false, "time->leapsecond"); 1004 1005 psFree(time1); 945 1006 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 946 1007 } … … 948 1009 // psTimeConvert() 949 1010 // Attempt to convert a TAI time to UTC 950 // XXX: This generates memory errors and aborts, so I if'ed it out 951 if (0) { 1011 { 1012 psMemId id = psMemGetId(); 1013 psTime *time1 = psTimeAlloc(PS_TIME_TAI); 1014 time1->sec = testTime1SecondsTAI; 1015 time1->nsec = testTime1NanosecondsTAI; 1016 time1->leapsecond = false; 1017 1018 psTime *time2 = psTimeConvert(time1,PS_TIME_UTC); 1019 ok(time2 == time1, "psTimeConvert(time, ...) returns time after conversion to a different type"); 1020 is_long(time2->sec, testTime1SecondsUTC, "psTimeConvert() returned the correct ->sec"); 1021 is_long(time2->nsec, testTime1NanosecondsUTC, "psTimeConvert() returned the correct ->nsec"); 1022 ok(time2->type == PS_TIME_UTC, "psTimeConvert() returned the correct type"); 1023 is_bool(time2->leapsecond, false, "time->leapsecond"); 1024 1025 psFree(time1); 1026 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 1027 } 1028 1029 1030 // psTimeConvert() 1031 // Attempt to convert a TAI time to TT 1032 { 952 1033 psMemId id = psMemGetId(); 953 1034 psTime *time1 = psTimeAlloc(PS_TIME_TAI); … … 956 1037 time1->type = PS_TIME_TAI; 957 1038 time1->leapsecond = false; 958 psTime *time2 = psTimeConvert(time1,PS_TIME_UTC); 1039 1040 psTime *time2 = psTimeConvert(time1,PS_TIME_TT); 959 1041 ok(time2 == time1, "psTimeConvert() returned time for conversion to same type"); 960 ok(time2->type == PS_TIME_UTC, "psTimeConvert() returned the correct type");961 ok(time2->sec == testTime1SecondsUTC, "psTimeConvert() returned the correct ->sec");962 ok(time2-> nsec == testTime1NanosecondsUTC, "psTimeConvert() returned the correct ->nsec");963 psFree(time1);964 psFree(time2); 965 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");966 }967 968 969 // psTimeConvert() 970 // Attempt to convert a TAI time to TT971 // XXX: This generates memory errors and aborts, so I if'ed it out972 if (0){1042 is_long(time2->sec, testTime1SecondsTT, "psTimeConvert() returned the correct ->sec"); 1043 is_long(time2->nsec, testTime1NanosecondsTT, "psTimeConvert() returned the correct ->nsec"); 1044 ok(time2->type == PS_TIME_TT, "psTimeConvert() returned the correct type"); 1045 is_bool(time2->leapsecond, false, "time->leapsecond"); 1046 1047 psFree(time1); 1048 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 1049 } 1050 1051 1052 // psTimeConvert() 1053 // Attempt to convert a TAI time to UT1 1054 { 973 1055 psMemId id = psMemGetId(); 974 1056 psTime *time1 = psTimeAlloc(PS_TIME_TAI); 975 1057 time1->sec = testTime1SecondsTAI; 976 1058 time1->nsec = testTime1NanosecondsTAI; 977 time1->type = PS_TIME_TAI;978 1059 time1->leapsecond = false; 979 psTime *time2 = psTimeConvert(time1,PS_TIME_TT); 980 ok(time2 == time1, "psTimeConvert() returned time for conversion to same type"); 981 ok(time2->type == PS_TIME_TT, "psTimeConvert() returned the correct type"); 982 ok(time2->sec == testTime1SecondsTT, "psTimeConvert() returned the correct ->sec"); 983 ok(time2->nsec == testTime1NanosecondsTT, "psTimeConvert() returned the correct ->nsec"); 984 psFree(time1); 985 psFree(time2); 986 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 987 } 988 989 990 // psTimeConvert() 991 // Attempt to convert a TAI time to UT1 992 // XXX: This generates memory errors and aborts, so I if'ed it out 993 if (0) { 994 psMemId id = psMemGetId(); 995 psTime *time1 = psTimeAlloc(PS_TIME_TAI); 996 time1->sec = testTime1SecondsTAI; 997 time1->nsec = testTime1NanosecondsTAI; 998 time1->type = PS_TIME_TAI; 999 time1->leapsecond = false; 1060 1000 1061 psTime *time2 = psTimeConvert(time1,PS_TIME_UT1); 1001 1062 ok(time1 == time2, "psTimeConvert() returned time for conversion to same type"); 1063 is_long(time2->sec, testTime1SecondsUT1, "psTimeConvert() returned the correct ->sec"); 1064 is_long(time2->nsec, testTime1NanosecondsUT1, "psTimeConvert() returned the correct ->nsec"); 1002 1065 ok(time2->type == PS_TIME_UT1, "psTimeConvert() returned the correct type"); 1003 ok(time2->sec == testTime1SecondsUT1, "psTimeConvert() returned the correct ->sec"); 1004 ok(time2->nsec == testTime1NanosecondsUT1, "psTimeConvert() returned the correct ->nsec"); 1005 psFree(time1); 1006 psFree(time2); 1066 is_bool(time2->leapsecond, false, "time->leapsecond"); 1067 1068 psFree(time1); 1007 1069 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 1008 1070 } … … 1011 1073 // psTimeConvert() 1012 1074 // Attempt to convert a TT time to UTC 1013 // XXX: This generates memory errors and aborts, so I if'ed it out 1014 if (0) { 1015 psMemId id = psMemGetId(); 1016 psTime *time1 = psTimeAlloc(PS_TIME_TAI); 1075 { 1076 psMemId id = psMemGetId(); 1077 psTime *time1 = psTimeAlloc(PS_TIME_TT); 1017 1078 time1->sec = testTime1SecondsTT; 1018 1079 time1->nsec = testTime1NanosecondsTT; 1019 time1->type = PS_TIME_TT;1020 1080 time1->leapsecond = false; 1081 1021 1082 psTime *time2 = psTimeConvert(time1,PS_TIME_UTC); 1022 1083 ok(time2 == time1, "psTimeConvert() returned time for conversion to same type"); 1084 is_long(time2->sec, testTime1SecondsUTC, "psTimeConvert() returned the correct ->sec"); 1085 is_long(time2->nsec, testTime1NanosecondsUTC, "psTimeConvert() returned the correct ->nsec"); 1023 1086 ok(time2->type == PS_TIME_UTC, "psTimeConvert() returned the correct type"); 1024 ok(time2->sec == testTime1SecondsUTC, "psTimeConvert() returned the correct ->sec"); 1025 ok(time2->nsec == testTime1NanosecondsUTC, "psTimeConvert() returned the correct ->nsec"); 1026 psFree(time1); 1027 psFree(time2); 1087 is_bool(time2->leapsecond, false, "time->leapsecond"); 1088 1089 psFree(time1); 1028 1090 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 1029 1091 } … … 1032 1094 // psTimeConvert() 1033 1095 // Attempt to convert a TT time to TAI 1034 // XXX: This generates memory errors and aborts, so I if'ed it out 1035 if (0) { 1036 psMemId id = psMemGetId(); 1037 psTime *time1 = psTimeAlloc(PS_TIME_TAI); 1096 { 1097 psMemId id = psMemGetId(); 1098 psTime *time1 = psTimeAlloc(PS_TIME_TT); 1038 1099 time1->sec = testTime1SecondsTT; 1039 1100 time1->nsec = testTime1NanosecondsTT; 1040 time1->type = PS_TIME_TT;1041 1101 time1->leapsecond = false; 1102 1042 1103 psTime *time2 = psTimeConvert(time1,PS_TIME_TAI); 1043 1104 ok(time2 == time1, "psTimeConvert() returned time for conversion to same type"); 1105 is_long(time2->sec, testTime1SecondsTAI, "psTimeConvert() returned the correct ->sec"); 1106 is_long(time2->nsec, testTime1NanosecondsTAI, "psTimeConvert() returned the correct ->nsec"); 1044 1107 ok(time2->type == PS_TIME_TAI, "psTimeConvert() returned the correct type"); 1045 ok(time2->sec == testTime1SecondsTAI, "psTimeConvert() returned the correct ->sec"); 1046 ok(time2->nsec == testTime1NanosecondsTAI, "psTimeConvert() returned the correct ->nsec"); 1047 psFree(time1); 1048 psFree(time2); 1108 is_bool(time2->leapsecond, false, "time->leapsecond"); 1109 1110 psFree(time1); 1049 1111 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 1050 1112 } … … 1053 1115 // psTimeConvert() 1054 1116 // Attempt to convert a TT time to UT1 1055 // XXX: This generates memory errors and aborts, so I if'ed it out 1056 if (0) { 1057 psMemId id = psMemGetId(); 1058 psTime *time1 = psTimeAlloc(PS_TIME_TAI); 1117 { 1118 psMemId id = psMemGetId(); 1119 psTime *time1 = psTimeAlloc(PS_TIME_TT); 1059 1120 time1->sec = testTime1SecondsTT; 1060 1121 time1->nsec = testTime1NanosecondsTT; 1061 time1->type = PS_TIME_TT;1062 1122 time1->leapsecond = false; 1123 1063 1124 psTime *time2 = psTimeConvert(time1,PS_TIME_UT1); 1064 1125 ok(time1 == time2, "psTimeConvert() returned time for conversion to same type"); 1126 is_long(time2->sec, testTime1SecondsUT1, "psTimeConvert() returned the correct ->sec"); 1127 is_long(time2->nsec, testTime1NanosecondsUT1, "psTimeConvert() returned the correct ->nsec"); 1065 1128 ok(time2->type == PS_TIME_UT1, "psTimeConvert() returned the correct type"); 1066 ok(time2->sec == testTime1SecondsUT1, "psTimeConvert() returned the correct ->sec"); 1067 ok(time2->nsec == testTime1NanosecondsUT1, "psTimeConvert() returned the correct ->nsec"); 1068 psFree(time1); 1069 psFree(time2); 1129 is_bool(time2->leapsecond, false, "time->leapsecond"); 1130 1131 psFree(time1); 1070 1132 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 1071 1133 } … … 1077 1139 { 1078 1140 psMemId id = psMemGetId(); 1079 psTime *time1 = psTimeAlloc(PS_TIME_ TAI);1141 psTime *time1 = psTimeAlloc(PS_TIME_UT1); 1080 1142 time1->sec = 1; 1081 1143 time1->nsec = 2; 1082 time1->type = PS_TIME_UT1;1083 1144 time1->leapsecond = false; 1145 1084 1146 psTime *time2 = psTimeConvert(time1, PS_TIME_UTC); 1085 1147 ok(time2 == NULL, "psTimeConvert() returned NULL for conversion from UT1");
Note:
See TracChangeset
for help on using the changeset viewer.
