GSE++ library: reading and writing GSE waveforms

◆ test_chk2()

void GSE2::tests::test_chk2 ( )

Test the TCHK2 class.

See also
GSE2::waveform::TCHK2

Definition at line 126 of file gsexx_tests.cc.

References GSE2::waveform::TCHK2::add(), GSE2::waveform::TCHK2::value(), and GSE2::waveform::TCHK2::write().

Referenced by main().

127 {
128  std::cout << std::endl;
129  std::cout << "Test the checksum algorithm."
130  << std::endl;
131 
132  // number of test values
133  const int nval=30;
134  // declare checksum object
135  waveform::TCHK2 checksum;
136 
137  for (int j=0; j<3; j++)
138  {
139  waveform::intT val=1;
140  for (int i=0; i<nval; i++)
141  {
142  checksum.add(val);
143  // print results
144  std::cout.width(3); std::cout << j << ",";
145  std::cout.width(2);
146  std::cout << i << " " << "value=";
147  std::cout.width(11);
148  std::cout << val << " " << "checksum=";
149  std::cout.width(10); std::cout << checksum.value() << std::endl;
150  // increase sample value in powers of two
151  val*=2;
152  }
153  }
154 
155  std::cout << checksum.write();
156 } // function test_chk2
int intT
All GSE2 waveform data is based on 4 byte integers.
Definition: gsexx.h:89
Here is the call graph for this function:
Here is the caller graph for this function: