END_TEST START_TEST (test_comp_fileresolver_resolve_3) { string filename(TestDataDirectory); SBMLFileResolver fr; SBMLDocument* doc2 = fr.resolve("enzyme_model.xml", filename); fail_unless(doc2 != NULL); fail_unless(doc2->getModel() != NULL); }
END_TEST START_TEST (test_comp_fileresolver_resolve_5) { SBMLFileResolver fr; string name("chrome://anything/enzyme_model.xml"); string name1("http://anything/enzyme_model.xml"); SBMLDocument* doc2 = fr.resolve(name, name1); // this passes because we have inadvertently used // the file nam at the end of the uri fail_unless(doc2 == NULL); }
END_TEST START_TEST (test_comp_fileresolver_resolve) { string filename(TestDataDirectory); filename += "complexified.xml"; SBMLDocument* doc = readSBMLFromFile(filename.c_str()); fail_unless(doc->getLocationURI() == "file:" + filename); SBMLFileResolver fr; SBMLDocument* doc2 = fr.resolve("enzyme_model.xml", doc->getLocationURI()); fail_unless(doc2 != NULL); fail_unless(doc2->getModel() != NULL); }
END_TEST START_TEST (test_comp_fileresolver_resolve_6) { string filename(TestDataDirectory); size_t pos = filename.rfind('/'); if (pos != filename.npos) { filename = filename.substr(0, pos); } SBMLFileResolver fr; SBMLDocument* doc2 = fr.resolve("enzyme_model.xml", filename); fail_unless(doc2 != NULL); fail_unless(doc2->getModel() != NULL); delete doc2; }
END_TEST START_TEST (test_comp_fileresolver_resolve_4) { string filename(TestDataDirectory); filename += "complexified.xml"; SBMLDocument* doc = readSBMLFromFile(filename.c_str()); fail_unless(doc->getLocationURI() == "file:" + filename); SBMLFileResolver fr; string newDir(TestDataDirectory); newDir += "/subdir"; fr.addAdditionalDir(newDir); SBMLDocument* doc2 = fr.resolve("new_aggregate.xml", doc->getLocationURI()); fail_unless(doc2 != NULL); fail_unless(doc2->getModel() != NULL); }
END_TEST START_TEST (test_comp_fileresolver_resolve_2) { string filename(TestDataDirectory); filename += "complexified.xml"; SBMLDocument* doc = readSBMLFromFile(filename.c_str()); fail_unless(doc->getLocationURI() == "file:" + filename); SBMLFileResolver fr; string newFilename("chrome://anything/enzyme_model.xml"); SBMLDocument* doc2 = fr.resolve(newFilename, doc->getLocationURI()); // this passes because we have inadvertently used // the file name at the end of the uri fail_unless(doc2 != NULL); fail_unless(doc2->getModel() != NULL); }