ProteoWizard
Functions | Variables
ReferencesTest.cpp File Reference
#include "References.hpp"
#include "pwiz/utility/misc/unit.hpp"
#include "pwiz/utility/misc/Std.hpp"
#include "pwiz/utility/minimxml/XMLWriter.hpp"

Go to the source code of this file.

Functions

void testParamContainer ()
 
void testFileDescription ()
 
void testComponentList ()
 
void testInstrumentConfiguration ()
 
void testDataProcessing ()
 
void testScanSettings ()
 
void testPrecursor ()
 
void testProduct ()
 
void testScan ()
 
void testScanList ()
 
void testBinaryDataArray ()
 
void testSpectrum ()
 
void testChromatogram ()
 
void testRun ()
 
void testMSData ()
 
void test ()
 
int main (int argc, char *argv[])
 

Variables

ostream * os_ = 0
 

Function Documentation

void testParamContainer ( )

Definition at line 38 of file ReferencesTest.cpp.

References MS_reflectron_off, MS_reflectron_on, os_, pwiz::data::ParamContainer::paramGroupPtrs, pwiz::msdata::MSData::paramGroupPtrs, pwiz::identdata::References::resolve(), and unit_assert.

39 {
40  if (os_) *os_ << "testParamContainer()\n";
41 
42  ParamContainer pc;
43  pc.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg1")));
44  pc.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg2")));
45 
46  MSData msd;
47  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg2")));
48  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg1")));
49  msd.paramGroupPtrs[0]->cvParams.push_back(MS_reflectron_on);
50  msd.paramGroupPtrs[1]->cvParams.push_back(MS_reflectron_off);
51 
52  unit_assert(pc.paramGroupPtrs[0]->cvParams.empty());
53  unit_assert(pc.paramGroupPtrs[1]->cvParams.empty());
54 
55  References::resolve(pc, msd);
56 
57  unit_assert(pc.paramGroupPtrs[0]->cvParams.size() == 1);
58  unit_assert(pc.paramGroupPtrs[0]->cvParams[0] == MS_reflectron_off);
59  unit_assert(pc.paramGroupPtrs[1]->cvParams.size() == 1);
60  unit_assert(pc.paramGroupPtrs[1]->cvParams[0] == MS_reflectron_on);
61 }
void testFileDescription ( )

Definition at line 64 of file ReferencesTest.cpp.

References pwiz::msdata::FileDescription::contacts, pwiz::msdata::FileDescription::fileContent, os_, pwiz::data::ParamContainer::paramGroupPtrs, pwiz::msdata::MSData::paramGroupPtrs, pwiz::identdata::References::resolve(), pwiz::msdata::FileDescription::sourceFilePtrs, and unit_assert.

65 {
66  if (os_) *os_ << "testFileDescription()\n";
67 
68  FileDescription fd;
69  fd.fileContent.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg1")));
70  fd.sourceFilePtrs.push_back(SourceFilePtr(new SourceFile));
71  fd.sourceFilePtrs.back()->paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg2")));
72  fd.sourceFilePtrs.push_back(SourceFilePtr(new SourceFile));
73  fd.sourceFilePtrs.back()->paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg3")));
74  fd.contacts.push_back(Contact());
75  fd.contacts.back().paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg4")));
76  fd.contacts.push_back(Contact());
77  fd.contacts.back().paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg5")));
78 
79  MSData msd;
80  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg5")));
81  msd.paramGroupPtrs.back()->userParams.push_back(UserParam("user5"));
82  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg4")));
83  msd.paramGroupPtrs.back()->userParams.push_back(UserParam("user4"));
84  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg3")));
85  msd.paramGroupPtrs.back()->userParams.push_back(UserParam("user3"));
86  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg2")));
87  msd.paramGroupPtrs.back()->userParams.push_back(UserParam("user2"));
88  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg1")));
89  msd.paramGroupPtrs.back()->userParams.push_back(UserParam("user1"));
90 
91  References::resolve(fd, msd);
92 
93  unit_assert(!fd.fileContent.paramGroupPtrs[0]->userParams.empty() &&
94  fd.fileContent.paramGroupPtrs[0]->userParams[0].name == "user1");
95 
96  unit_assert(!fd.sourceFilePtrs[0]->paramGroupPtrs[0]->userParams.empty() &&
97  fd.sourceFilePtrs[0]->paramGroupPtrs[0]->userParams[0].name == "user2");
98 
99  unit_assert(!fd.sourceFilePtrs[1]->paramGroupPtrs[0]->userParams.empty() &&
100  fd.sourceFilePtrs[1]->paramGroupPtrs[0]->userParams[0].name == "user3");
101 
102  unit_assert(!fd.contacts[0].paramGroupPtrs[0]->userParams.empty() &&
103  fd.contacts[0].paramGroupPtrs[0]->userParams[0].name == "user4");
104 
105  unit_assert(!fd.contacts[1].paramGroupPtrs[0]->userParams.empty() &&
106  fd.contacts[1].paramGroupPtrs[0]->userParams[0].name == "user5");
107 }
void testComponentList ( )

