Commit db87a21e authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

new test stage: ianystream

This is a legacy commit from before 2015-03-01.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 1608
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 42521648
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: hpmotest.cc,v 1.10 2004-12-23 14:03:34 tforb Exp $
* $Id: hpmotest.cc,v 1.11 2004-12-23 14:48:54 tforb Exp $
* \author Thomas Forbriger
* \date 21/12/2004
*
......@@ -19,7 +19,7 @@
#define HPMOTEST_VERSION \
"HPMOTEST V1.0 test hpmo reading functions"
#define HPMOTEST_CVSID \
"$Id: hpmotest.cc,v 1.10 2004-12-23 14:03:34 tforb Exp $"
"$Id: hpmotest.cc,v 1.11 2004-12-23 14:48:54 tforb Exp $"
#include <fstream>
#include <iostream>
......@@ -27,6 +27,7 @@
#include <datreadxx/error.h>
#include <datreadxx/readhpmo.h>
#include <datreadxx/hpmo.h>
#include <datreadxx/readany.h>
#include <aff/dump.h>
using std::cout;
......@@ -34,7 +35,7 @@ using std::cerr;
using std::endl;
struct Options {
bool verbose, stage1, stage2, stage3, extractsamples;
bool verbose, stage1, stage2, stage3, extractsamples, stage4;
}; // struct Options
int main(int iargc, char* argv[])
......@@ -57,7 +58,8 @@ int main(int iargc, char* argv[])
"-s1 test reading functions of stage 1" "\n"
"-s2 test reading functions of stage 2" "\n"
"-s3 test reading functions of stage 3" "\n"
"-x extract samples in stage 3" "\n"
"-s4 test reading functions of stage 4" "\n"
"-x extract samples in stage 3 and 4" "\n"
};
// define commandline options
......@@ -76,6 +78,8 @@ int main(int iargc, char* argv[])
{"s3",arg_no,"-"},
// 5: extract samples
{"x",arg_no,"-"},
// 6: test stage 4
{"s4",arg_no,"-"},
{NULL}
};
......@@ -126,6 +130,7 @@ int main(int iargc, char* argv[])
opt.stage2=cmdline.optset(3);
opt.stage3=cmdline.optset(4);
opt.extractsamples=cmdline.optset(5);
opt.stage4=cmdline.optset(6);
DATREAD_assert(cmdline.extra(), "missing filename!");
std::string infile=cmdline.next();
......@@ -232,6 +237,43 @@ int main(int iargc, char* argv[])
if (opt.extractsamples) { DUMP( data ); }
}
}
/*----------------------------------------------------------------------*/
if (opt.stage4)
{
if (opt.verbose)
{
cout << endl << "TEST: stage 4" << endl
<< "=============" << endl;
}
std::ifstream ifs(infile.c_str());
DATREAD_assert(ifs.good(), "invalid file!");
datread::ianystream is(ifs, datread::Fhpmo);
sff::FREE filefree;
is >> filefree;
cout << filefree;
while (is.good())
{
datread::Tfseries data;
if (opt.extractsamples)
{
is >> data;
}
else
{
is.skipseries();
}
sff::WID2 wid2line;
cout << std::endl << "next trace: " << std::endl;
is >> wid2line;
cout << wid2line;
sff::FREE tracefree;
is >> tracefree;
cout << tracefree;
if (opt.extractsamples) { DUMP( data ); }
}
}
}
/* ----- END OF hpmotest.cc ----- */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment