Changeset 1615 for trunk/psLib/test/astronomy/tst_psTime_02.c
- Timestamp:
- Aug 24, 2004, 3:38:48 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/astronomy/tst_psTime_02.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/astronomy/tst_psTime_02.c
r1406 r1615 4 4 * 5 5 * 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 12 8 * 13 9 * @author Ross Harman, MHPCC 14 10 * 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 $ 17 13 * 18 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 25 21 int main(int argc, char* argv[]) 26 22 { 27 psTime testTime;28 struct timeval timevalTime;29 23 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 76 25 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"); 84 32 printFooter(stdout, "psTime", "Incorrect ISO time data", true); 85 33 86 34 87 // Test E- Attempt to use null timeval35 // Test B - Attempt to use null timeval 88 36 printNegativeTestHeader(stdout,"psTime", "Attempt to use null timeval", 89 37 "Null value for timeval arg not allowed", 0); … … 91 39 printFooter(stdout, "psTime", "Attempt to use null timeval", true); 92 40 93 94 // Test F - Incorrect timeval time data95 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 121 41 return 0; 122 42 }
Note:
See TracChangeset
for help on using the changeset viewer.