Definition at line 110 of file ReferencesTest.cpp.

References pwiz::msdata::ComponentList::analyzer(), pwiz::msdata::ComponentType_Analyzer, pwiz::msdata::ComponentType_Detector, pwiz::msdata::ComponentType_Source, pwiz::msdata::ComponentList::detector(), os_, pwiz::data::ParamContainer::paramGroupPtrs, pwiz::msdata::MSData::paramGroupPtrs, pwiz::identdata::References::resolve(), pwiz::msdata::ComponentList::source(), and unit_assert.

111 {
112  if (os_) *os_ << "testComponentList()\n";
113 
114  ComponentList componentList;
115  componentList.push_back(Component(ComponentType_Source, 1));
116  componentList.push_back(Component(ComponentType_Analyzer, 2));
117  componentList.push_back(Component(ComponentType_Detector, 3));
118  componentList.source(0).paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
119  componentList.analyzer(0).paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
120  componentList.detector(0).paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
121 
122  MSData msd;
123  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
124  msd.paramGroupPtrs.back()->userParams.push_back(UserParam("user"));
125 
126  References::resolve(componentList, msd);
127 
128  unit_assert(!componentList.source(0).paramGroupPtrs[0]->userParams.empty());
129  unit_assert(!componentList.analyzer(0).paramGroupPtrs[0]->userParams.empty());
130  unit_assert(!componentList.detector(0).paramGroupPtrs[0]->userParams.empty());
131 }
void testInstrumentConfiguration ( )

Definition at line 134 of file ReferencesTest.cpp.

References pwiz::msdata::InstrumentConfiguration::componentList, pwiz::msdata::ComponentType_Source, os_, pwiz::data::ParamContainer::paramGroupPtrs, pwiz::msdata::MSData::paramGroupPtrs, pwiz::identdata::References::resolve(), pwiz::msdata::InstrumentConfiguration::softwarePtr, pwiz::msdata::MSData::softwarePtrs, pwiz::msdata::ComponentList::source(), and unit_assert.

135 {
136  if (os_) *os_ << "testInstrumentConfiguration()\n";
137 
138  InstrumentConfiguration instrumentConfiguration;
139  instrumentConfiguration.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
140  instrumentConfiguration.componentList.push_back(Component(ComponentType_Source, 1));
141  instrumentConfiguration.componentList.source(0).paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
142  instrumentConfiguration.softwarePtr = SoftwarePtr(new Software("msdata"));
143 
144  MSData msd;
145  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
146  msd.paramGroupPtrs.back()->userParams.push_back(UserParam("user"));
147  msd.softwarePtrs.push_back(SoftwarePtr(new Software("booger")));
148  msd.softwarePtrs.push_back(SoftwarePtr(new Software("msdata")));
149  msd.softwarePtrs[1]->version = "4.20";
150 
151  unit_assert(instrumentConfiguration.softwarePtr->version.empty());
152  unit_assert(instrumentConfiguration.paramGroupPtrs[0]->userParams.empty());
153 
154  References::resolve(instrumentConfiguration, msd);
155 
156  unit_assert(!instrumentConfiguration.paramGroupPtrs[0]->userParams.empty());
157  unit_assert(!instrumentConfiguration.componentList.source(0).paramGroupPtrs[0]->userParams.empty());
158  unit_assert(instrumentConfiguration.softwarePtr->version == "4.20");
159 }
void testDataProcessing ( )

