48 #include "build_config.h"
92 std::cout<<
"Running tests for Rinex v.2 files"<<std::endl;
94 std::string
file_sep = gnsstk::getFileSep();
97 "test_input_rinex2_clock_BadEpochLine.96c";
99 "test_input_rinex2_clock_IncompleteHeader.96c";
101 "test_input_rinex2_clock_InvalidLineLength.96c";
103 "test_input_rinex2_clock_NotAClockFile.96c";
105 "test_input_rinex2_clock_RinexClockExample.96c";
107 "test_input_rinex2_clock_UnknownHeaderLabel.96c";
110 "test_output_rinex2_clock_TestOutput.96c";
112 "test_output_rinex3_clock_TestR3HeaderOutput.96c";
114 "test_output_rinex3_clock_TestR3HeaderOutput.exp";
121 std::cout<<
"Running tests for Rinex v.3 files"<<std::endl;
123 std::string
file_sep = gnsstk::getFileSep();
126 "test_input_rinex3_clock_BadEpochLine.96c";
128 "test_input_rinex3_clock_IncompleteHeader.96c";
130 "test_input_rinex3_clock_InvalidLineLength.96c";
132 "test_input_rinex3_clock_NotAClockFile.96c";
134 "test_input_rinex3_clock_RinexClockExample.96c";
137 "test_output_rinex3_clock_TestOutput.96c";
143 TUDEF(
"Rinex3ClockStream",
"HeaderExceptions");
145 std::string msg_desc =
"";
146 std::string msg_expect =
", should throw gnsstk::Exception";
147 std::string msg_falsePass =
" but threw no exception.";
148 std::string msg_trueFail =
" but instead threw an unknown exception";
162 IncompleteHeader.exceptions(std::fstream::failbit);
163 InvalidLineLength.exceptions(std::fstream::failbit);
164 NotAClockFile.exceptions(std::fstream::failbit);
165 RinexClockFile.exceptions(std::fstream::failbit);
166 UnknownHeaderLabel.exceptions(std::fstream::failbit);
186 #ifdef RINEX_3_CLOCK_ACTUALLY_IMPLEMENTED
187 msg_desc =
"IncompleteHeader test";
190 IncompleteHeader >> ch;
191 TUFAIL(msg_desc + msg_expect + msg_falsePass);
195 TUPASS(msg_desc + msg_expect);
199 TUFAIL(msg_desc + msg_expect + msg_trueFail);
205 msg_desc =
"InvalidLineLength test";
208 InvalidLineLength >> ch;
209 TUFAIL(msg_desc + msg_expect + msg_falsePass);
213 TUPASS(msg_desc + msg_expect);
217 TUFAIL(msg_desc + msg_expect + msg_trueFail);
222 msg_desc =
"NotAClockFile test";
226 TUFAIL(msg_desc + msg_expect + msg_falsePass);
230 TUPASS(msg_desc + msg_expect);
234 TUFAIL(msg_desc + msg_expect + msg_trueFail);
239 msg_desc =
"UnknownHeaderLabel test";
242 UnknownHeaderLabel >> ch;
243 TUFAIL(msg_desc + msg_expect + msg_falsePass);
247 TUPASS(msg_desc + msg_expect);
251 TUFAIL(msg_desc + msg_expect + msg_trueFail);
258 TUFAIL(
"Error thrown when running headerExceptionTest: "+e.
what());
262 TUFAIL(
"Unknown error thrown when running headerExceptionTest");
265 return testFramework.countFails();
270 TUDEF(
"Rinex3ClockStream",
"DataExceptions");
272 std::string msg_desc =
"";
273 std::string msg_expect =
", should throw gnsstk::Exception";
274 std::string msg_falsePass =
" but threw no exception.";
275 std::string msg_trueFail =
" but instead threw an unknown exception";
283 msg_desc =
"BadEpochLine test";
286 while (BadEpochLine >> cd);
287 TUFAIL(msg_desc + msg_expect + msg_falsePass);
291 TUPASS(msg_desc + msg_expect);
295 TUFAIL(msg_desc + msg_expect + msg_trueFail);
301 TUFAIL(
"Error thrown when running dataExceptionTest: "+e.
what());
305 TUFAIL(
"Unknown error thrown when running dataExceptionTest");
308 return testFramework.countFails();
314 TUDEF(
"Rinex3ClockStream",
"Read & write to file");
351 while(inputStream >> cd)
361 testMesg =
"Unable to read/write to file stream: " + e.
what();
372 testMesg =
"Files are not consistent after input & out";
375 return testFramework.countFails();
381 TUDEF(
"Rinex3ClockStream",
"write to R3 file");
399 testMesg =
"Unable to read/write to file stream: " + e.
what();
408 testMesg =
"Headers are not consistent after input & out";
411 return testFramework.countFails();
418 int check, errorCounter = 0;
423 errorCounter += check;
425 #ifdef RINEX_3_CLOCK_ACTUALLY_IMPLEMENTED
427 errorCounter += check;
430 errorCounter += check;
437 errorCounter += check;
441 #ifdef RINEX_3_CLOCK_ACTUALLY_IMPLEMENTED
443 errorCounter += check;
446 errorCounter += check;
449 std::cout <<
"Total Failures for " << __FILE__ <<
": " << errorCounter