33 #define TF_GSEXX_TESTS_CC_VERSION \ 34 "TF_GSEXX_TESTS_CC V1.0 " 35 #define TF_GSEXX_TESTS_CC_CVSID \ 51 #define TESTCODE( ARG ) cout << #ARG << endl; ARG 79 std::cout << std::endl;
81 <<
"Test the template metaprograms that apply and remove differences." 85 int values[] = { 1,3,5,7,3,-2,-4,6 };
94 for (
int i=0; i<nval; i++)
97 int v1st=diff1st(values[i]);
99 int v2nd=diff2nd(values[i]);
101 int v1strem=rem1st(v1st);
103 int v2ndrem=rem2nd(v2nd);
105 std::cout.width(3); std::cout << i <<
" " <<
"value=";
106 std::cout.width(3); std::cout << values[i] <<
" " <<
"1st diff=";
107 std::cout.width(3); std::cout << v1st <<
" " <<
"1st rem=";
108 std::cout.width(3); std::cout << v1strem <<
" " <<
"2nd diff=";
109 std::cout.width(3); std::cout << v2nd <<
" " <<
"2nd rem=";
110 std::cout.width(3); std::cout << v2ndrem <<
" ";
111 std::cout << std::endl;
128 std::cout << std::endl;
129 std::cout <<
"Test the checksum algorithm." 137 for (
int j=0; j<3; j++)
140 for (
int i=0; i<nval; i++)
144 std::cout.width(3); std::cout << j <<
",";
146 std::cout << i <<
" " <<
"value=";
148 std::cout << val <<
" " <<
"checksum=";
149 std::cout.width(10); std::cout << checksum.
value() << std::endl;
155 std::cout << checksum.
write();
165 std::cout << std::endl;
166 std::cout <<
"Test the DAT2 class with CM6 subformat." 168 std::cout <<
"1. write waveform" 171 const int msamples=2000;
173 int indata[msamples];
174 for (
int i=0; i<msamples; i++)
176 data[i]=int(1.e5*std::sin(i*2.*3.141592653*5./(msamples-35)));
186 std::cout << wid2line.
line();
194 std::cerr <<
"ERROR: missed last sample!" << std::endl;
197 std::cout << writer(data[i]);
203 std::ofstream os(
"junk.dat");
204 os << wid2line.
line();
207 while (fwriter.
hot())
211 std::cerr <<
"ERROR: missed last sample!" << std::endl;
214 os << fwriter(data[i]);
221 std::cerr <<
"manipulate junk.dat - if you like to..." << std::endl;
235 std::ifstream is(
"junk.dat");
237 newwid2line.
read(is);
239 while (freader.
hot())
243 std::cerr <<
"ERROR: missed last sample!" << std::endl;
246 indata[i] =freader(is);
253 std::ofstream os(
"junk2.dat");
254 os << newwid2line.
line();
257 while (fwriter.
hot())
261 std::cerr <<
"ERROR: missed last sample!" << std::endl;
264 os << fwriter(indata[i]);
282 std::cout <<
"This is a program to test the GSE2-module components." <<
294 std::cerr << e.
message() << std::endl;
GSE++ library: read and write GSE waveform data (prototypes).
void test_diff()
Test the template metaprograms that apply and remove differences.
const std::string & message() const
return error message
void test_chk2()
Test the TCHK2 class.
All stuff defined by the GSE2 standard.
int main()
Main program calling all test functions.
Base class for all exceptions in this module.
static bool silent
be silent?