58 TestUtil testFramework(
"MJD",
"Constructor", __FILE__, __LINE__ );
66 testFramework.
assert(fabs((
long double)135000.0 - Compare.
mjd) < eps,
"Explicit constructor did not set the mjd value properly", __LINE__);
75 testFramework.
assert(fabs((
long double)135000. - Copy.
mjd) < eps,
"Copy constructor did not set the mjd value properly", __LINE__);
85 testFramework.
assert(fabs((
long double)135000. - Assigned.
mjd) < eps,
"Set Operator did not set the mjd value properly", __LINE__);
98 TestUtil testFramework(
"MJD",
"setFromInfo", __FILE__, __LINE__ );
105 Id[
'Q'] =
"135000.0";
110 testFramework.
assert(setFromInfo1.
setFromInfo(Id),
"setFromInfo experienced an error and returned false", __LINE__);
111 testFramework.
assert(Compare == setFromInfo1,
"setFromInfo did not set all of the values properly", __LINE__);
118 testFramework.
assert(setFromInfo2.
setFromInfo(Id),
"setFromInfo experienced an error and returned false", __LINE__);
119 testFramework.
assert(Compare2 == setFromInfo2,
"setFromInfo did not set all of the values properly", __LINE__);
131 TestUtil testFramework(
"MJD",
"OperatorEquivalent", __FILE__, __LINE__ );
141 testFramework.
assert( Compare == CompareCopy,
"Equivalence operator found equivalent objects to be not equivalent", __LINE__);
142 testFramework.
assert(!(Compare == LessThanMJD),
"Equivalence operator found different mjd objects to be equivalent", __LINE__);
149 testFramework.
assert( Compare != LessThanMJD,
"Not-equal operator found different mjd objects to be equivalent", __LINE__);
150 testFramework.
assert(!(Compare != Compare),
"Not-equal operator found equivalent objects to not be equivalent", __LINE__);
157 testFramework.
assert( LessThanMJD < Compare,
"Less-than operator found less-than mjd object to not be less than", __LINE__);
158 testFramework.
assert(!(Compare < LessThanMJD),
"Less-than operator found greater-than mjd object to be less than", __LINE__);
159 testFramework.
assert(!(Compare < CompareCopy),
"Less-than operator found equivalent object to be less than", __LINE__);
166 testFramework.
assert(!(LessThanMJD > Compare),
"Greater-than operator found less-than mjd object to be greater than", __LINE__);
167 testFramework.
assert( Compare > LessThanMJD,
"Greater-than operator found greater-than mjd object to not be greater than", __LINE__);
168 testFramework.
assert(!(Compare > CompareCopy),
"Greater-than operator found equivalent object to be greater than", __LINE__);
175 testFramework.
assert( LessThanMJD <= Compare,
"Less-than-or-equal-to operator found less-than mjd object to not be less than or equal to", __LINE__);
176 testFramework.
assert(!(Compare <= LessThanMJD),
"Less-than-or-equal-to operator found greater-than mjd object to be less than or equal to", __LINE__);
177 testFramework.
assert( Compare <= CompareCopy,
"Less-than-or-equal-to operator found equivalent object to not be less than or equal to", __LINE__);
184 testFramework.
assert(!(LessThanMJD >= Compare),
"Greater-than-or-equal-to operator found less-than mjd object to be greater than or equal to", __LINE__);
185 testFramework.
assert( Compare >= LessThanMJD,
"Greater-than-or-equal-to operator found greater-than mjd object to not be greater than or equal to", __LINE__);
186 testFramework.
assert( Compare >= CompareCopy,
"Greater-than-or-equal-to operator found equivalent object to not be greater than or equal to", __LINE__);
197 TestUtil testFramework(
"MJD",
"reset", __FILE__, __LINE__ );
207 testFramework.
assert(Compare.
mjd==0,
"reset() did not set the mjd value to 0", __LINE__);
219 TestUtil testFramework(
"MJD",
"isValid", __FILE__, __LINE__ );
233 testFramework.
assert(Compare.
isValid(),
"Time provided found to be unable to convert to/from CommonTime", __LINE__);
245 testFramework.
assert(Compare.
getTimeSystem()== Test2.
getTimeSystem(),
"TimeSystem provided found to be different after converting to and from CommonTime", __LINE__);
246 testFramework.
assert(fabs(Test2.
mjd - Compare.
mjd) < eps,
"MJD provided found to be different after converting to and from CommonTime", __LINE__);
257 TestUtil testFramework(
"MJD",
"OperatorEquivalentWithDifferingTimeSystem", __FILE__, __LINE__ );
271 testFramework.
assert(!(GPS1 == UTC1),
"Equivalence operator found objects with differing TimeSystems to be the same", __LINE__);
272 testFramework.
assert(GPS1 == ANY,
"Differing TimeSystems where one is TimeSystem::Any is not ignored for equals", __LINE__);
273 testFramework.
assert(UTC1 == ANY,
"Differing TimeSystems where one is TimeSystem::Any is not ignored for equals", __LINE__);
274 testFramework.
assert(UNKNOWN == ANY,
"Differing TimeSystems where one is TimeSystem::Any is not ignored for equals", __LINE__);
280 testFramework.
assert(GPS1 != UTC1,
"Equivalent objects with differing TimeSystems are found to be equal", __LINE__);
281 testFramework.
assert(GPS1 != UNKNOWN,
"Equivalent objects with differing TimeSystems are found to be equal", __LINE__);
282 testFramework.
assert(!(GPS1 != ANY),
"Equivalent objects with differing TimeSystems where one is TimeSystem::Any are found to be not-equal", __LINE__);
288 testFramework.
assert(ANY2 < GPS1,
"Less than object with Any TimeSystem is not found to be less than", __LINE__);
289 testFramework.
assert(GPS2 < ANY,
"Less than object with GPS TimeSystem is not found to be less-than a greater object with Any TimeSystem", __LINE__);
307 TestUtil testFramework(
"MJD",
"printf", __FILE__, __LINE__ );
316 testFramework.
assert(GPS1.
printf(
"%08Q %02P") == (std::string)
"135000.000000 GPS",
"printf did not output in the proper format", __LINE__);
317 testFramework.
assert(UTC1.
printf(
"%08Q %02P") == (std::string)
"135000.000000 UTC",
"printf did not output in the proper format", __LINE__);
324 testFramework.
assert(GPS1.
printError(
"%08Q %02P") == (std::string)
"ErrorBadTime ErrorBadTime",
"printError did not output in the proper format", __LINE__);
325 testFramework.
assert(UTC1.
printError(
"%08Q %02P") == (std::string)
"ErrorBadTime ErrorBadTime",
"printError did not output in the proper format", __LINE__);
336 int check, errorCounter = 0;
340 errorCounter += check;
343 errorCounter += check;
346 errorCounter += check;
349 errorCounter += check;
352 errorCounter += check;
355 errorCounter += check;
358 errorCounter += check;
360 std::cout <<
"Total Failures for " << __FILE__ <<
": " << errorCounter << std::endl;