58 TestUtil testFramework(
"TimeConverters",
"convertJDtoCalendar", __FILE__, __LINE__ );
61 int inputJD[8] = {2453971, 2299159, 2342032, 2377095, 1721118, 1721424, 1648549, 1719657};
62 int expectedYear[8] = { 2006, 1582, 1700, 1796, -1, 1, -200, -5};
63 int expectedMonth[8] = { 8, 10, 3, 2, 3, 1, 6, 3};
64 int expectedDay[8] = { 23, 3, 1, 29, 1, 1, 25, 1};
67 for (
int i = 0; i < 8; i++)
73 testFramework.
assert(expectedYear[i] ==
year ,
"The year from the JD conversion was not correct", __LINE__);
74 testFramework.
assert(expectedMonth[i] ==
month,
"The month from the JD conversion was not correct", __LINE__);
75 testFramework.
assert(expectedDay[i] ==
day ,
"The day from the JD conversion was not correct", __LINE__);
87 TestUtil testFramework(
"TimeConverters",
"convertCalendarToJD", __FILE__, __LINE__ );
91 int expectedJD[8] = {2453971, 2299159, 2342032, 2377095, 1721118, 1721424, 1648549, 1719657};
92 int inputYear[8] = { 2006, 1582, 1700, 1796, -1, 1, -200, -5};
93 int inputMonth[8] = { 8, 10, 3, 2, 3, 1, 6, 3};
94 int inputDay[8] = { 23, 3, 1, 29, 1, 1, 25, 1};
96 for (
int i = 0 ; i < 8; i++)
102 testFramework.
assert(expectedJD[i] == JD,
"The JD found from the calendar-JD conversion was not correct", __LINE__);
114 TestUtil testFramework(
"TimeConverters",
"convertSODToTime", __FILE__, __LINE__ );
119 double second, relativeError;
120 double inputSOD[3] = { -0.1, 86401.11, 12345.67};
121 int expectedHour[3] = { 23, 0, 3};
122 int expectedMinute[3] = { 59, 0, 25};
123 double expectedSecond[3] = { 59.9, 1.11, 45.67};
125 for (
int i = 0 ; i < 3; i++)
131 relativeError = fabs(expectedSecond[i]-
second)/fabs(expectedSecond[i]);
132 testFramework.
assert(expectedHour[i] ==
hour ,
"The SOD to Time conversion found an incorrect hour" , __LINE__ );
133 testFramework.
assert(expectedMinute[i] ==
minute,
"The SOD to Time conversion found an incorrect minute", __LINE__ );
134 testFramework.
assert(relativeError < eps ,
"The SOD to Time conversion found an incorrect second", __LINE__ );
148 TestUtil testFramework(
"TimeConverters",
"convertTimeToSOD", __FILE__, __LINE__ );
150 double second, SOD, relativeError;;
151 double expectedSOD[3] = {4230.5, 86399.99, 12345.67};
152 int inputHour[3] = { 1, 23, 3};
153 int inputMinute[3] = { 10, 59, 25};
154 double inputSecond[3] = { 30.5, 59.99, 45.67};
156 for (
int i = 0 ; i < 3; i++)
162 relativeError = fabs(expectedSOD[i]-SOD)/fabs(expectedSOD[i]);
163 testFramework.
assert(relativeError < eps,
"The Time to SOD conversion found an incorrect SOD", __LINE__ );
174 int check, errorCounter = 0;
178 errorCounter += check;
181 errorCounter += check;
184 errorCounter += check;
187 errorCounter += check;
189 std::cout <<
"Total Errors for " << __FILE__<<
": "<< errorCounter << std::endl;