120 "usage: libdatrwxxtests [-format s] [-rtest type] [-int] [-single]\n" 122 " [-v] [-skip] [-DEBUG] file [file ...]" "\n" 123 " or: libdatrwxxtests --help|-h" "\n" 131 "-DEBUG activate debugging output\n" 132 "-format s test datrwxx::Subformat by passing format string s\n" 133 "-rtest type read files of type \"type\" and report content\n" 134 "-int use integer reading\n" 135 "-single use float reading\n" 136 "-skip skip traces\n" 137 "-error[=n] test error report mechanism (n=0: prints available tests)\n" 138 "file file to be read\n" 142 using namespace tfxx::cmdline;
143 static Declare options[]=
150 {
"format",arg_yes,
"-"},
152 {
"rtest",arg_yes,
"-"},
156 {
"single",arg_no,
"-"},
160 {
"DEBUG",arg_no,
"-"},
162 {
"error",arg_opt,
"0"},
169 cerr << usage_text << endl;
174 Commandline cmdline(iargc, argv, options);
177 if (cmdline.optset(0))
179 cerr << usage_text << endl;
180 cerr << help_text << endl;
193 opt.
debug=cmdline.optset(7);
201 cout <<
"Test format modifiers" << endl;
202 cout <<
"=====================" << endl;
205 cout <<
"data format ID: " << format << endl;
206 reportkey(subformat,
"key1",
"default1");
207 reportkey(subformat,
"key2",
"18.,23.6");
210 if (subformat.allarechecked())
212 cout <<
"All keys have been checked by the program." << endl;
229 cout <<
"Read input files of type: " << opt.
readtype << endl;
230 cout <<
"=========================" << endl;
231 while (cmdline.extra())
233 std::string filename=cmdline.next();
235 cout <<
"read file " << filename << endl;
237 std::ifstream ifs(filename.c_str());
249 cout <<
"file FREE block:" << endl;
251 ::sff::verbose(std::cout, free);
255 cout <<
"file has FREE block" << endl;
260 cout <<
"file has no FREE block" << endl;
266 cout <<
"file SRCE line:" << endl;
268 ::sff::verbose(std::cout, srce);
272 cout <<
"file has SRCE line" << endl;
277 cout <<
"file has no SRCE line" << endl;
300 cout <<
"stream does not provide integer data" << endl;
312 cout <<
"stream does not provide single data" << endl;
324 cout <<
"stream does not provide double data" << endl;
333 cout <<
"trace FREE block:" << endl;
335 ::sff::verbose(std::cout, free);
339 cout <<
"trace has FREE block" << endl;
344 cout <<
"trace has no FREE block" << endl;
350 cout <<
"trace INFO line:" << endl;
352 ::sff::verbose(std::cout, info);
356 cout <<
"trace has INFO line" << endl;
361 cout <<
"trace has no INFO line" << endl;
364 ::sff::verbose(std::cout, wid2);
375 cout <<
"read " << iseries.size() <<
" integer samples" << endl;
380 cout <<
"stream does not provide integer data" << endl;
393 cout <<
"read " << fseries.size()
394 <<
" single precision samples" << endl;
399 cout <<
"stream does not provide single precision data" << endl;
412 cout <<
"read " << dseries.size()
413 <<
" double precision samples" << endl;
418 cout <<
"stream does not provide double precision data" << endl;
423 cout <<
"This was the last trace in file!" << endl;
433 cout <<
"Test error reports (formatting of messages)" << endl;
434 cout <<
"===========================================" << endl;
438 cout <<
"available tests:" << endl;
439 cout <<
"1: non-fatal reports" << endl;
440 cout <<
"2: direct abort" << endl;
441 cout <<
"3: fatal/non-fatal assert (non-fatal version)" << endl;
442 cout <<
"4: fatal/non-fatal assert (fatal version)" << endl;
443 cout <<
"5: standard assertion" << endl;
447 cout <<
"report assert" << endl;
448 cout <<
"-------------" << endl;
450 " a condition to report\n" 451 "that the test fails.");
452 cout <<
"\nwarning" << endl;
453 cout <<
"-------" << endl;
454 DATRW_warning(
"main",
"This is a warning message from a specific" 455 " function in the library.\n" 456 "The macro takes a multiline message output too.");
460 cout <<
"direct abort" << endl;
461 cout <<
"------------" << endl;
463 "A multi-line message my be passed too in this case.\n" 464 "Pass one of the non-specified values for the error\n" 465 "test to see the output for DATRW_illegal.");
469 cout <<
"fatal/non-fatal assert" << endl;
470 cout <<
"----------------------" << endl;
473 "This is a test of a fatal/non-fatal assert.\n" 474 "The error is made non-fatal, if the option" 475 "opt.nerrortest equals 3.\n" 480 cout <<
"standard assertion" << endl;
481 cout <<
"------------------" << endl;
483 "This type of error is emitted," 484 " if an assertion is failed.\n" 485 "Several lines of explanation can be provided" 487 "This can include the output of variables like " 492 cout <<
"no test selected by n=" << opt.
nerrortest << endl;
495 cout <<
"...program did not abort" << endl;
#define DATRW_assert(C, M)
Check an assertion and report by throwing an exception.
aff::Series< float > Tfseries
void reportkey(const datrw::Subformat &f, const std::string k, const std::string d)
void reportprovides(const std::string &type, const bool &flag)
aff::Series< double > Tdseries
#define LIBDATRWXXTESTS_VERSION
Class to read any type of data file.
#define DATRW_warning(N, M)
Report a warning.
#define DATRW_abort(M)
Abort and give a message.
aff::Series< int > Tiseries
std::string clipstring(std::string &s, const std::string &delim)
strip substringStrips off first substring up to given delimiter. The string is passed as a reference ...
#define DATRW_nonfatal_assert(F, C, M)
Macro to distinguish between fatal and non fatal assertions.
void checkkey(const datrw::Subformat &f, const std::string k)
#define DATRW_value(V)
report value
#define DATRW_report_assert(C, M)
Check an assertion and report only.