Definition at line 162 of file ReferencesTest.cpp.

References os_, pwiz::msdata::MSData::paramGroupPtrs, pwiz::msdata::DataProcessing::processingMethods, pwiz::identdata::References::resolve(), pwiz::msdata::MSData::softwarePtrs, and unit_assert.

163 {
164  if (os_) *os_ << "testDataProcessing()\n";
165 
166  DataProcessing dataProcessing;
167  dataProcessing.processingMethods.push_back(ProcessingMethod());
168  dataProcessing.processingMethods.back().paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
169  dataProcessing.processingMethods.back().softwarePtr = SoftwarePtr(new Software("msdata"));
170 
171  MSData msd;
172  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
173  msd.paramGroupPtrs.back()->userParams.push_back(UserParam("user"));
174  msd.softwarePtrs.push_back(SoftwarePtr(new Software("booger")));
175  msd.softwarePtrs.push_back(SoftwarePtr(new Software("msdata")));
176  msd.softwarePtrs[1]->version = "4.20";
177 
178  unit_assert(dataProcessing.processingMethods.back().softwarePtr->version.empty());
179  unit_assert(dataProcessing.processingMethods.back().paramGroupPtrs[0]->userParams.empty());
180 
181  References::resolve(dataProcessing, msd);
182 
183  unit_assert(!dataProcessing.processingMethods.back().paramGroupPtrs[0]->userParams.empty());
184  unit_assert(dataProcessing.processingMethods.back().softwarePtr->version == "4.20");
185 }
void testScanSettings ( )

Definition at line 188 of file ReferencesTest.cpp.

References pwiz::msdata::MSData::fileDescription, os_, pwiz::msdata::MSData::paramGroupPtrs, pwiz::identdata::References::resolve(), pwiz::msdata::FileDescription::sourceFilePtrs, pwiz::msdata::ScanSettings::sourceFilePtrs, pwiz::msdata::ScanSettings::targets, and unit_assert.

189 {
190  if (os_) *os_ << "testScanSettings()\n";
191 
192  ScanSettings scanSettings;
193  scanSettings.targets.push_back(Target());
194  scanSettings.targets.back().paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
195  scanSettings.sourceFilePtrs.push_back(SourceFilePtr(new SourceFile("sf2")));
196  scanSettings.sourceFilePtrs.push_back(SourceFilePtr(new SourceFile("sf1")));
197 
198  MSData msd;
199  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
200  msd.paramGroupPtrs.back()->userParams.push_back(UserParam("user"));
201  msd.fileDescription.sourceFilePtrs.push_back(SourceFilePtr(new SourceFile("sf1")));
202  msd.fileDescription.sourceFilePtrs.back()->name = "goo1.raw";
203  msd.fileDescription.sourceFilePtrs.push_back(SourceFilePtr(new SourceFile("sf2")));
204  msd.fileDescription.sourceFilePtrs.back()->name = "goo2.raw";
205 
206  unit_assert(scanSettings.targets.back().paramGroupPtrs[0]->userParams.empty());
207  unit_assert(scanSettings.sourceFilePtrs[0]->name.empty());
208  unit_assert(scanSettings.sourceFilePtrs[1]->name.empty());
209 
210  References::resolve(scanSettings, msd);
211 
212  unit_assert(!scanSettings.targets.back().paramGroupPtrs.empty());
213  unit_assert(!scanSettings.targets.back().paramGroupPtrs[0]->userParams.empty());
214  unit_assert(scanSettings.sourceFilePtrs[0]->name == "goo2.raw");
215  unit_assert(scanSettings.sourceFilePtrs[1]->name == "goo1.raw");
216 }
void testPrecursor ( )

