32 using namespace pwiz::msdata;
33 using namespace pwiz::util;
34 using namespace pwiz::minimxml;
42 if (
os_) *
os_ <<
"test(): indexed=\"" << boolalpha << indexed <<
"\"\n";
52 serializer.
write(oss, tiny);
54 if (
os_) *
os_ <<
"oss:\n" << oss.str() << endl;
56 shared_ptr<istream> is(
new istringstream(oss.str()));
66 pg1->id =
"CommonMS1SpectrumParams";
72 pg2->id =
"CommonMS2SpectrumParams";
89 IndexList indexList = sl->findNameValue(
"scan",
"19");
90 unit_assert(indexList.size()==1 && indexList[0]==0);
92 indexList = sl->findNameValue(
"scan",
"20");
93 unit_assert(indexList.size()==1 && indexList[0]==1);
95 indexList = sl->findNameValue(
"scan",
"21");
96 unit_assert(indexList.size()==1 && indexList[0]==2);
97 unit_assert(sl->find(
"sample=1 period=1 cycle=23 experiment=1") == 4);
98 indexList = sl->findNameValue(
"sample",
"1");
99 unit_assert(indexList.size()==1 && indexList[0]==4);
100 indexList = sl->findNameValue(
"period",
"1");
101 unit_assert(indexList.size()==1 && indexList[0]==4);
102 indexList = sl->findNameValue(
"cycle",
"23");
103 unit_assert(indexList.size()==1 && indexList[0]==4);
104 indexList = sl->findNameValue(
"experiment",
"1");
105 unit_assert(indexList.size()==1 && indexList[0]==4);
108 IndexList spotIndexList = sl->findSpotID(
"A1,42x42,4242x4242");
123 unit_assert(sl->spectrumIdentity(0).id ==
"scan=19");
124 unit_assert(sl->spectrumIdentity(0).spotID.empty());
126 s = sl->spectrum(0,
true);
128 vector<MZIntensityPair> pairs;
129 s->getMZIntensityPairs(pairs);
131 for (
int i=0; i<15; i++)
136 unit_assert(s->paramGroupPtrs.back()->id ==
"CommonMS1SpectrumParams");
137 unit_assert(s->paramGroupPtrs.back()->cvParams.size() == 2);
141 s = sl->spectrum(1,
true);
148 unit_assert(sl->spectrumIdentity(1).id ==
"scan=20");
149 unit_assert(sl->spectrumIdentity(1).spotID.empty());
152 s->getMZIntensityPairs(pairs);
154 for (
int i=0; i<10; i++)
155 unit_assert(pairs[i].
mz==2*i && pairs[i].intensity==(10-i)*2);
159 unit_assert(s->paramGroupPtrs.back()->id ==
"CommonMS2SpectrumParams");
160 unit_assert(s->paramGroupPtrs.back()->cvParams.size() == 2);
163 s = sl->spectrum(4,
true);
165 unit_assert(s->id ==
"sample=1 period=1 cycle=23 experiment=1");
170 unit_assert(sl->spectrumIdentity(4).id ==
"sample=1 period=1 cycle=23 experiment=1");
171 unit_assert(sl->spectrumIdentity(4).spotID ==
"A1,42x42,4242x4242");
185 int main(
int argc,
char* argv[])
191 if (argc>1 && !strcmp(argv[1],
"-v"))
os_ = &cout;