ProteoWizard
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
DemuxDebugRWTest Class Reference

Public Member Functions

void Run ()
 

Protected Member Functions

void ReadWriteTest ()
 
void SetUp ()
 
void TearDown ()
 

Protected Attributes

vector< MatrixPtrspectrumList_
 
MatrixPtr A_
 
MatrixPtr B_
 
MatrixPtr C_
 

Detailed Description

Definition at line 30 of file DemuxDebugReadWriteTest.cpp.

Member Function Documentation

◆ Run()

void DemuxDebugRWTest::Run ( )
inline

Definition at line 34 of file DemuxDebugReadWriteTest.cpp.

Referenced by main().

◆ ReadWriteTest()

void DemuxDebugRWTest::ReadWriteTest ( )
inlineprotected

Definition at line 43 of file DemuxDebugReadWriteTest.cpp.

References pwiz::analysis::DemuxDebugWriter::IsOpen(), pwiz::analysis::DemuxDebugReader::IsOpen(), pwiz::analysis::DemuxDebugReader::NumBlocks(), pwiz::analysis::DemuxDebugReader::ReadDeconvBlock(), unit_assert, unit_assert_operator_equal, and pwiz::analysis::DemuxDebugWriter::WriteDeconvBlock().

44  {
45  { // Use scope to ensure deletion of debug writer to close output file
46  DemuxDebugWriter debugWriter("DemuxDebugOutput_TestOut.log");
47  unit_assert(debugWriter.IsOpen());
48 
49  for (size_t i = 0; i < spectrumList_.size(); i += 3)
50  {
51  debugWriter.WriteDeconvBlock(i, spectrumList_.at(i), spectrumList_.at(i + 1), spectrumList_.at(i + 2));
52  }
53  }
54 
55  vector<MatrixPtr> readSpectrumList;
56 
57  DemuxDebugReader debugReader("DemuxDebugOutput_TestOut.log");
58  unit_assert(debugReader.IsOpen());
59  unit_assert_operator_equal(3 * debugReader.NumBlocks(), spectrumList_.size());
60 
61  uint64_t spectrumIndex;
62  for (size_t i = 0; i < debugReader.NumBlocks(); ++i)
63  {
64  debugReader.ReadDeconvBlock(spectrumIndex, A_, B_, C_);
65  readSpectrumList.push_back(A_);
66  readSpectrumList.push_back(B_);
67  readSpectrumList.push_back(C_);
68  }
69 
70  unit_assert_operator_equal(readSpectrumList.size(), spectrumList_.size());
71 
72  for (size_t i = 0; i < readSpectrumList.size(); ++i)
73  {
74  unit_assert(spectrumList_.at(i)->isApprox(*readSpectrumList.at(i)));
75  }
76  }
vector< MatrixPtr > spectrumList_
A class for reading demux matrices from file.
A class for writing demux matrices to file.
#define unit_assert_operator_equal(expected, actual)
Definition: unit.hpp:92
#define unit_assert(x)
Definition: unit.hpp:85

◆ SetUp()

void DemuxDebugRWTest::SetUp ( )
inlineprotected

Definition at line 78 of file DemuxDebugReadWriteTest.cpp.

References D, and F.

78  {
79  // Generate a list of spectra
80  A_ = boost::make_shared<MatrixType>(3, 4);
81  B_ = boost::make_shared<MatrixType>(4, 3);
82  C_ = boost::make_shared<MatrixType>(3, 3);
83  *A_ << -14.834628974133, -15.729764770592, 56.292839002858, 30.766363712773,
84  79.595747995303, -8.356622426449, 20.840197237638, 83.801095382748,
85  87.889866880787, 13.75327399942, 86.730656404499, -0.46420627108677;
86 
87  *B_ << 23.588885367543, 49.667231605868, -86.700220187964,
88  51.392601274063, -77.511392742378, 23.389497301117,
89  -78.475202879706, -62.60684915327, -42.39206607192,
90  59.595164405161, 2.1025961854091, 65.787705013259;
91 
92  *C_ = *A_ * *B_;
93 
94  spectrumList_.push_back(A_);
95  spectrumList_.push_back(B_);
96  spectrumList_.push_back(C_);
97 
98  MatrixPtr D = boost::make_shared<MatrixType>(3, 4);
99  MatrixPtr E = boost::make_shared<MatrixType>(4, 3);
100  MatrixPtr F = boost::make_shared<MatrixType>(3, 3);
101 
102  *D = 5 * A_->eval();
103  *E = 3 * B_->eval();
104  *F = *A_ * *B_;
105 
106  spectrumList_.push_back(A_);
107  spectrumList_.push_back(B_);
108  spectrumList_.push_back(C_);
109  }
vector< MatrixPtr > spectrumList_
boost::shared_ptr< MatrixType > MatrixPtr
Definition: DemuxTypes.hpp:39
#define D
F
Definition: Chemistry.hpp:80

◆ TearDown()

void DemuxDebugRWTest::TearDown ( )
inlineprotected

Definition at line 111 of file DemuxDebugReadWriteTest.cpp.

112  {
113  remove("DemuxDebugOutput_TestOut.log");
114  }

Member Data Documentation

◆ spectrumList_

vector<MatrixPtr> DemuxDebugRWTest::spectrumList_
protected

Definition at line 116 of file DemuxDebugReadWriteTest.cpp.

◆ A_

MatrixPtr DemuxDebugRWTest::A_
protected

Definition at line 117 of file DemuxDebugReadWriteTest.cpp.

◆ B_

MatrixPtr DemuxDebugRWTest::B_
protected

Definition at line 118 of file DemuxDebugReadWriteTest.cpp.

◆ C_

MatrixPtr DemuxDebugRWTest::C_
protected

Definition at line 119 of file DemuxDebugReadWriteTest.cpp.


The documentation for this class was generated from the following file: