TEST_EQUAL(ef.isEmpty(), true) TEST_EQUAL(e_ptr->isEmpty(), false) END_SECTION START_SECTION(bool hasElement(const Element* element) const) const Element* e = db->getElement(6); TEST_EQUAL(e_ptr->hasElement(e), true) e = db->getElement(1); TEST_EQUAL(e_ptr->hasElement(e), false) END_SECTION START_SECTION(bool contains(const EmpiricalFormula& ef)) EmpiricalFormula metabolite("C12H36N2"); TEST_EQUAL(metabolite.contains(metabolite), true) // contains itself? TEST_EQUAL(metabolite.contains(EmpiricalFormula("C-12H36N2")), true) TEST_EQUAL(metabolite.contains(EmpiricalFormula("C11H36N2")), true) TEST_EQUAL(metabolite.contains(EmpiricalFormula("N2")), true) TEST_EQUAL(metabolite.contains(EmpiricalFormula("H36")), true) TEST_EQUAL(metabolite.contains(EmpiricalFormula("H3")), true) TEST_EQUAL(metabolite.contains(EmpiricalFormula("P-1")), true) TEST_EQUAL(metabolite.contains(EmpiricalFormula()), true) TEST_EQUAL(metabolite.contains(EmpiricalFormula("P1")), false) // the 'adduct' test TEST_EQUAL(metabolite.contains(EmpiricalFormula("KH-2") * -1), true) // make sure we can loose 2H (i.e. we have 2H in the metabolite); K is adducted, so is does not need to be intrinsic TEST_EQUAL(metabolite.contains(EmpiricalFormula("K-1H2")), true) // same as above TEST_EQUAL(metabolite.contains(EmpiricalFormula("KH-2") * 1), false) // cannot loose K, since we don't have it END_SECTION