Beispiel #1
0
void testRegexCVMapIO()
{
    if (os_) (*os_) << "\ntestRegexCVMapIO()\n";
    
    RegexCVMap map("[Ss]ample [Nn]ame", MS_sample_name_OBSOLETE,
              "/mzIdentML/AnalysisSampleCollection/Sample/cvParam");
    stringstream ss;

    ss << map;

    if (os_) (*os_) << "insertion operator:\n" << ss.str();
    unit_assert(ss.str() == "regex\t[Ss]ample [Nn]ame\tMS:1000002\t"
                "/mzIdentML/AnalysisSampleCollection/Sample/cvParam\n");

    // Test CVMapPtr extraction
    CVMapPtr cvmPtr;
    ss >>  cvmPtr;

    if (os_) (*os_) << "NULL pointer returned?"
                    << (cvmPtr.get() == NULL) << endl;
    unit_assert(cvmPtr.get());
    
    if (os_) (*os_) << typeid(cvmPtr.get()).name() << endl;
    unit_assert(typeid(cvmPtr.get()).name() == typeid(CVMap*).name());
    
    if (os_) (*os_) << "keyword: " << cvmPtr->keyword << endl;
    if (os_) (*os_) << "cvid: " << cvmPtr->cvid << endl;
    unit_assert(cvmPtr->keyword == "[Ss]ample [Nn]ame");
    unit_assert(cvmPtr->cvid == MS_sample_name_OBSOLETE);
}
Beispiel #2
0
bool StringMatchCVMap::operator==(const CVMapPtr& right) const
{
    return right.get() && keyword == right->keyword;
}