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";
71 pg2->id =
"CommonMS2SpectrumParams";
87 IndexList indexList = sl->findNameValue(
"scan",
"19");
88 unit_assert(indexList.size()==1 && indexList[0]==0);
90 indexList = sl->findNameValue(
"scan",
"20");
91 unit_assert(indexList.size()==1 && indexList[0]==1);
93 indexList = sl->findNameValue(
"scan",
"21");
94 unit_assert(indexList.size()==1 && indexList[0]==2);
95 unit_assert(sl->find(
"sample=1 period=1 cycle=23 experiment=1") == 4);
96 indexList = sl->findNameValue(
"sample",
"1");
97 unit_assert(indexList.size()==1 && indexList[0]==4);
98 indexList = sl->findNameValue(
"period",
"1");
99 unit_assert(indexList.size()==1 && indexList[0]==4);
100 indexList = sl->findNameValue(
"cycle",
"23");
101 unit_assert(indexList.size()==1 && indexList[0]==4);
102 indexList = sl->findNameValue(
"experiment",
"1");
103 unit_assert(indexList.size()==1 && indexList[0]==4);
106 IndexList spotIndexList = sl->findSpotID(
"A1,42x42,4242x4242");
121 unit_assert(sl->spectrumIdentity(0).id ==
"scan=19");
122 unit_assert(sl->spectrumIdentity(0).spotID.empty());
124 s = sl->spectrum(0,
true);
126 vector<MZIntensityPair> pairs;
127 s->getMZIntensityPairs(pairs);
129 for (
int i=0; i<15; i++)
134 unit_assert(s->paramGroupPtrs.back()->id ==
"CommonMS1SpectrumParams");
135 unit_assert(s->paramGroupPtrs.back()->cvParams.size() == 1);
139 s = sl->spectrum(1,
true);
146 unit_assert(sl->spectrumIdentity(1).id ==
"scan=20");
147 unit_assert(sl->spectrumIdentity(1).spotID.empty());
150 s->getMZIntensityPairs(pairs);
152 for (
int i=0; i<10; i++)
153 unit_assert(pairs[i].
mz==2*i && pairs[i].intensity==(10-i)*2);
157 unit_assert(s->paramGroupPtrs.back()->id ==
"CommonMS2SpectrumParams");
158 unit_assert(s->paramGroupPtrs.back()->cvParams.size() == 1);
161 s = sl->spectrum(4,
true);
163 unit_assert(s->id ==
"sample=1 period=1 cycle=23 experiment=1");
168 unit_assert(sl->spectrumIdentity(4).id ==
"sample=1 period=1 cycle=23 experiment=1");
169 unit_assert(sl->spectrumIdentity(4).spotID ==
"A1,42x42,4242x4242");
183 int main(
int argc,
char* argv[])
189 if (argc>1 && !strcmp(argv[1],
"-v"))
os_ = &cout;