56 TestUtil testFramework(
"YDSTime",
"Constructor", __FILE__, __LINE__ );
65 testFramework.
assert(2008 == Compare.
year,
"Explicit constructor did not set the year value properly", __LINE__);
66 testFramework.
assert(2 == Compare.
doy,
"Explicit constructor did not set the day value properly", __LINE__);
67 testFramework.
assert(1 == Compare.
sod,
"Explicit constructor did not set the second value properly", __LINE__);
76 testFramework.
assert(2008 == Copy.
year,
"Copy constructor did not set the year value properly", __LINE__);
77 testFramework.
assert(2 == Copy.
doy,
"Copy constructor did not set the day value properly", __LINE__);
78 testFramework.
assert(1 == Copy.
sod,
"Copy constructor did not set the second value properly", __LINE__);
88 testFramework.
assert(2008 == Assigned.
year,
"Set Operator did not set the year value properly", __LINE__);
89 testFramework.
assert(2 == Assigned.
doy,
"Set Operator did not set the day value properly", __LINE__);
90 testFramework.
assert(1 == Assigned.
sod,
"Set Operator did not set the second value properly", __LINE__);
103 TestUtil testFramework(
"YDSTime",
"setFromInfo", __FILE__, __LINE__ );
123 testFramework.
assert(setFromInfo1.
setFromInfo(Id),
"setFromInfo experienced an error and returned false", __LINE__);
124 testFramework.
assert(Compare == setFromInfo1,
"setFromInfo did not set all of the values properly", __LINE__);
133 testFramework.
assert(setFromInfo2.
setFromInfo(Id),
"setFromInfo experienced an error and returned false", __LINE__);
134 testFramework.
assert(Compare2 == setFromInfo2,
"setFromInfo did not set all of the values properly", __LINE__);
143 testFramework.
assert(!setFromInfo3.
setFromInfo(Id),
"setFromInfo allowed a 3 digit year to be set with 'y' option", __LINE__);
151 testFramework.
assert(!setFromInfo4.
setFromInfo(Id),
"setFromInfo experienced an error and returned false", __LINE__);
158 testFramework.
assert(setFromInfo5.
setFromInfo(Id),
"setFromInfo experienced an error and returned false", __LINE__);
159 testFramework.
assert(setFromInfo5 == Compare3,
"setFromInfo did not set all of the values properly", __LINE__);
171 TestUtil testFramework(
"YDSTime",
"OperatorEquivalent", __FILE__, __LINE__ );
175 YDSTime LessThanYear(2005,2,1);
183 testFramework.
assert( Compare == CompareCopy,
"Equivalence operator found equivalent objects to be not equivalent", __LINE__);
184 testFramework.
assert(!(Compare == LessThanYear),
"Equivalence operator found different year objects to be equivalent", __LINE__);
185 testFramework.
assert(!(Compare == LessThanDOY),
"Equivalence operator found different day objects to be equivalent", __LINE__);
186 testFramework.
assert(!(Compare == LessThanSOD),
"Equivalence operator found different second objects to be equivalent", __LINE__);
193 testFramework.
assert( Compare != LessThanYear,
"Not-equal operator found different year objects to be equivalent", __LINE__);
194 testFramework.
assert( Compare != LessThanDOY,
"Not-equal operator found different day objects to be equivalent", __LINE__);
195 testFramework.
assert( Compare != LessThanSOD,
"Not-equal operator found different second objects to be equivalent", __LINE__);
196 testFramework.
assert(!(Compare != CompareCopy),
"Not-equal operator found equivalent objects to not be equivalent", __LINE__);
202 testFramework.
assert( LessThanYear < Compare,
"Less-than operator found less-than year object to not be less than", __LINE__);
203 testFramework.
assert( LessThanDOY < Compare,
"Less-than operator found less-than day object to not be less than", __LINE__);
204 testFramework.
assert( LessThanSOD < Compare,
"Less-than operator found less-than second object to not be less than", __LINE__);
205 testFramework.
assert(!(Compare < LessThanYear),
"Less-than operator found greater-than year object to be less than", __LINE__);
206 testFramework.
assert(!(Compare < LessThanDOY),
"Less-than operator found greater-than day object to be less than", __LINE__);
207 testFramework.
assert(!(Compare < LessThanSOD),
"Less-than operator found greater-than second object to be less than", __LINE__);
208 testFramework.
assert(!(Compare < CompareCopy),
"Less-than operator found equivalent objects to be less than", __LINE__);
215 testFramework.
assert(!(LessThanYear > Compare),
"Greater-than operator found less-than year object to be greater-than", __LINE__);
216 testFramework.
assert(!(LessThanDOY > Compare),
"Greater-than operator found less-than day object to be greater-than", __LINE__);
217 testFramework.
assert(!(LessThanSOD > Compare),
"Greater-than operator found less-than second object to be greater-than", __LINE__);
218 testFramework.
assert( Compare > LessThanYear,
"Greater-than operator found greater-than year object to not be greater-than", __LINE__);
219 testFramework.
assert( Compare > LessThanDOY,
"Greater-than operator found greater-than day object to not be greater-than", __LINE__);
220 testFramework.
assert( Compare > LessThanSOD,
"Greater-than operator found greater-than second object to not be greater-than", __LINE__);
221 testFramework.
assert(!(Compare > CompareCopy),
"Greater-than operator found equivalent objects to be greater-than", __LINE__);
228 testFramework.
assert( LessThanYear <= Compare,
"Less-than-or-equal-to operator found less-than year object to not be less-than-or-equal-to", __LINE__);
229 testFramework.
assert( LessThanDOY <= Compare,
"Less-than-or-equal-to operator found less-than day object to not be less-than-or-equal-to", __LINE__);
230 testFramework.
assert( LessThanSOD <= Compare,
"Less-than-or-equal-to operator found less-than second object to not be less-than-or-equal-to", __LINE__);
231 testFramework.
assert(!(Compare <= LessThanYear),
"Less-than-or-equal-to operator found greater-than year object to be less-than-or-equal-to", __LINE__);
232 testFramework.
assert(!(Compare <= LessThanDOY),
"Less-than-or-equal-to operator found greater-than day object to be less-than-or-equal-to", __LINE__);
233 testFramework.
assert(!(Compare <= LessThanSOD),
"Less-than-or-equal-to operator found greater-than second object to be less-than-or-equal-to", __LINE__);
234 testFramework.
assert( Compare <= CompareCopy,
"Less-than-or-equal-to operator found equivalent objects to not be less-than-or-equal-to", __LINE__);
241 testFramework.
assert(!(LessThanYear >= Compare),
"Greater-than-or-equal-to operator found less-than year object to be greater-than-or-equal-to", __LINE__);
242 testFramework.
assert(!(LessThanDOY >= Compare),
"Greater-than-or-equal-to operator found less-than day object to be greater-than-or-equal-to", __LINE__);
243 testFramework.
assert(!(LessThanSOD >= Compare),
"Greater-than-or-equal-to operator found less-than second object to be greater-than-or-equal-to", __LINE__);
244 testFramework.
assert( Compare >= LessThanYear,
"Greater-than-or-equal-to operator found greater-than year object to not be greater-than-or-equal-to", __LINE__);
245 testFramework.
assert( Compare >= LessThanDOY,
"Greater-than-or-equal-to operator found greater-than day object to not be greater-than-or-equal-to", __LINE__);
246 testFramework.
assert( Compare >= LessThanSOD,
"Greater-than-or-equal-to operator found greater-than second object to not be greater-than-or-equal-to", __LINE__);
247 testFramework.
assert( Compare >= CompareCopy,
"Greater-than-or-equal-to operator found equivalent objects to not be greater-than-or-equal-to", __LINE__);
258 TestUtil testFramework(
"YDSTime",
"reset" , __FILE__, __LINE__ );
269 testFramework.
assert(0 == (
int)Compare.
year,
"reset() did not set the year value to 0", __LINE__);
270 testFramework.
assert(0 == (
int)Compare.
doy,
"reset() did not set the doy value to 0", __LINE__);
271 testFramework.
assert(0 == (
int)Compare.
sod,
"reset() did not set the sod value to 0", __LINE__);
282 TestUtil testFramework(
"YDSTime",
"isValid", __FILE__, __LINE__ );
297 testFramework.
assert(Compare.
isValid(),
"Time provided found to be unable to convert to/from CommonTime", __LINE__);
307 testFramework.
assert(Compare.
getTimeSystem()== Test2.
getTimeSystem(),
"TimeSystem provided found to be different after converting to and from CommonTime", __LINE__);
308 testFramework.
assert(Test2.
year == Compare.
year,
"Year provided found to be different after converting to and from CommonTime", __LINE__);
309 testFramework.
assert(Test2.
doy == Compare.
doy,
"DOY provided found to be different after converting to and from CommonTime", __LINE__);
310 testFramework.
assert(Test2.
sod == Compare.
sod,
"SOD provided found to be different after converting to and from CommonTime", __LINE__);
320 TestUtil testFramework(
"YDSTime",
"OperatorEquivalentWithDifferingTimeSystem", __FILE__, __LINE__ );
334 testFramework.
assert(!(GPS1 == UTC1),
"Equivalence operator found objects with differing TimeSystems to be the same", __LINE__);
335 testFramework.
assert(GPS1 == ANY,
"Differing TimeSystems where one is TimeSystem::Any is not ignored for equals", __LINE__);
336 testFramework.
assert(UTC1 == ANY,
"Differing TimeSystems where one is TimeSystem::Any is not ignored for equals", __LINE__);
337 testFramework.
assert(UNKNOWN == ANY,
"Differing TimeSystems where one is TimeSystem::Any is not ignored for equals", __LINE__);
343 testFramework.
assert(GPS1 != UTC1,
"Equivalent objects with differing TimeSystems are found to be equal", __LINE__);
344 testFramework.
assert(GPS1 != UNKNOWN,
"Equivalent objects with differing TimeSystems are found to be equal", __LINE__);
345 testFramework.
assert(!(GPS1 != ANY),
"Equivalent objects with differing TimeSystems where one is TimeSystem::Any are found to be not-equal", __LINE__);
351 testFramework.
assert(ANY2 < GPS1,
"Less than object with Any TimeSystem is not found to be less than", __LINE__);
352 testFramework.
assert(GPS2 < ANY,
"Less than object with GPS TimeSystem is not found to be less-than a greater object with Any TimeSystem", __LINE__);
370 TestUtil testFramework(
"YDSTime",
"printf", __FILE__, __LINE__ );
379 testFramework.
assert(GPS1.
printf(
"%04Y %02y %03j %02s %02P") == (std::string)
"2008 08 002 1.000000 GPS",
"printf did not output in the proper format", __LINE__);
380 testFramework.
assert(UTC1.
printf(
"%04Y %02y %03j %02s %02P") == (std::string)
"2008 08 002 1.000000 UTC",
"printf did not output in the proper format", __LINE__);
386 testFramework.
assert(GPS1.
printError(
"%04Y %02y %03j %02s %02P") == (std::string)
"ErrorBadTime ErrorBadTime ErrorBadTime ErrorBadTime ErrorBadTime",
"printError did not output in the proper format", __LINE__);
387 testFramework.
assert(UTC1.
printError(
"%04Y %02y %03j %02s %02P") == (std::string)
"ErrorBadTime ErrorBadTime ErrorBadTime ErrorBadTime ErrorBadTime",
"printError did not output in the proper format", __LINE__);
396 int check, errorCounter = 0;
400 errorCounter += check;
403 errorCounter += check;
406 errorCounter += check;
409 errorCounter += check;
412 errorCounter += check;
415 errorCounter += check;
418 errorCounter += check;
420 std::cout <<
"Total Failures for " << __FILE__ <<
": " << errorCounter << std::endl;