Definition at line 219 of file ReferencesTest.cpp.

References pwiz::msdata::Precursor::activation, pwiz::msdata::Precursor::isolationWindow, os_, pwiz::data::ParamContainer::paramGroupPtrs, pwiz::msdata::MSData::paramGroupPtrs, pwiz::identdata::References::resolve(), pwiz::msdata::Precursor::selectedIons, and unit_assert.

220 {
221  if (os_) *os_ << "testPrecursor()\n";
222 
223  Precursor precursor;
224  precursor.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
225  precursor.selectedIons.resize(1);
226  precursor.selectedIons[0].paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
227  precursor.activation.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
228  precursor.isolationWindow.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
229 
230  MSData msd;
231  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
232  msd.paramGroupPtrs.back()->userParams.push_back(UserParam("user"));
233 
234  unit_assert(precursor.paramGroupPtrs[0]->userParams.empty());
235  unit_assert(precursor.selectedIons[0].paramGroupPtrs[0]->userParams.empty());
236  unit_assert(precursor.activation.paramGroupPtrs[0]->userParams.empty());
237  unit_assert(precursor.isolationWindow.paramGroupPtrs[0]->userParams.empty());
238 
239  References::resolve(precursor, msd);
240 
241  unit_assert(!precursor.paramGroupPtrs[0]->userParams.empty());
242  unit_assert(!precursor.selectedIons[0].paramGroupPtrs[0]->userParams.empty());
243  unit_assert(!precursor.activation.paramGroupPtrs[0]->userParams.empty());
244  unit_assert(!precursor.isolationWindow.paramGroupPtrs[0]->userParams.empty());
245 }
void testProduct ( )

Definition at line 248 of file ReferencesTest.cpp.

References pwiz::msdata::Product::isolationWindow, os_, pwiz::data::ParamContainer::paramGroupPtrs, pwiz::msdata::MSData::paramGroupPtrs, pwiz::identdata::References::resolve(), and unit_assert.

249 {
250  if (os_) *os_ << "testProduct()\n";
251 
252  Product product;
253  product.isolationWindow.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
254 
255  MSData msd;
256  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
257  msd.paramGroupPtrs.back()->userParams.push_back(UserParam("user"));
258 
259  unit_assert(product.isolationWindow.paramGroupPtrs[0]->userParams.empty());
260 
261  References::resolve(product, msd);
262 
263  unit_assert(!product.isolationWindow.paramGroupPtrs[0]->userParams.empty());
264 }
void testScan ( )

Definition at line 267 of file ReferencesTest.cpp.

References pwiz::msdata::Scan::instrumentConfigurationPtr, pwiz::msdata::MSData::instrumentConfigurationPtrs, os_, pwiz::data::ParamContainer::paramGroupPtrs, pwiz::msdata::MSData::paramGroupPtrs, pwiz::identdata::References::resolve(), pwiz::msdata::Scan::scanWindows, and unit_assert.

268 {
269  if (os_) *os_ << "testScan()\n";
270 
271  Scan scan;
272  scan.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
274  scan.scanWindows.push_back(ScanWindow());
275  scan.scanWindows.back().paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
276 
277  MSData msd;
278  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
279  msd.paramGroupPtrs.back()->userParams.push_back(UserParam("user"));
280  msd.instrumentConfigurationPtrs.push_back(InstrumentConfigurationPtr(new InstrumentConfiguration("instrumentConfiguration")));
281  msd.instrumentConfigurationPtrs.back()->userParams.push_back(UserParam("user"));
282 
283  unit_assert(scan.paramGroupPtrs[0]->userParams.empty());
284  unit_assert(scan.instrumentConfigurationPtr->userParams.empty());
285  unit_assert(scan.scanWindows.back().paramGroupPtrs.back()->userParams.empty());
286 
287  References::resolve(scan, msd);
288 
289  unit_assert(!scan.paramGroupPtrs[0]->userParams.empty());
290  unit_assert(!scan.instrumentConfigurationPtr->userParams.empty());
291  unit_assert(!scan.scanWindows.back().paramGroupPtrs.back()->userParams.empty());
292 }
void testScanList ( )

