27 using namespace pwiz::data::peakdata;
28 using namespace pwiz::util;
29 using namespace pwiz::minimxml;
30 using namespace pwiz::eharmony;
38 feature->retentionTime = retentionTime;
47 fs->feature = feature;
59 bool operator()(boost::shared_ptr<FeatureSequenced> fs_ptr){
return *fs_ptr == _fs;}
66 if (
os_) *
os_ <<
"\ntest() ... \n\n";
78 vector<FeaturePtr> features;
79 features.push_back(a);
80 features.push_back(b);
81 features.push_back(c);
84 if (
os_) *
os_ <<
"constructing Feature_dataFetcher ... " << endl;
86 if (
os_) *
os_ <<
"constructed. " << endl;
88 if (
os_) *
os_ <<
"testing getFeatures ... " << endl;
89 vector<boost::shared_ptr<FeatureSequenced> > test_a = fdf.
getFeatures(1,2);
90 vector<boost::shared_ptr<FeatureSequenced> > test_b = fdf.
getFeatures(3,4);
91 vector<boost::shared_ptr<FeatureSequenced> > test_c = fdf.
getFeatures(5,6);
93 unit_assert(find_if(test_a.begin(), test_a.end(),
IsFS(fs_a)) != test_a.end());
94 unit_assert(find_if(test_b.begin(), test_b.end(),
IsFS(fs_b)) != test_b.end());
95 unit_assert(find_if(test_c.begin(), test_c.end(),
IsFS(fs_c)) != test_c.end());
99 *
os_ <<
"testing vector<Feature> constructor ... \n";
102 vector<boost::shared_ptr<FeatureSequenced> >::iterator a_it = test_a.begin();
103 for(; a_it != test_a.end(); ++a_it) (*a_it)->feature->write(writer);
104 *
os_ << oss.str() << endl;
117 istringstream iss(oss.str());
122 vector<boost::shared_ptr<FeatureSequenced> > test_is_a = fdf_is.getFeatures(1,2);
123 vector<boost::shared_ptr<FeatureSequenced> > test_is_b = fdf_is.getFeatures(3,4);
124 vector<boost::shared_ptr<FeatureSequenced> > test_is_c = fdf_is.getFeatures(5,6);
126 unit_assert(find_if(test_is_a.begin(), test_is_a.end(),
IsFS(fs_a)) != test_is_a.end());
127 unit_assert(find_if(test_is_b.begin(), test_is_b.end(),
IsFS(fs_b)) != test_is_b.end());
128 unit_assert(find_if(test_is_c.begin(), test_is_c.end(),
IsFS(fs_c)) != test_is_c.end());
133 *
os_ <<
"\ntesting istream constructor ... \n";
144 if(
os_) *
os_ <<
"\ntestMerge()...\n" << endl;
151 vector<FeaturePtr> v_a;
152 vector<FeaturePtr> v_b;
161 vector<boost::shared_ptr<FeatureSequenced> > binContents = fdf_a.
getFeatures(b->mz, b->retentionTime);
167 *
os_ <<
"Merged FeatureSequenced:\n " << endl;
170 (*binContents.begin())->feature->write(writer);
171 *
os_ <<
"ms1_5: " << (*binContents.begin())->ms1_5 << endl;
172 *
os_ <<
"ms2: " << (*binContents.begin())->ms2 << endl;
174 *
os_ <<
"\nOriginal FeatureSequenced:\n " << endl;
176 fs_b->feature->write(writer);
177 *
os_ <<
"ms1_5: " << fs_b->ms1_5 << endl;
178 *
os_ <<
"ms2: " << fs_b->ms2 << endl;
186 int main(
int argc,
char* argv[])
191 if (argc>1 && !strcmp(argv[1],
"-v"))
os_ = &cout;
192 if (
os_) *
os_ <<
"Feature_dataFetcherTest ... \n";
201 cerr << e.what() << endl;
205 cerr <<
"Caught unknown exception.\n";