Go to the documentation of this file.
62 TestUtil testFramework(
"ANSITime",
"Constructor", __FILE__, __LINE__ );
69 testFramework.
assert(13500000 == (
int)Compare.
time,
"Explicit constructor did not set the time value properly", __LINE__);
77 testFramework.
assert(13500000 == (
int)Copy.
time,
"Copy constructor did not set the time value properly", __LINE__);
87 testFramework.
assert(13500000 == (
int)Assigned.
time,
"Set Operator did not set the time value properly", __LINE__);
99 TestUtil testFramework(
"ANSITime",
"setFromInfo", __FILE__, __LINE__ );
105 Id[
'K'] =
"13500000";
111 testFramework.
assert(setFromInfo1.
setFromInfo(Id),
"setFromInfo experienced an error and returned false", __LINE__);
114 testFramework.
assert(setFromInfo2.
setFromInfo(Id),
"setFromInfo experienced an error and returned false", __LINE__);
119 testFramework.
assert(Compare == setFromInfo1,
"setFromInfo did not set a value properly", __LINE__);
120 testFramework.
assert(Compare2 == setFromInfo2,
"setFromInfo did not set a value properly", __LINE__);
132 TestUtil testFramework(
"ANSITime",
"OperatorEquivalent", __FILE__, __LINE__ );
142 testFramework.
assert(Compare == CompareCopy,
"Equivalence Operator found equivalent objects as not equivalent", __LINE__);
143 testFramework.
assert(!(Compare == LessThan),
"Equivalence Operator found non-equivalent objects as equivalent", __LINE__);
150 testFramework.
assert(Compare != LessThan,
"Not-Equals Operator found non-equivalent objects as equivalent", __LINE__);
151 testFramework.
assert(!(Compare != Compare),
"Not-Equals Operator found equivalent objects as not equivalent", __LINE__);
158 testFramework.
assert(LessThan < Compare,
"Less-Than Operator found a smaller time as not less-than", __LINE__);
159 testFramework.
assert(!(Compare < LessThan),
"Less-Than Operator found a greater time as less-than", __LINE__);
160 testFramework.
assert(!(Compare < CompareCopy),
"Less-Than Operator found an equivalent time as less-than", __LINE__);
167 testFramework.
assert(!(LessThan > Compare),
"Greater-Than Operator found a smaller time as greater-than", __LINE__);
168 testFramework.
assert(Compare > LessThan,
"Greater-Than Operator found a greater time as not greater-than", __LINE__);
169 testFramework.
assert(!(Compare > CompareCopy),
"Greater-Than Operator found an equivalent time as greater-than", __LINE__);
176 testFramework.
assert(LessThan <= Compare,
"Less-Than-Or-Equal-To Operator found a smaller time as not less-than-or-equal-to", __LINE__);
177 testFramework.
assert(!(Compare <= LessThan),
"Less-Than-Or-Equal-To Operator found a greater time as less-than-or-equal-to", __LINE__);
178 testFramework.
assert(Compare <= CompareCopy,
"Less-Than-Or-Equal-To Operator found an equivalent time as not less-than-or-equal-to", __LINE__);
185 testFramework.
assert(!(LessThan >= Compare),
"Greater-Than-Or-Equal-To Operator found a smaller time as greater-than-or-equal-to", __LINE__);
186 testFramework.
assert(Compare >= LessThan,
"Greater-Than-Or-Equal-To Operator found a greater time as not greater-than-or-equal-to", __LINE__);
187 testFramework.
assert(Compare >= CompareCopy,
"Greater-Than-Or-Equal-To Operator found an equivalent time as not greater-than-or-equal-to", __LINE__);
198 TestUtil testFramework(
"ANSITime",
"reset", __FILE__, __LINE__ );
207 testFramework.
assert(0 == (
int)Compare.
time,
"Reset did not set the time to its default value (0)", __LINE__);
208 testFramework.
assert(
TimeSystem(0) == Compare.
getTimeSystem(),
"Reset did not set the time system to its default value (Unknown)", __LINE__);
219 TestUtil testFramework(
"ANSITime",
"isValid", __FILE__, __LINE__ );
231 testFramework.
assert(Compare.
isValid(),
"Time provided is found to not be valid for CommonTime conversions", __LINE__);
244 testFramework.
assert(Test2.
time == Compare.
time,
"Conversion to/from CommonTime changed the time", __LINE__);
255 TestUtil testFramework(
"ANSITime",
"OperatorEquivalentWithDifferingTimeSystem", __FILE__, __LINE__ );
269 testFramework.
assert(!(GPS1 == UTC1),
"Equivalence operator found objects with differing TimeSystems to be the same", __LINE__);
270 testFramework.
assert(GPS1 == ANY,
"Differing TimeSystems where one is TimeSystem::Any is not ignored for equals", __LINE__);
271 testFramework.
assert(UTC1 == ANY,
"Differing TimeSystems where one is TimeSystem::Any is not ignored for equals", __LINE__);
272 testFramework.
assert(UNKNOWN == ANY,
"Differing TimeSystems where one is TimeSystem::Any is not ignored for equals", __LINE__);
278 testFramework.
assert(GPS1 != UTC1,
"Equivalent objects with differing TimeSystems are found to be equal", __LINE__);
279 testFramework.
assert(GPS1 != UNKNOWN,
"Equivalent objects with differing TimeSystems are found to be equal", __LINE__);
280 testFramework.
assert(!(GPS1 != ANY),
"Equivalent objects with differing TimeSystems where one is TimeSystem::Any are found to be not-equal", __LINE__);
286 testFramework.
assert(ANY2 < GPS1,
"Less than object with Any TimeSystem is not found to be less than", __LINE__);
287 testFramework.
assert(GPS2 < ANY,
"Less than object with GPS TimeSystem is not found to be less-than a greater object with Any TimeSystem", __LINE__);
305 TestUtil testFramework(
"ANSITime",
"printf", __FILE__, __LINE__ );
314 testFramework.
assert(GPS1.
printf(
"%08K %02P") == (std::string)
"13500000 GPS",
"printf did not output in the proper format", __LINE__);
315 testFramework.
assert(UTC1.
printf(
"%08K %02P") == (std::string)
"13500000 UTC",
"printf did not output in the proper format", __LINE__);
322 testFramework.
assert(GPS1.
printError(
"%08K %02P") == (std::string)
"ErrorBadTime ErrorBadTime",
"printError did not output in the proper format", __LINE__);
323 testFramework.
assert(UTC1.
printError(
"%08K %02P") == (std::string)
"ErrorBadTime ErrorBadTime",
"printError did not output in the proper format", __LINE__);
334 int check, errorCounter = 0;
338 errorCounter += check;
341 errorCounter += check;
344 errorCounter += check;
347 errorCounter += check;
350 errorCounter += check;
353 errorCounter += check;
356 errorCounter += check;
358 std::cout <<
"Total Failures for " << __FILE__ <<
": " << errorCounter << std::endl;
void assert(bool testExpression, const std::string &testMsg, const int lineNumber)
static const GNSSTK_EXPORT CommonTime BEGINNING_OF_TIME
earliest representable CommonTime
virtual std::string printf(const std::string &fmt) const
int initializationTest(void)
void changeSourceMethod(const std::string &newMethod)
virtual bool setFromInfo(const IdToValue &info)
virtual std::string printError(const std::string &fmt) const
virtual void convertFromCommonTime(const CommonTime &ct)
int toFromCommonTimeTest(void)
TimeSystem
Definition of various time systems.
@ UTC
Coordinated Universal Time (e.g., from NTP)
virtual void reset()
Reset this object to the default state.
int setFromInfoTest(void)
virtual CommonTime convertToCommonTime() const
virtual bool isValid() const
Returns true if this object's members are valid, false otherwise.
gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:38