Definition at line 295 of file ReferencesTest.cpp.

References os_, pwiz::data::ParamContainer::paramGroupPtrs, pwiz::msdata::MSData::paramGroupPtrs, pwiz::identdata::References::resolve(), pwiz::msdata::ScanList::scans, and unit_assert.

296 {
297  if (os_) *os_ << "testScanList()\n";
298 
299  ScanList scanList;
300  scanList.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
301 
302  scanList.scans.push_back(Scan());
303  Scan& scan = scanList.scans.back();
304  scan.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
305 
306  MSData msd;
307  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
308  msd.paramGroupPtrs.back()->userParams.push_back(UserParam("user"));
309 
310  unit_assert(scanList.paramGroupPtrs[0]->userParams.empty());
311  unit_assert(scan.paramGroupPtrs[0]->userParams.empty());
312 
313  References::resolve(scanList, msd);
314 
315  unit_assert(!scanList.paramGroupPtrs[0]->userParams.empty());
316  unit_assert(!scan.paramGroupPtrs[0]->userParams.empty());
317 }
void testBinaryDataArray ( )

Definition at line 320 of file ReferencesTest.cpp.

References pwiz::msdata::BinaryDataArray::dataProcessingPtr, pwiz::msdata::MSData::dataProcessingPtrs, os_, pwiz::data::ParamContainer::paramGroupPtrs, pwiz::msdata::MSData::paramGroupPtrs, pwiz::identdata::References::resolve(), and unit_assert.

321 {
322  if (os_) *os_ << "testBinaryDataArray()\n";
323 
324  BinaryDataArray binaryDataArray;
325  binaryDataArray.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
326  binaryDataArray.dataProcessingPtr = DataProcessingPtr(new DataProcessing("msdata"));
327 
328  MSData msd;
329  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
330  msd.paramGroupPtrs.back()->userParams.push_back(UserParam("user"));
331  msd.dataProcessingPtrs.push_back(DataProcessingPtr(new DataProcessing("msdata")));
332  msd.dataProcessingPtrs.back()->processingMethods.push_back(ProcessingMethod());
333  msd.dataProcessingPtrs.back()->processingMethods.back().softwarePtr = SoftwarePtr(new Software("software"));
334 
335  unit_assert(binaryDataArray.paramGroupPtrs.back()->userParams.empty());
336  unit_assert(binaryDataArray.dataProcessingPtr->processingMethods.empty());
337 
338  References::resolve(binaryDataArray, msd);
339 
340  unit_assert(!binaryDataArray.paramGroupPtrs.back()->userParams.empty());
341  unit_assert(binaryDataArray.dataProcessingPtr->processingMethods.size() == 1);
342  unit_assert(binaryDataArray.dataProcessingPtr->processingMethods.back().softwarePtr.get());
343 }
void testSpectrum ( )

Definition at line 346 of file ReferencesTest.cpp.

References pwiz::msdata::Spectrum::binaryDataArrayPtrs, pwiz::msdata::Spectrum::dataProcessingPtr, pwiz::msdata::MSData::dataProcessingPtrs, pwiz::msdata::MSData::fileDescription, os_, pwiz::data::ParamContainer::paramGroupPtrs, pwiz::msdata::MSData::paramGroupPtrs, pwiz::msdata::Spectrum::precursors, pwiz::msdata::Spectrum::products, pwiz::identdata::References::resolve(), pwiz::msdata::Spectrum::scanList, pwiz::msdata::Spectrum::sourceFilePtr, pwiz::msdata::FileDescription::sourceFilePtrs, and unit_assert.

