56 gnsstk::TestUtil testFramework(
"SP3SatID",
"Constructor", __FILE__, __LINE__);
63 testFramework.
assert(Compare1.
id == 5,
64 "Explicit constructor did not set the correct ID", __LINE__);
66 "Explicit constructor did not set the correct SatelliteSystem", __LINE__);
74 testFramework.
assert(Compare2.
id == -1,
75 "Default constructor did not set the expected ID", __LINE__);
77 "Default constructor did not set the expected SatelliteSystem", __LINE__);
85 testFramework.
assert(Compare3.
id == 10,
86 "fromString constructor did not set the correct ID", __LINE__);
88 "fromString constructor did not set the correct SatelliteSystem", __LINE__);
94 testFramework.
assert(
false,
95 "fromString constructor did not throw an exception for an improper string",
100 testFramework.
assert(
true,
"fromString threw the expected exception",
110 testFramework.
assert(Compare4.
id == 7,
111 "SatID constructor did not set the correct ID", __LINE__);
113 "SatID constructor did not set the correct SatelliteSystem", __LINE__);
124 gnsstk::TestUtil testFramework(
"SatID",
"OperatorEquivalence", __FILE__, __LINE__);
138 testFramework.
assert( Compare == Equivalent ,
139 "Equivalence Operator found equivalent objects to not be equal" , __LINE__);
140 testFramework.
assert(!(Compare == LessThanID),
141 "Equivalence Operator found differing IDs to be equal" , __LINE__);
142 testFramework.
assert(!(Compare == DiffSatSys),
143 "Equivalence Operator found differing SatteliteSystems to be equal", __LINE__);
150 testFramework.
assert(!(Compare != Equivalent),
151 "Not Equals Operator found equivalent objects to be not equal" , __LINE__);
152 testFramework.
assert( Compare != LessThanID ,
153 "Not Equals Operator found differing IDs to be equal" , __LINE__);
154 testFramework.
assert( Compare != DiffSatSys ,
155 "Not Equals Operator found differing SatteliteSystems to be equal", __LINE__);
164 testFramework.
assert(!(Compare < LessThanID),
165 "Less-than Operator found object with greater IDs and same SatSys to be less-than"
167 testFramework.
assert( LessThanID < Compare ,
168 "Less-than Operator found object with lesser IDs and same SatSys to not be less-than",
170 testFramework.
assert(!(Compare < Equivalent),
171 "Less-than Operator found equivalent object to be less-than"
175 testFramework.
assert( Compare < DiffSatSys ,
176 "Less-than Operator found object with lesser SatSys and same IDs to not be less-than",
178 testFramework.
assert(!(DiffSatSys < Compare),
179 "Less-than Operator found object with greater SatSys and same IDs to be less-than"
183 testFramework.
assert( Compare < DiffEvery ,
184 "Less-than Operator found object with lesser SatSys and greater ID to not be less-than",
186 testFramework.
assert(!(DiffEvery < Compare) ,
187 "Less-than Operator found object with greater SatSys and lesser ID to be less-than"
189 testFramework.
assert(!(Compare < DiffEvery2),
190 "Less-than Operator found object with greater SatSys and lesser ID to be less-than"
192 testFramework.
assert( DiffEvery2 < Compare ,
193 "Less-than Operator found object with lesser SatSys and greater ID to not be less-than",
202 testFramework.
assert( (Compare > LessThanID),
203 "Greater-than Operator found object with greater IDs and same SatSys to not be greater-than",
205 testFramework.
assert(!(LessThanID > Compare),
206 "Greater-than Operator found object with lesser IDs and same SatSys to be greater-than"
208 testFramework.
assert(!(Compare > Equivalent),
209 "Greater-than Operator found equivalent object to be greater-than"
213 testFramework.
assert(!(Compare > DiffSatSys),
214 "Greater-than Operator found object with lesser SatSys and same IDs to be greater-than"
216 testFramework.
assert( (DiffSatSys > Compare),
217 "Greater-than Operator found object with greater SatSys and same IDs to not be greater-than",
221 testFramework.
assert(!(Compare > DiffEvery) ,
222 "Greater-than Operator found object with lesser SatSys and greater ID to be greater-than"
224 testFramework.
assert( (DiffEvery > Compare) ,
225 "Greater-than Operator found object with greater SatSys and lesser ID to not be greater-than",
227 testFramework.
assert( (Compare > DiffEvery2),
228 "Greater-than Operator found object with greater SatSys and lesser ID to not be greater-than",
230 testFramework.
assert(!(DiffEvery2 > Compare),
231 "Greater-than Operator found object with lesser SatSys and greater ID to be greater-than"
241 testFramework.
assert(!(Compare <= LessThanID),
242 "Less-than-or-equal-to Operator found object with greater IDs and same SatSys to be less-than-or-equal-to"
244 testFramework.
assert( LessThanID <= Compare ,
245 "Less-than-or-equal-to Operator found object with lesser IDs and same SatSys to not be less-than-or-equal-to",
247 testFramework.
assert( (Compare <= Equivalent),
248 "Less-than-or-equal-to Operator found equivalent object to not be less-than-or-equal-to"
252 testFramework.
assert( Compare <= DiffSatSys ,
253 "Less-than-or-equal-to Operator found object with lesser SatSys and same IDs to not be less-than-or-equal-to",
255 testFramework.
assert(!(DiffSatSys <= Compare),
256 "Less-than-or-equal-to Operator found object with greater SatSys and same IDs to be less-than-or-equal-to"
260 testFramework.
assert( Compare <= DiffEvery ,
261 "Less-than-or-equal-to Operator found object with lesser SatSys and greater ID to not be less-than-or-equal-to",
263 testFramework.
assert(!(DiffEvery <= Compare) ,
264 "Less-than-or-equal-to Operator found object with greater SatSys and lesser ID to be less-than-or-equal-to"
266 testFramework.
assert(!(Compare <= DiffEvery2),
267 "Less-than-or-equal-to Operator found object with greater SatSys and lesser ID to be less-than-or-equal-to"
269 testFramework.
assert( DiffEvery2 <= Compare ,
270 "Less-than-or-equal-to Operator found object with lesser SatSys and greater ID to not be less-than-or-equal-to",
279 testFramework.
assert( (Compare >= LessThanID),
280 "Greater-than-or-equal-to Operator found object with greater IDs and same SatSys to not be greater-than-or-equal-to",
282 testFramework.
assert(!(LessThanID >= Compare),
283 "Greater-than-or-equal-to Operator found object with lesser IDs and same SatSys to be greater-than-or-equal-to"
285 testFramework.
assert( (Compare >= Equivalent),
286 "Greater-than-or-equal-to Operator found equivalent object to not be greater-than-or-equal-to"
290 testFramework.
assert(!(Compare >= DiffSatSys),
291 "Greater-than-or-equal-to Operator found object with lesser SatSys and same IDs to be greater-than-or-equal-to"
293 testFramework.
assert( (DiffSatSys >= Compare),
294 "Greater-than-or-equal-to Operator found object with greater SatSys and same IDs to not be greater-than-or-equal-to",
298 testFramework.
assert(!(Compare >= DiffEvery) ,
299 "Greater-than-or-equal-to Operator found object with lesser SatSys and greater ID to be greater-than-or-equal-to"
301 testFramework.
assert( (DiffEvery >= Compare) ,
302 "Greater-than-or-equal-to Operator found object with greater SatSys and lesser ID to not be greater-than-or-equal-to",
304 testFramework.
assert( (Compare >= DiffEvery2),
305 "Greater-than-or-equal-to Operator found object with greater SatSys and lesser ID to not be greater-than-or-equal-to",
307 testFramework.
assert(!(DiffEvery2 >= Compare),
308 "Greater-than-or-equal-to Operator found object with lesser SatSys and greater ID to be greater-than-or-equal-to"
316 std::string outputString, compareString;
317 std::stringstream outputStream;
318 outputStream << Redirected;
319 outputString = outputStream.str();
320 compareString =
"G06";
321 testFramework.
assert(outputString == compareString,
322 "Redirect operator did not function properly", __LINE__);
334 gnsstk::TestUtil testFramework(
"SP3SatID",
"fromString", __FILE__, __LINE__);
336 std::string inputStringArray[12] = {
"7",
"07",
"30",
"E10",
"E100",
"G08",
"E08",
"R08",
"L08",
"C08",
"J08",
"M08"};
337 int expectedID[12] = { 7, 7, 30, 10, 100, 8, 8, 8, 8, 8, 200, 8};
356 for (
int i = 0; i < (
sizeof(expectedID)/
sizeof(expectedID[0])); i++)
365 s <<
"Exception in fromString call on input: " << inputStringArray[i];
366 testFramework.
assert(
false,
370 testFramework.
assert(Compare.
id == expectedID[i],
371 "fromString did not set the correct ID", __LINE__);
372 testFramework.
assert(Compare.
system == expectedSatSysArray[i],
373 "fromString did not set the correct SatelliteSystem", __LINE__);
380 testFramework.
assert(
false,
381 "fromString did not throw an exception for an improper string", __LINE__);
385 testFramework.
assert(
true,
"fromString threw the expected exception",
400 std::string outputString1, compareString1;
401 std::string outputString2, compareString2;
402 std::string outputString3, compareString3;
403 std::string outputString4, compareString4;
404 std::string outputString5, compareString5;
405 std::string outputString6, compareString6;
406 std::string outputString7, compareString7;
407 std::string outputString8, compareString8;
408 std::string outputString9, compareString9;
413 outputString1 = Compare1.
toString();
414 compareString1 =
"G05";
416 s <<
"toString did not return the expected string, exp: "
417 << compareString1 <<
", but got: " << outputString1;
418 testFramework.
assert(outputString1 == compareString1,
423 s.str(
"Exception in toString call, expected output: ");
425 testFramework.
assert(
false,
432 outputString2 = Compare2.
toString();
433 compareString2 =
"E20";
435 s <<
"toString did not return the expected string, exp: "
436 << compareString2 <<
", but got: " << outputString2;
437 testFramework.
assert(outputString2 == compareString2,
442 s.str(
"Exception in toString call, expected output: ");
444 testFramework.
assert(
false,
451 outputString3 = Compare3.
toString();
452 compareString3 =
"G-5";
454 s <<
"toString did not return the expected string, exp: "
455 << compareString3 <<
", but got: " << outputString3;
456 testFramework.
assert(outputString3 == compareString3,
461 s.str(
"Exception in toString call, expected output: ");
463 testFramework.
assert(
false,
470 outputString4 = Compare4.
toString();
471 compareString4 =
"R01";
473 s <<
"toString did not return the expected string, exp: "
474 << compareString4 <<
", but got: " << outputString4;
475 testFramework.
assert(outputString4 == compareString4,
480 s.str(
"Exception in toString call, expected output: ");
482 testFramework.
assert(
false,
489 outputString5 = Compare5.
toString();
490 compareString5 =
"L01";
492 s <<
"toString did not return the expected string, exp: "
493 << compareString5 <<
", but got: " << outputString5;
494 testFramework.
assert(outputString5 == compareString5,
499 s.str(
"Exception in toString call, expected output: ");
501 testFramework.
assert(
false,
508 outputString6 = Compare6.
toString();
509 compareString6 =
"C01";
511 s <<
"toString did not return the expected string, exp: "
512 << compareString6 <<
", but got: " << outputString6;
513 testFramework.
assert(outputString6 == compareString6,
518 s.str(
"Exception in toString call, expected output: ");
520 testFramework.
assert(
false,
527 outputString7 = Compare7.
toString();
528 compareString7 =
"J01";
530 s <<
"toString did not return the expected string, exp: "
531 << compareString7 <<
", but got: " << outputString7;
532 testFramework.
assert(outputString7 == compareString7,
537 s.str(
"Exception in toString call, expected output: ");
539 testFramework.
assert(
false,
546 outputString8 = Compare8.
toString();
547 compareString8 =
"M01";
549 s <<
"toString did not return the expected string, exp: "
550 << compareString8 <<
", but got: " << outputString8;
551 testFramework.
assert(outputString8 == compareString8,
556 s.str(
"Exception in toString call, expected output: ");
558 testFramework.
assert(
false,
566 outputString9 = Compare9.
toString();
567 compareString9 =
"?-1";
569 s <<
"toString did not return the expected string, exp: "
570 << compareString9 <<
", but got: " << outputString9;
571 testFramework.
assert(outputString9 == compareString9,
576 s.str(
"Exception in toString call, expected output: ");
578 testFramework.
assert(
false,
591 int check = 0,errorCounter = 0;
594 errorCounter += check;
597 errorCounter += check;
600 errorCounter += check;
603 errorCounter += check;
605 std::cout <<
"Total Failures for " << __FILE__ <<
": " << errorCounter <<