67 BOOST_CHECK_EQUAL(
expected.size(), observed.size());
68 TFieldDiffList::const_iterator ex =
expected.begin();
69 TFieldDiffList::const_iterator ob = observed.begin();
70 while (ex !=
expected.end() && ob != observed.end()) {
71 string ex_str = (*ex)->GetFieldName() +
":"
72 + (*ex)->GetSrcVal() +
":"
73 + (*ex)->GetSampleVal();
74 string ob_str = (*ob)->GetFieldName() +
":"
75 + (*ob)->GetSrcVal() +
":"
76 + (*ob)->GetSampleVal();
77 BOOST_CHECK_EQUAL(ex_str, ob_str);
82 string ex_str = (*ex)->GetFieldName() +
":"
83 + (*ex)->GetSrcVal() +
":"
84 + (*ex)->GetSampleVal();
85 BOOST_CHECK_EQUAL(ex_str,
"");
88 while (ob != observed.end()) {
89 string ob_str = (*ob)->GetFieldName() +
":"
90 + (*ob)->GetSrcVal() +
":"
91 + (*ob)->GetSampleVal();
92 BOOST_CHECK_EQUAL(
"", ob_str);
103 test_src->
SetOrg().SetTaxname(
"A");
104 test_sample->
SetOrg().SetTaxname(
"B");
135 BOOST_CHECK_EQUAL(
"Expected exception to be thrown",
"Exception not thrown!");
137 BOOST_CHECK_EQUAL(e.
GetMsg(),
"Conflicts found");
144 vals.push_back(
"male");
146 vals.push_back(
"abc");
147 vector<string>::iterator sit = vals.begin();
149 if (sit == vals.end()) {
150 BOOST_CHECK_EQUAL(
"Unexpected SubSource Value", (*it)->GetName());
152 BOOST_CHECK_EQUAL((*it)->GetName(), *sit);
158 BOOST_CHECK_EQUAL(
"Unexpected exception", e.
GetMsg());
165 test_src->
SetOrg().SetTaxname(
"B XYZ");
166 test_sample->
SetOrg().SetTaxname(
"B XYZ");
180 src->
SetOrg().SetTaxname(
"Campylobacter jejuni Cj3");
183 src->
SetOrg().SetOrgname().SetLineage(
"Bacteria; Proteobacteria; Epsilonproteobacteria; Campylobacterales; Campylobacteraceae; Campylobacter");
184 src->
SetOrg().SetOrgname().SetGcode(11);
185 src->
SetOrg().SetOrgname().SetDiv(
"BCT");
188 biosample->
SetOrg().SetTaxname(
"Campylobacter jejuni Cj3");
192 biosample->
SetOrg().SetOrgname().SetLineage(
"Bacteria; Proteobacteria; Epsilonproteobacteria; Campylobacterales; Campylobacteraceae; Campylobacter");
193 biosample->
SetOrg().SetOrgname().SetGcode(11);
194 biosample->
SetOrg().SetOrgname().SetDiv(
"restricted access");
212 taxname \"Escherichia coli\", \
221 genus \"Escherichia\", \
224 lineage \"Bacteria; Proteobacteria; Gammaproteobacteria; \
225 Enterobacteriales; Enterobacteriaceae; Escherichia\", \
237 taxname \"Escherichia coli\", \
246 \"Enterococcus coli\", \
247 \"Bacterium coli commune\", \
248 \"Bacterium coli\", \
253 genus \"Escherichia\", \
259 subname \"Homo sapiens\" \
266 lineage \"Bacteria; Proteobacteria; Gammaproteobacteria; \
267 Enterobacteriales; Enterobacteriaceae; Escherichia\", \
274 subtype collection-date, \
275 name \"24-Jun-2013\" \
279 name \"USA: Santa Clara\" \
282 subtype isolation-source, \
283 name \"Human fecal sample\" \
308 vals.push_back(
"24-Jun-2013");
309 vals.push_back(
"USA: Santa Clara");
310 vals.push_back(
"Human fecal sample");
311 vector<string>::iterator sit = vals.begin();
313 if (sit == vals.end()) {
314 BOOST_CHECK_EQUAL(
"Unexpected SubSource Value", (*it)->GetName());
316 BOOST_CHECK_EQUAL((*it)->GetName(), *sit);
321 BOOST_CHECK_EQUAL(
"Unexpected exception", e.
GetMsg());
331 src.
SetOrg().SetTaxname(
"a");
333 smpl.
SetOrg().SetTaxname(
"a");
338 BOOST_CHECK_EQUAL(src.
GetOrg().
GetDb().front()->GetTag().GetId(), 123);
340 BOOST_CHECK_EQUAL(
"Unexpected exception", e.
GetMsg());
360 src->
SetOrg().SetTaxname(
"Porphyromonas sp. KLE 1280");
362 taxid->
SetDb(
"taxon");
363 taxid->
SetTag().SetId(997829);
364 src->
SetOrg().SetDb().push_back(taxid);
368 src->
SetOrg().SetOrgname().SetMod().push_back(m1);
375 hmp->
SetTag().SetId(1121);
376 src->
SetOrg().SetDb().push_back(hmp);
380 BOOST_CHECK_EQUAL(src->
GetOrg().
GetDb().size(), 2);
382 BOOST_CHECK_EQUAL(
"Unexpected exception", e.
GetMsg());
392 src->
SetOrg().SetTaxname(
"Salmo salar");
398 om->SetSubname(
"missing");
399 smpl->
SetOrg().SetOrgname().SetMod().push_back(
om);
405 BOOST_CHECK_EQUAL(
"Unexpected exception", e.
GetMsg());
411 src->
SetOrg().SetOrgname().SetMod().push_back(om2);
418 BOOST_CHECK_EQUAL(
"Unexpected exception", e.
GetMsg());
428 src->
SetOrg().SetTaxname(
"xyz metagenome");
430 src->
SetOrg().SetOrgname().SetMod().push_back(src_om_note);
437 smpl->
SetOrg().SetOrgname().SetMod().push_back(smpl_om_note);
443 BOOST_CHECK_EQUAL(diff_list.size(), 2);
446 src->
SetOrg().SetOrgname().SetLineage(
"unclassified sequences; metagenomes");
447 smpl->
SetOrg().SetOrgname().SetLineage(
"unclassified sequences; metagenomes");
449 BOOST_CHECK_EQUAL(diff_list.size(), 0);
456 src->
SetOrg().SetTaxname(
"Sulfitobacter sp. NB-68");
458 src->
SetOrg().SetOrgname().SetMod().push_back(cc1);
460 src->
SetOrg().SetOrgname().SetMod().push_back(cc2);
467 BOOST_CHECK_EQUAL(diff_list.size(), 0);
478 src->
SetOrg().SetTaxname(
"Triticum aestivum");
485 smpl->
SetOrg().SetTaxname(
"Triticum aestivum");
493 BOOST_CHECK_EQUAL(diff_list.size(), 2);
496 BOOST_CHECK_EQUAL(diff_list.size(), 0);
499 BOOST_CHECK_EQUAL(src->
GetSubtype().front()->GetName(),
"4D");
500 BOOST_CHECK_EQUAL(src->
GetSubtype().back()->GetName(),
"short arm");
508 src->
SetOrg().SetTaxname(
"Triticum aestivum");
510 src->
SetOrg().SetOrgname().SetMod().push_back(n1);
512 src->
SetOrg().SetOrgname().SetMod().push_back(l1);
514 src->
SetOrg().SetOrgname().SetMod().push_back(s1);
517 smpl->
SetOrg().SetTaxname(
"Triticum aestivum");
519 smpl->
SetOrg().SetOrgname().SetMod().push_back(n2);
521 smpl->
SetOrg().SetOrgname().SetMod().push_back(l2);
523 smpl->
SetOrg().SetOrgname().SetMod().push_back(s2);
527 BOOST_CHECK_EQUAL(diff_list.size(), 0);
536 src->
SetOrg().SetTaxname(
"Bacteria");
543 BOOST_CHECK_EQUAL(diff_list.size(), 0);
552 BOOST_CHECK_EQUAL(diff_list.size(), 1);
553 BOOST_CHECK_EQUAL(diff_list[0]->GetFieldName(),
"metagenomic");
554 BOOST_CHECK_EQUAL(diff_list[0]->GetSrcVal(),
"true");
555 BOOST_CHECK_EQUAL(diff_list[0]->GetSampleVal(),
"");
563 BOOST_CHECK_EQUAL(diff_list.size(), 0);
vector< CRef< CFieldDiff > > TFieldDiffList
void UpdateWithBioSample(const CBioSource &biosample, bool force, bool is_local_copy=false)
TFieldDiffList GetBiosampleDiffs(const CBioSource &biosample, bool is_local_copy=false) const
@OrgMod.hpp User-defined methods of the data storage class.
static bool FuzzyStrainMatch(const string &strain1, const string &strain2)
bool IsSetOrgMod(void) const
static const char * expected[]
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
const string & GetMsg(void) const
Get message string.
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
#define MSerial_AsnText
I/O stream manipulators –.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define BEGIN_SCOPE(ns)
Define a new scope.
const TSubtype & GetSubtype(void) const
Get the Subtype member data.
void SetSubtype(TSubtype value)
Assign a value to Subtype data member.
list< CRef< CSubSource > > TSubtype
const TOrg & GetOrg(void) const
Get the Org member data.
void SetGenome(TGenome value)
Assign a value to Genome data member.
void SetOrg(TOrg &value)
Assign a value to Org data member.
void SetName(const TName &value)
Assign a value to Name data member.
TSubtype & SetSubtype(void)
Assign a value to Subtype data member.
@ eSubtype_isolation_source
void SetTag(TTag &value)
Assign a value to Tag data member.
void SetDb(const TDb &value)
Assign a value to Db data member.
const TMod & GetMod(void) const
Get the Mod member data.
const TDiv & GetDiv(void) const
Get the Div member data.
void SetSubtype(TSubtype value)
Assign a value to Subtype data member.
const TTaxname & GetTaxname(void) const
Get the Taxname member data.
const TDb & GetDb(void) const
Get the Db member data.
void SetSubname(const TSubname &value)
Assign a value to Subname data member.
const TOrgname & GetOrgname(void) const
Get the Orgname member data.
@ eSubtype_gb_synonym
used by taxonomy database
@ eSubtype_other
ASN5: old-name (254) will be added to next spec.
@ eSubtype_nat_host
natural host of this specimen
@ eSubtype_culture_collection
Defines to provide correct exporting from DLLs in some configurations.
CRef< objects::CObjectManager > om
Utility stuff for more convenient using of Boost.Test library.
void CheckDiffs(const TFieldDiffList &expected, const TFieldDiffList &observed)
BOOST_AUTO_TEST_CASE(Test_GetBiosampleDiffs)
const string sc_TestSQD1833_Src
const string sc_TestSQD1833_Smpl
void SetTaxon(objects::CBioSource &src, size_t taxon)
void SetSubSource(objects::CBioSource &src, objects::CSubSource::TSubtype subtype, string val)
void SetOrgMod(objects::CBioSource &src, objects::COrgMod::TSubtype subtype, string val)