347 {
348  if (os_) *os_ << "testSpectrum()\n";
349 
350  Spectrum spectrum;
351  spectrum.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
352  spectrum.dataProcessingPtr = DataProcessingPtr(new DataProcessing("dp"));
353  spectrum.sourceFilePtr = SourceFilePtr(new SourceFile("sf"));
354  spectrum.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
355 
356  spectrum.scanList.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
357  spectrum.precursors.push_back(Precursor());
358  spectrum.precursors.back().paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
359  spectrum.products.push_back(Product());
360  spectrum.products.back().isolationWindow.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
361 
362  spectrum.binaryDataArrayPtrs.push_back(BinaryDataArrayPtr(new BinaryDataArray));
363  spectrum.binaryDataArrayPtrs.back()->paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
364 
365 
366  MSData msd;
367  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
368  msd.paramGroupPtrs.back()->userParams.push_back(UserParam("user"));
369  msd.dataProcessingPtrs.push_back(DataProcessingPtr(new DataProcessing("dp")));
370  msd.dataProcessingPtrs.back()->processingMethods.push_back(ProcessingMethod());
371  msd.dataProcessingPtrs.back()->processingMethods.back().softwarePtr = SoftwarePtr(new Software("software"));
372  msd.fileDescription.sourceFilePtrs.push_back(SourceFilePtr(new SourceFile("sf")));
373  msd.fileDescription.sourceFilePtrs.back()->name = "goo.raw";
374 
375  unit_assert(spectrum.paramGroupPtrs.back()->userParams.empty());
376  unit_assert(spectrum.dataProcessingPtr->processingMethods.empty());
377  unit_assert(spectrum.sourceFilePtr->name.empty());
378  unit_assert(spectrum.paramGroupPtrs.back()->userParams.empty());
379  unit_assert(spectrum.scanList.paramGroupPtrs.back()->userParams.empty());
380  unit_assert(spectrum.precursors.back().paramGroupPtrs.back()->userParams.empty());
381  unit_assert(spectrum.products.back().isolationWindow.paramGroupPtrs.back()->userParams.empty());
382  unit_assert(spectrum.binaryDataArrayPtrs.back()->paramGroupPtrs.back()->userParams.empty());
383 
384  References::resolve(spectrum, msd);
385 
386  unit_assert(!spectrum.paramGroupPtrs.back()->userParams.empty());
387  unit_assert(spectrum.dataProcessingPtr->processingMethods.size() == 1);
388  unit_assert(spectrum.dataProcessingPtr->processingMethods.back().softwarePtr.get());
389  unit_assert(spectrum.sourceFilePtr->name == "goo.raw");
390  unit_assert(!spectrum.paramGroupPtrs.back()->userParams.empty());
391  unit_assert(!spectrum.scanList.paramGroupPtrs.back()->userParams.empty());
392  unit_assert(!spectrum.precursors.back().paramGroupPtrs.back()->userParams.empty());
393  unit_assert(!spectrum.products.back().isolationWindow.paramGroupPtrs.back()->userParams.empty());
394  unit_assert(!spectrum.binaryDataArrayPtrs.back()->paramGroupPtrs.back()->userParams.empty());
395 }
void testChromatogram ( )

Definition at line 398 of file ReferencesTest.cpp.

References pwiz::msdata::Chromatogram::binaryDataArrayPtrs, pwiz::msdata::Chromatogram::dataProcessingPtr, pwiz::msdata::MSData::dataProcessingPtrs, os_, pwiz::data::ParamContainer::paramGroupPtrs, pwiz::msdata::MSData::paramGroupPtrs, pwiz::identdata::References::resolve(), and unit_assert.

