49 #include "build_config.h"
58 #define LDEXP(x,y) ldexp(x,y)
60 #define LDEXP(x,y) std::ldexp(x,y)
71 { 583228942, 824945128, 904134685, 184026330, 459310087,
72 16899638, 845363969, 0x0f647980, 4193148, 1073290676,
73 583228942, 824953464, 260012308, 225364840, 787693093,
74 1065730353, 298759921, 46377054, 57870868, 8172,
75 583228942, 824962032, 1072401983, 485782594, 84477,
76 301605863, 145566781, 506082625, 1072230894, 259901040 };
144 unsigned hardCodeTest();
145 unsigned headerExceptionTest();
146 unsigned streamReadWriteTest();
147 unsigned filterOperatorsTest();
152 unsigned xmitReadTest();
199 std::string
file_sep = getFileSep();
207 inputRinexNavExample = dp+
"test_input_rinex_nav_RinexNavExample.99n";
208 outputTestOutput = tp+
"test_output_rinex_nav_TestOutput.99n";
209 outputTestOutput2 = tp+
"test_output_rinex_nav_TestOutput2.99n";
210 outputTestOutput3 = tp+
"test_output_rinex_nav_TestOutput3.99n";
211 outputTestOutput4 = tp+
"test_output_rinex_nav_TestOutput4.16n";
212 inputTestOutput4 = dp+
"test_input_rinex_nav_TestOutput4.16n";
213 outputRinexDump = tp+
"test_output_rinex_nav_RinexDump";
214 inputInvalidLineLength = dp+
"test_input_rinex_nav_InvalidLineLength.99n";
215 inputNotaNavFile = dp+
"test_input_rinex_nav_NotaNavFile.99n";
216 inputUnknownHeaderLabel = dp+
"test_input_rinex_nav_UnknownHeaderLabel.99n";
217 inputIncompleteHeader = dp+
"test_input_rinex_nav_IncompleteHeader.99n";
218 inputUnsupportedRinex = dp+
"test_input_rinex_nav_UnsupportedRinex.99n";
219 inputBadHeader = dp+
"test_input_rinex_nav_BadHeader.99n";
220 outputTestOutputHeader = tp+
"test_output_rinex_nav_TestOutputHeader.99n";
221 inputFilterStream1 = dp+
"test_input_rinex_nav_FilterTest1.99n";
222 inputFilterStream2 = dp+
"test_input_rinex_nav_FilterTest2.99n";
223 inputFilterStream3 = dp+
"test_input_rinex_nav_FilterTest3.99n";
224 outputFilterOutput = tp+
"test_output_rinex_nav_FilterOutput.txt";
225 outputRinexStore = tp+
"test_output_rinex_nav_RinexStore.txt";
226 inputXmitTime = dp+
"test_input_rinex_nav_TestInput1.16n";
227 outputXmitTime = tp+
"test_output_rinex_nav_TestInput1.16n";
248 TUDEF(
"RinexNavStream",
"hardCodeTest");
270 std::vector<std::string>::const_iterator itr1 =
271 header.commentList.begin();
272 TUASSERTE(std::string,
"THIS IS ONE COMMENT", *itr1);
273 TUCMPFILE(inputRinexNavExample, outputTestOutput, 2);
284 while (inp2 >> data2)
297 while (inp3 >> data3)
304 TUCMPFILE(inputRinexNavExample, outputTestOutput3, 2);
308 TUFAIL(
"test read TestOutput2, unexpected exception");
319 TUDEF(
"RinexNavStream",
"headerExceptionTest");
321 std::string msg_test_desc =
" ";
322 std::string msg_expected =
", should throw a gnsstk::Exception";
323 std::string msg_false_pass =
", but threw no exception.";
324 std::string msg_true_fail =
", but instead threw an unknown exception.";
337 InvalidLineLength.exceptions( std::fstream::failbit);
338 NotaNavFile.exceptions( std::fstream::failbit);
339 UnknownHeaderLabel.exceptions(std::fstream::failbit);
340 IncompleteHeader.exceptions( std::fstream::failbit);
341 UnsupportedRinex.exceptions( std::fstream::failbit);
342 BadHeader.exceptions( std::fstream::failbit);
346 msg_test_desc =
"InvalidLineLength test";
349 InvalidLineLength >> Header;
350 TUFAIL(msg_test_desc + msg_expected + msg_false_pass);
354 TUPASS(msg_test_desc + msg_expected);
358 TUFAIL(msg_test_desc + msg_expected + msg_true_fail);
362 msg_test_desc =
"NotaNavFile test";
365 NotaNavFile >> Header;
366 TUFAIL(msg_test_desc + msg_expected + msg_false_pass);
370 TUPASS(msg_test_desc + msg_expected);
374 TUFAIL(msg_test_desc + msg_expected + msg_true_fail);
378 msg_test_desc =
"UnknownHeaderLabel test";
381 UnknownHeaderLabel >> Header;
382 TUFAIL(msg_test_desc + msg_expected + msg_false_pass);
386 TUPASS(msg_test_desc + msg_expected);
390 TUFAIL(msg_test_desc + msg_expected + msg_true_fail);
394 msg_test_desc =
"IncompleteHeader test";
397 IncompleteHeader >> Header;
398 TUFAIL(msg_test_desc + msg_expected + msg_false_pass);
402 TUPASS(msg_test_desc + msg_expected);
406 TUFAIL(msg_test_desc + msg_expected + msg_true_fail);
410 msg_test_desc =
"UnsupportedRinex test";
413 UnsupportedRinex >> Header;
414 TUFAIL(msg_test_desc + msg_expected + msg_false_pass);
418 TUPASS(msg_test_desc + msg_expected);
422 TUFAIL(msg_test_desc + msg_expected + msg_true_fail);
426 msg_test_desc =
"BadHeader test";
430 TUFAIL(msg_test_desc + msg_expected + msg_false_pass);
434 TUPASS(msg_test_desc + msg_expected);
438 TUFAIL(msg_test_desc + msg_expected + msg_true_fail);
444 TUFAIL(
"test failure message");
458 TUDEF(
"RinexNavData",
"streamReadWriteTest");
463 RinexNavStream rinexOutputStream(outputRinexStore.c_str(), std::ios::out);
464 rinexInputStream >> rinexOutputStream.
header;
465 rinexOutputStream << rinexOutputStream.
header;
468 while(rinexInputStream >>
data)
469 rinexOutputStream <<
data;
470 TUCMPFILE(inputRinexNavExample, outputRinexStore, 9);
474 TUFAIL(
"Unexpected exception");
490 TUDEF(
"RinexNavStream",
"filterOperatorsTest");
495 FilterStream1.
open(inputFilterStream1.c_str(), std::ios::in);
509 FilterStream1 >> FilterHeader1;
510 FilterStream2 >> FilterHeader2;
511 FilterStream3 >> FilterHeader3;
513 while (FilterStream1 >> rndata)
515 FilterData1 = rndata;
517 while (FilterStream2 >> rndata)
519 FilterData2 = rndata;
521 while (FilterStream3 >> rndata)
523 FilterData3 = rndata;
527 merged(FilterHeader1);
528 merged(FilterHeader2);
533 TUASSERT(EqualsFull(FilterData1, FilterData2));
534 TUASSERT(!EqualsFull(FilterData1, FilterData3));
538 TUASSERT(!LessThanSimple(FilterData1, FilterData2));
545 TUASSERT(!LessThanFull(FilterData1, FilterData1));
547 std::list<long> list;
555 TUFAIL(
"unexpected exception");
564 TUDEF(
"RinexNavData",
"RinexNavData(EngEphemeris)");
616 TUCMPFILE(inputTestOutput4, outputTestOutput4, 0);
624 TUDEF(
"RinexNavData",
"xmitReadTest");
645 TUCMPFILE(inputXmitTime, outputXmitTime, 2);
657 unsigned errorTotal = 0;
667 cout <<
"Total Failures for " << __FILE__ <<
": " << errorTotal << endl;