33 using namespace pwiz::util;
34 using namespace pwiz::analysis;
43 if (
os_) *
os_ <<
"testMetadata()\n";
45 if (
os_) *
os_ <<
"spectrumCount: " << cache.size() << endl;
99 os <<
"cached binary data:\n";
100 for (vector<SpectrumInfo>::const_iterator it=cache.begin(); it!=cache.end(); ++it)
102 os << it->index <<
" "
103 << it->data.size() <<
"/"
104 << it->data.capacity() << endl;
112 if (
os_) *
os_ <<
"testMRU()\n";
114 vector<MZIntensityPair> pairs(100);
117 for (
size_t i=0; i<10; i++)
123 sl->spectra.push_back(spectrum);
135 if (
os_) *
os_ <<
"update: 0 1 2\n";
136 cache.
update(msd, *sl->spectrum(0,
true));
137 cache.
update(msd, *sl->spectrum(1,
true));
138 cache.
update(msd, *sl->spectrum(2,
true));
146 if (
os_) *
os_ <<
"update: 3\n";
147 cache.
update(msd, *sl->spectrum(3,
true));
155 if (
os_) *
os_ <<
"update: 1\n";
156 cache.
update(msd, *sl->spectrum(1,
true));
164 if (
os_) *
os_ <<
"update: 4\n";
165 cache.
update(msd, *sl->spectrum(4,
true));
180 virtual UpdateRequest updateRequested(
const DataInfo& dataInfo,
181 const SpectrumIdentity& spectrumIdentity)
const
190 if (
os_) *
os_ <<
"testUpdateRequest()\n";
192 vector<MZIntensityPair> pairs(100);
195 for (
size_t i=0; i<10; i++)
201 sl->spectra.push_back(spectrum);
209 analyzers.push_back(cache);
215 for (
size_t i=0, end=cache->size(); i<end; i++)
223 i%2==1 && info.
index==(
size_t)-1&& info.
id.empty());
232 if (
os_) *
os_ <<
"testAutomaticUpdate()\n";
234 vector<MZIntensityPair> pairs(100);
237 for (
size_t i=0; i<10; i++)
243 sl->spectra.push_back(spectrum);
253 for (
size_t i=0; i<cache.size(); i++)
267 for (
size_t i=0; i<cache.size(); i++)
268 *
os_ << i <<
" " << cache[i].index <<
" " << cache[i].
id <<
" "
269 << cache[i].data.size() << endl;
276 unit_assert(cache[5].index==5 && cache[5].
id==
"scan=5");
278 unit_assert(cache[7].index==7 && cache[7].
id==
"scan=7");
280 for (
size_t i=0; i<cache.size(); i++)
286 int main(
int argc,
char* argv[])
292 if (argc>1 && !strcmp(argv[1],
"-v"))
os_ = &cout;