399 {
400  if (os_) *os_ << "testChromatogram()\n";
401 
402  Chromatogram chromatogram;
403  chromatogram.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
404  chromatogram.dataProcessingPtr = DataProcessingPtr(new DataProcessing("dp"));
405  chromatogram.binaryDataArrayPtrs.push_back(BinaryDataArrayPtr(new BinaryDataArray));
406  chromatogram.binaryDataArrayPtrs.back()->paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
407 
408  MSData msd;
409  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
410  msd.paramGroupPtrs.back()->userParams.push_back(UserParam("user"));
411  msd.dataProcessingPtrs.push_back(DataProcessingPtr(new DataProcessing("dp")));
412  msd.dataProcessingPtrs.back()->processingMethods.push_back(ProcessingMethod());
413  msd.dataProcessingPtrs.back()->processingMethods.back().softwarePtr = SoftwarePtr(new Software("software"));
414 
415  unit_assert(chromatogram.paramGroupPtrs.back()->userParams.empty());
416  unit_assert(chromatogram.dataProcessingPtr->processingMethods.empty());
417  unit_assert(chromatogram.binaryDataArrayPtrs.back()->paramGroupPtrs.back()->userParams.empty());
418 
419  References::resolve(chromatogram, msd);
420 
421  unit_assert(!chromatogram.paramGroupPtrs.back()->userParams.empty());
422  unit_assert(chromatogram.dataProcessingPtr->processingMethods.size() == 1);
423  unit_assert(chromatogram.dataProcessingPtr->processingMethods.back().softwarePtr.get());
424  unit_assert(!chromatogram.binaryDataArrayPtrs.back()->paramGroupPtrs.back()->userParams.empty());
425 }
void testRun ( )

Definition at line 428 of file ReferencesTest.cpp.

References pwiz::msdata::Run::defaultInstrumentConfigurationPtr, pwiz::msdata::Run::defaultSourceFilePtr, pwiz::msdata::MSData::fileDescription, pwiz::msdata::MSData::instrumentConfigurationPtrs, os_, pwiz::data::ParamContainer::paramGroupPtrs, pwiz::msdata::MSData::paramGroupPtrs, pwiz::identdata::References::resolve(), pwiz::msdata::Run::samplePtr, pwiz::msdata::MSData::samplePtrs, pwiz::msdata::FileDescription::sourceFilePtrs, and unit_assert.

429 {
430  if (os_) *os_ << "testRun()\n";
431 
432  Run run;
433  run.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
435  run.samplePtr = SamplePtr(new Sample("sample"));
437 
438  MSData msd;
439  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
440  msd.paramGroupPtrs.back()->userParams.push_back(UserParam("user"));
441  msd.instrumentConfigurationPtrs.push_back(InstrumentConfigurationPtr(new InstrumentConfiguration("instrumentConfiguration")));
442  msd.instrumentConfigurationPtrs.back()->userParams.push_back(UserParam("user"));
443  msd.samplePtrs.push_back(SamplePtr(new Sample("sample")));
444  msd.samplePtrs.back()->name = "sample name";
445  msd.fileDescription.sourceFilePtrs.push_back(SourceFilePtr(new SourceFile("sf1")));
446  msd.fileDescription.sourceFilePtrs.back()->name = "goo1.raw";
447  msd.fileDescription.sourceFilePtrs.push_back(SourceFilePtr(new SourceFile("sf2")));
448  msd.fileDescription.sourceFilePtrs.back()->name = "goo2.raw";
449 
450  unit_assert(run.paramGroupPtrs.back()->userParams.empty());
451  unit_assert(run.defaultInstrumentConfigurationPtr->userParams.empty());
452  unit_assert(run.samplePtr->name.empty());
453  unit_assert(run.defaultSourceFilePtr->name.empty());
454 
455  References::resolve(run, msd);
456 
457  unit_assert(!run.paramGroupPtrs.back()->userParams.empty());
458  unit_assert(!run.defaultInstrumentConfigurationPtr->userParams.empty());
459  unit_assert(run.samplePtr->name == "sample name");
460  unit_assert(run.defaultSourceFilePtr->name == "goo2.raw");
461 }
void testMSData ( )

