69 TUDEF(
"AlmOrbit",
"Default Constructor");
77 testMesg =
"PRN not initialized to 0";
79 testMesg =
"Ecc not initialized to 0";
81 testMesg =
"Offset not initialized to 0";
83 testMesg =
"OMEGAdot not initialized to 0";
85 testMesg =
"Ahalf not initialized to 0";
87 testMesg =
"OMEGA0 not initialized to 0";
89 testMesg =
"W not initialized to 0";
91 testMesg =
"M0 not initialized to 0";
93 testMesg =
"AF0 not initialized to 0";
95 testMesg =
"AF1 not initialized to 0";
97 testMesg =
"Toa not initialized to 0";
99 testMesg =
"Xmit_time not initialized to 0";
101 testMesg =
"Week not initialized to 0";
116 -0.296182, -1.31888, 2.79387, 0.000148773,
117 7.63976E-11, 466944, 250560, 797, 0);
119 TUCSM(
"Explicit Constructor");
123 testMesg =
"PRN value was not initialized correctly";
125 testMesg =
"Ecc value was not initialized correctly";
127 testMesg =
"Offset value was not initialized correctly";
129 testMesg =
"OMEGAdot value was not initialized correctly";
131 testMesg =
"Ahalf value was not initialized correctly";
133 testMesg =
"OMEGA0 value was not initialized correctly";
135 testMesg =
"W value was not initialized correctly";
137 testMesg =
"M0 value was not initialized correctly";
139 testMesg =
"AF0 value was not initialized correctly";
141 testMesg =
"AF1 value was not initialized correctly";
143 testMesg =
"Toa value was not initialized correctly";
145 testMesg =
"Xmit_time value was not initialized correctly";
147 testMesg =
"Week value was not initialized correctly";
160 TUDEF(
"AlmOrbit",
"Dump");
161 std::string testMesg;
164 -0.296182, -1.31888, 2.79387, 0.000148773,
165 7.63976E-11, 466944, 250560, 797, 0);
168 std::stringstream outputStream1, outputStream2, outputStream3;
169 std::string outputString1, referenceString1, outputString2,
170 referenceString2, outputString3, referenceString3;
172 referenceString1 =
"1, 466944, 797, 0, 1.4877e-04, 7.6398e-11,"
173 " 3.4666e-03, -1.3189e+00, 5.1536e+03, 2.7939e+00, -2.9618e-01, "
174 "-8.0118e-09, 3.8872e-03\n";
175 compare.
dump(outputStream1, 0);
176 outputString1 = outputStream1.str();
181 testMesg =
"Least-verbose dump method did not function correctly";
182 TUASSERTE(std::string, referenceString1, outputString1);
184 referenceString2 =
"PRN:1 Toa:466944 H:0 AFO:1.4877e-04 AF1:7.6398e-11 "
185 "Ecc:3.4666e-03\n w:-1.3189e+00 Ahalf:5.1536e+03 "
186 "M0:2.7939e+00\n OMEGA0:-2.9618e-01 "
187 "OMEGAdot:-8.0118e-09 Ioff:3.8872e-03\n";
188 compare.
dump(outputStream2, 1);
189 outputString2 = outputStream2.str();
194 testMesg =
"Medium-verbose dump method did not function correctly";
195 TUASSERTE(std::string, referenceString2, outputString2);
198 referenceString3 =
"PRN: 1\n"
200 "xmit_time: 250560\n"
203 "AFO: 1.4877e-04 sec\n"
204 "AF1: 7.6398e-11 sec/sec\n"
205 "Sqrt A: 5.1536e+03 sqrt meters\n"
206 "Eccentricity: 3.4666e-03\n"
207 "Arg of perigee: -1.3189e+00 rad\n"
208 "Mean anomaly at epoch: 2.7939e+00 rad\n"
209 "Right ascension: -2.9618e-01 rad"
210 " -8.0118e-09 rad/sec\n"
211 "Inclination offset: 3.8872e-03 rad \n";
212 compare.
dump(outputStream3, 2);
213 outputString3 = outputStream3.str();
218 testMesg =
"High-verbose dump method did not function correctly";
219 TUASSERTE(std::string, referenceString3, outputString3);
229 TUDEF(
"AlmOrbit",
"operator<<");
230 std::string testMesg;
232 std::stringstream outputStream;
233 std::string outputString, referenceString;
236 -0.296182, -1.31888, 2.79387, 0.000148773,
237 7.63976E-11, 466944, 250560, 797, 0);
239 referenceString =
"PRN:1 Toa:466944 H:0 AFO:1.4877e-04 AF1:7.6398e-11 "
240 "Ecc:3.4666e-03\n w:-1.3189e+00 Ahalf:5.1536e+03 "
241 "M0:2.7939e+00\n OMEGA0:-2.9618e-01 "
242 "OMEGAdot:-8.0118e-09 Ioff:3.8872e-03\n";
244 outputStream << compare;
245 outputString = outputStream.str();
251 testMesg =
"The redirection operator << did not function correctly";
252 TUASSERTE(std::string, referenceString, outputString);
262 TUDEF(
"AlmOrbit",
"get Methods");
263 std::string testMesg;
266 -0.296182, -1.31888, 2.79387, 0.000148773,
267 7.63976E-11, 466944, 250560, 797, 0);
275 testMesg =
"getToaTime method did not function correctly";
283 testMesg =
"getTransmitTime method did not function correctly";
289 testMesg =
"getFullWeek method did not function correctly";
294 5153.58, -0.296182, -1.31888, 2.79387,
295 0.000148773, 7.63976E-11, -302401, 0, 797, 0);
300 testMesg =
"getFullWeek method did not round the week down";
305 5153.58, -0.296182, -1.31888, 2.79387,
306 0.000148773, 7.63976E-11, 302401, 0, 797, 0);
311 testMesg =
"getFullWeek method did not round the week up";
321 TUDEF(
"AlmOrbit",
"svXvt");
324 -.804390648956e-08, .515359719276e+04,
325 -.296605403382e+01, -.224753761329e+01,
326 -.136404614938e+01, .579084269702e-03,
327 .227373675443e-11, 7168, 3600, 1854, 0);
328 bool testFailed =
false;
332 static const unsigned SECONDS = 7200;
334 for (
unsigned ii = 0; ii < SECONDS; ii++)
336 zeroth_array[ii] =
oe.svXvt(
oe.getToaTime() + ii);
341 for (
unsigned ii = 0; ii < SECONDS; ii++)
345 deriv[ii] = (1/h)*(-1.5*zeroth_array[ii].getPos() +
346 2.0*zeroth_array[ii+1].
getPos() -
347 0.5*zeroth_array[ii+2].
getPos());
349 else if ((ii == 1) || (ii == (SECONDS-2)))
351 deriv[ii] = (1/h)*(-0.5*zeroth_array[ii-1].getPos() +
352 0.5*zeroth_array[ii+1].
getPos());
354 else if (ii == (SECONDS-1))
356 deriv[ii] = (1/h)*(0.5*zeroth_array[ii-2].getPos() -
357 2.0*zeroth_array[ii-1].
getPos() +
358 1.5*zeroth_array[ii].
getPos());
362 deriv[ii] = (1/h)*((1.0/12.0)*zeroth_array[ii-2].
getPos() -
363 (2.0/3.0)*zeroth_array[ii-1].
getPos() +
364 (2.0/3.0)*zeroth_array[ii+1].
getPos() -
365 (1.0/12.0)*zeroth_array[ii+2].
getPos());
369 for (
unsigned ii = 0; ii < SECONDS; ii++)
371 double derivedMag = deriv[ii].
mag();
372 double computedMag = zeroth_array[ii].
getVel().
mag();
387 TUFAIL(
"computed velocity is significantly different from derived"
421 errorTotal += testClass.
getTest();
424 std::cout <<
"Total Failures for " << __FILE__ <<
": " << errorTotal