コード例 #1
0
      void testStringSimilar(const char* /*file*/, int line,
                             const std::string& string_1,
                             const char* string_1_stringified,
                             const std::string& string_2,
                             const char* string_2_stringified
                             )
      {
        ++TEST::test_count;
        TEST::test_line = line;

        TEST::fuzzy_message.clear();
        FuzzyStringComparator fsc;
        fsc.setAcceptableAbsolute(absdiff_max_allowed);
        fsc.setAcceptableRelative(ratio_max_allowed);
        fsc.setVerboseLevel(2);
        fsc.setWhitelist(whitelist);
        std::ostringstream os;
        fsc.setLogDestination(os);
        fsc.use_prefix_ = true;

        TEST::this_test = fsc.compareStrings(string_1, string_2);

        TEST::fuzzy_message = os.str();
        TEST::absdiff = fsc.absdiff_max_;
        TEST::ratio = fsc.ratio_max_;
        TEST::line_num_1_max = fsc.line_num_1_max_;
        TEST::line_num_2_max = fsc.line_num_2_max_;

        TEST::test = TEST::test && TEST::this_test;

        TEST::initialNewline();
        if (TEST::this_test)
        {
          std__cout << " +  line " << line << ":  TEST_STRING_SIMILAR("
                    << string_1_stringified << ',' << string_2_stringified << "):  "
                                                                    "absolute: " << TEST::absdiff << " (" << TEST::absdiff_max_allowed
                    << "), relative: " << TEST::ratio << " ("
                    << TEST::ratio_max_allowed << ")    +\n";
          std__cout << "got:\n";
          TEST::printWithPrefix(string_1, TEST::line_num_1_max);
          std__cout << "expected:\n";
          TEST::printWithPrefix(string_2, TEST::line_num_2_max);
        }
        else
        {
          std__cout << " -  line " << TEST::test_line
                    << ": TEST_STRING_SIMILAR(" << string_1_stringified << ','
                    << string_2_stringified << ") ...    -\n"
                                     "got:\n";
          TEST::printWithPrefix(string_1, TEST::line_num_1_max);
          std__cout << "expected:\n";
          TEST::printWithPrefix(string_2, TEST::line_num_2_max);
          std__cout << "message: \n";
          std__cout << TEST::fuzzy_message;
          failed_lines_list.push_back(line);
        }
      }
コード例 #2
0
      bool
      isFileSimilar(const std::string& filename_1,
                    const std::string& filename_2)
      {
        fuzzy_message.clear();
        FuzzyStringComparator fsc;
        fsc.setAcceptableAbsolute(absdiff_max_allowed);
        fsc.setAcceptableRelative(ratio_max_allowed);
        fsc.setVerboseLevel(2);
        fsc.setWhitelist(whitelist);
        std::ostringstream os;
        fsc.setLogDestination(os);
        fsc.use_prefix_ = true;

        bool result = fsc.compareFiles(filename_1, filename_2);

        fuzzy_message = os.str();
        absdiff = fsc.absdiff_max_;
        ratio = fsc.ratio_max_;
        line_num_1_max = fsc.line_num_1_max_;
        line_num_2_max = fsc.line_num_2_max_;

        return result;
      }
コード例 #3
0
PeakMap input;
MzMLFile().load(OPENMS_GET_TEST_DATA_PATH("FeatureFindingMetabo_input1.mzML"), input);

FeatureMap test_fm;

std::vector<MassTrace> output_mt, splitted_mt, filtered_mt;

std::vector<std::vector< OpenMS::MSChromatogram > > chromatograms;

MassTraceDetection test_mtd;
test_mtd.run(input, output_mt);

ElutionPeakDetection test_epd;
test_epd.detectPeaks(output_mt, splitted_mt);

FuzzyStringComparator fsc;
fsc.setAcceptableRelative(1.001);
fsc.setAcceptableAbsolute(1);
StringList sl;
sl.push_back("xml-stylesheet");
sl.push_back("<featureMap");
sl.push_back("<feature id");
fsc.setWhitelist(sl);

//std::cout << "\n\n" << fsc.compareStrings("529090", "529091") << "\n\n\n";

START_SECTION((void run(std::vector< MassTrace > &, FeatureMap &, chromatograms &)))
{
    FeatureFindingMetabo test_ffm;
    // run with non-default setting (C13 isotope distance)
    Param p = test_ffm.getParameters();
コード例 #4
0
  TEST_EQUAL(pes4[0].getAAAfter(), PeptideEvidence::UNKNOWN_AA)
END_SECTION

START_SECTION(void store(String filename, const std::vector<ProteinIdentification>& protein_ids, const std::vector<PeptideIdentification>& peptide_ids, const String& document_id="") )

  //store and load data
  std::vector<ProteinIdentification> protein_ids, protein_ids2;
  std::vector<PeptideIdentification> peptide_ids, peptide_ids2;
  String document_id, document_id2;
  String input_path = OPENMS_GET_TEST_DATA_PATH("IdXMLFile_whole.idXML");
  IdXMLFile().load(input_path, protein_ids2, peptide_ids2, document_id2);
  String filename;
  NEW_TMP_FILE(filename)
  IdXMLFile().store(filename, protein_ids2, peptide_ids2, document_id2);

  FuzzyStringComparator fuzzy;
  fuzzy.setWhitelist(ListUtils::create<String>("<?xml-stylesheet"));
  fuzzy.setAcceptableAbsolute(0.0001);
  bool result = fuzzy.compareFiles(input_path, filename);
  TEST_EQUAL(result, true);
END_SECTION


START_SECTION([EXTRA] static bool isValid(const String& filename))
  std::vector<ProteinIdentification> protein_ids, protein_ids2;
  std::vector<PeptideIdentification> peptide_ids, peptide_ids2;
  String filename;
  IdXMLFile f;

  //test if empty file is valid
  NEW_TMP_FILE(filename)
コード例 #5
0
ファイル: IdXMLFile_test.cpp プロジェクト: OpenMS/OpenMS
END_SECTION

START_SECTION(void store(String filename, const std::vector<ProteinIdentification>& protein_ids, const std::vector<PeptideIdentification>& peptide_ids, const String& document_id="") )

  // load, store, and reload data
  std::vector<ProteinIdentification> protein_ids, protein_ids2;
  std::vector<PeptideIdentification> peptide_ids, peptide_ids2;
  String document_id, document_id2;
  String target_file = OPENMS_GET_TEST_DATA_PATH("IdXMLFile_whole.idXML");
  IdXMLFile().load(target_file, protein_ids2, peptide_ids2, document_id2);

  String actual_file;
  NEW_TMP_FILE(actual_file)
  IdXMLFile().store(actual_file, protein_ids2, peptide_ids2, document_id2);

  FuzzyStringComparator fuzzy;
  fuzzy.setWhitelist(ListUtils::create<String>("<?xml-stylesheet"));
  fuzzy.setAcceptableAbsolute(0.0001);
  bool result = fuzzy.compareFiles(actual_file, target_file);
  TEST_EQUAL(result, true);
END_SECTION


START_SECTION([EXTRA] static bool isValid(const String& filename))
  std::vector<ProteinIdentification> protein_ids, protein_ids2;
  std::vector<PeptideIdentification> peptide_ids, peptide_ids2;
  String filename;
  IdXMLFile f;

  //test if empty file is valid
  NEW_TMP_FILE(filename)