Definition at line 464 of file ReferencesTest.cpp.

References pwiz::msdata::MSData::dataProcessingPtrs, pwiz::msdata::FileDescription::fileContent, pwiz::msdata::MSData::fileDescription, pwiz::msdata::MSData::instrumentConfigurationPtrs, os_, pwiz::data::ParamContainer::paramGroupPtrs, pwiz::msdata::MSData::paramGroupPtrs, pwiz::identdata::References::resolve(), pwiz::msdata::MSData::run, pwiz::msdata::MSData::samplePtrs, and unit_assert.

465 {
466  if (os_) *os_ << "testMSData()\n";
467 
468  MSData msd;
469 
471  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
472  msd.paramGroupPtrs.back()->userParams.push_back(UserParam("user"));
473  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg1")));
474  msd.paramGroupPtrs.back()->paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
475  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg2")));
476  msd.paramGroupPtrs.back()->paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
477  msd.samplePtrs.push_back(SamplePtr(new Sample("sample")));
478  msd.samplePtrs.back()->paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
479  msd.instrumentConfigurationPtrs.push_back(InstrumentConfigurationPtr(new InstrumentConfiguration("instrumentConfiguration")));
480  msd.instrumentConfigurationPtrs.back()->paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
481  msd.dataProcessingPtrs.push_back(DataProcessingPtr(new DataProcessing("dp")));
482  msd.dataProcessingPtrs.back()->processingMethods.push_back(ProcessingMethod());
483  msd.dataProcessingPtrs.back()->processingMethods.back().paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
484  msd.run.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
485 
486  unit_assert(msd.paramGroupPtrs[1]->paramGroupPtrs.back()->userParams.empty());
487  unit_assert(msd.paramGroupPtrs[2]->paramGroupPtrs.back()->userParams.empty());
488  unit_assert(msd.samplePtrs.back()->paramGroupPtrs.back()->userParams.empty());
489  unit_assert(msd.instrumentConfigurationPtrs.back()->paramGroupPtrs.back()->userParams.empty());
490  unit_assert(msd.dataProcessingPtrs.back()->processingMethods.back().paramGroupPtrs.back()->userParams.empty());
491  unit_assert(msd.run.paramGroupPtrs.back()->userParams.empty());
492 
493  References::resolve(msd);
494 
495  unit_assert(!msd.paramGroupPtrs[1]->paramGroupPtrs.back()->userParams.empty());
496  unit_assert(!msd.paramGroupPtrs[2]->paramGroupPtrs.back()->userParams.empty());
497  unit_assert(!msd.samplePtrs.back()->paramGroupPtrs.back()->userParams.empty());
498  unit_assert(!msd.instrumentConfigurationPtrs.back()->paramGroupPtrs.back()->userParams.empty());
499  unit_assert(!msd.dataProcessingPtrs.back()->processingMethods.back().paramGroupPtrs.back()->userParams.empty());
500  unit_assert(!msd.run.paramGroupPtrs.back()->userParams.empty());
501 }
void test ( )
int main ( int  argc,
char *  argv[] 
)

Definition at line 524 of file ReferencesTest.cpp.

References os_, test(), TEST_EPILOG, TEST_FAILED, and TEST_PROLOG_EX.

525 {
526  TEST_PROLOG_EX(argc, argv, "_MSData")
527 
528  try
529  {
530  if (argc>1 && !strcmp(argv[1],"-v")) os_ = &cout;
531  test();
532  }
533  catch (exception& e)
534  {
535  TEST_FAILED(e.what())
536  }
537  catch (...)
538  {
539  TEST_FAILED("Caught unknown exception.")
540  }
541 
543 }

Variable Documentation

ostream* os_ = 0

Definition at line 35 of file ReferencesTest.cpp.