IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 24, 2004, 3:38:48 PM (22 years ago)
Author:
harman
Message:

Updated psTime for new version of SDRS

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/astronomy/tst_psTime_02.c

    r1406 r1615  
    44 *
    55 *  This test driver contains the following tests for psTime:
    6  *     A) Attempt to use negative seconds
    7  *     B) Attempt to use negative microseconds
    8  *     C) Attempt to use negative time
    9  *     D) Incorrect ISO time data
    10  *     E) Attempt to use null timeval
    11  *     F) Incorrect timeval time data
     6 *     A) Incorrect ISO time data
     7 *     B) Attempt to use null timeval
    128 *
    139 *  @author  Ross Harman, MHPCC
    1410 *
    15  *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
    16  *  @date  $Date: 2004-08-06 22:34:05 $
     11 *  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
     12 *  @date  $Date: 2004-08-25 01:38:48 $
    1713 *
    1814 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2521int main(int argc, char* argv[])
    2622{
    27     psTime testTime;
    28     struct timeval timevalTime;
    2923
    30 
    31     // Test A - Attempt to use negative seconds
    32     testTime.tv_sec = -1;
    33     testTime.tv_usec = 1;
    34     timevalTime.tv_sec = -1;
    35     timevalTime.tv_usec = 1;
    36     printNegativeTestHeader(stdout,"psTime", "Attempt to use negative seconds",
    37                             "Negative seconds are not allowed: -1", 0);
    38     psTimeToISO(testTime);
    39     psTimeToUTC(testTime);
    40     psUTCToTime(testTime);
    41     psTimeToMJD(testTime);
    42     psTimeToJD(testTime);
    43     psTimeToTimeval(testTime);
    44     psTimevalToTime(&timevalTime);
    45     psTimeToTM(testTime);
    46     printFooter(stdout, "psTime", "Attempt to use negative seconds", true);
    47 
    48 
    49     // Test B - Attempt to use negative microseconds
    50     testTime.tv_sec = 1;
    51     testTime.tv_usec = -1;
    52     timevalTime.tv_sec = 1;
    53     timevalTime.tv_usec = -1;
    54     printNegativeTestHeader(stdout,"psTime", "Attempt to use negative microseconds",
    55                             "Negative microseconds are not allowed: -1", 0);
    56     psTimeToISO(testTime);
    57     psTimeToUTC(testTime);
    58     psUTCToTime(testTime);
    59     psTimeToMJD(testTime);
    60     psTimeToJD(testTime);
    61     psTimeToTimeval(testTime);
    62     psTimevalToTime(&timevalTime);
    63     psTimeToTM(testTime);
    64     printFooter(stdout, "psTime", "Attempt to use negative microseconds", true);
    65 
    66 
    67     // Test C - Attempt to use negative time
    68     printNegativeTestHeader(stdout,"psTime", "Attempt to use negative time",
    69                             "Negative time is not allowed: -1.000000", 0);
    70     psJDToTime(-1.0);
    71     psMJDToTime(-1.0);
    72     printFooter(stdout, "psTime", "Attempt to use negative time", true);
    73 
    74 
    75     // Test D - Incorrect ISO time data
     24    // Test A - Incorrect ISO time data
    7625    printNegativeTestHeader(stdout,"psTime", "Incorrect ISO time data", "Time not allowed", 0);
    77     psISOToTime("1800/2/2,12:12:12.122");
    78     psISOToTime("2004/-2/2,12:12:12.122");
    79     psISOToTime("2004/2/-2,12:12:12.122");
    80     psISOToTime("2004/2/2,-12:12:12.122");
    81     psISOToTime("2004/2/2,12:-12:12.122");
    82     psISOToTime("2004/2/2,12:12:-12.122");
    83     psISOToTime("2004/2/2,12:12:12.-122");
     26    psISOToTime("2004-99-21T18:22:24.272Z");
     27    psISOToTime("2004-07-99T18:22:24.272Z");
     28    psISOToTime("2004-07-21T99:22:24.272Z");
     29    psISOToTime("2004-07-21T18:99:24.272Z");
     30    psISOToTime("2004-07-21T18:22:99.272Z");
     31    psISOToTime("2004-07-21T18:22:24.-999Z");
    8432    printFooter(stdout, "psTime", "Incorrect ISO time data", true);
    8533
    8634
    87     // Test E - Attempt to use null timeval
     35    // Test B - Attempt to use null timeval
    8836    printNegativeTestHeader(stdout,"psTime", "Attempt to use null timeval",
    8937                            "Null value for timeval arg not allowed", 0);
     
    9139    printFooter(stdout, "psTime", "Attempt to use null timeval", true);
    9240
    93 
    94     // Test F - Incorrect timeval time data
    95     printNegativeTestHeader(stdout,"psTime", "Incorrect timeval time data", "Time not allowed", 0);
    96     struct tm tmTime;
    97     tmTime.tm_year = -2;
    98     tmTime.tm_mon  = 2;
    99     tmTime.tm_mday = 2;
    100     tmTime.tm_hour = 2;
    101     tmTime.tm_min  = 2;
    102     tmTime.tm_sec  = 2;
    103     psTMToTime(&tmTime);
    104     tmTime.tm_year = 100;
    105     tmTime.tm_mon  = -2;
    106     psTMToTime(&tmTime);
    107     tmTime.tm_mon  = 2;
    108     tmTime.tm_mday = -2;
    109     psTMToTime(&tmTime);
    110     tmTime.tm_hour = -2;
    111     tmTime.tm_mday = 2;
    112     psTMToTime(&tmTime);
    113     tmTime.tm_hour = 2;
    114     tmTime.tm_min = -2;
    115     psTMToTime(&tmTime);
    116     tmTime.tm_min = 2;
    117     tmTime.tm_sec = -2;
    118     psTMToTime(&tmTime);
    119     printFooter(stdout, "psTime", "Incorrect timeval time data", true);
    120 
    12141    return 0;
    12242}
Note: See TracChangeset for help on using the changeset viewer.