Skip to content
Snippets Groups Projects
Commit a52df408 authored by Bienchen's avatar Bienchen
Browse files

Added unit test for multi model case in mmcif files

parent 0c933c97
No related branches found
No related tags found
No related merge requests found
...@@ -147,7 +147,7 @@ bool MMCifParser::OnBeginLoop(const StarLoopDesc& header) ...@@ -147,7 +147,7 @@ bool MMCifParser::OnBeginLoop(const StarLoopDesc& header)
// post processing // post processing
if (category_counts_[category_] > 0) { if (category_counts_[category_] > 0) {
if ((has_model_ && (indices_[PDBX_PDB_MODEL_NUM] == -1))|| if ((has_model_ && (indices_[PDBX_PDB_MODEL_NUM] == -1))||
(!has_model_ && (indices_[PDBX_PDB_MODEL_NUM] != -1))) { // unit test (!has_model_ && (indices_[PDBX_PDB_MODEL_NUM] != -1))) {
throw IOException(this->FormatDiagnostic(STAR_DIAG_ERROR, throw IOException(this->FormatDiagnostic(STAR_DIAG_ERROR,
"Not all atom_site entries carry a model number.", "Not all atom_site entries carry a model number.",
this->GetCurrentLinenum())); this->GetCurrentLinenum()));
......
...@@ -233,6 +233,31 @@ BOOST_AUTO_TEST_CASE(mmcif_parse_models) ...@@ -233,6 +233,31 @@ BOOST_AUTO_TEST_CASE(mmcif_parse_models)
} }
BOOST_MESSAGE(" done."); BOOST_MESSAGE(" done.");
BOOST_MESSAGE(" testing single model with model no. entry...");
{
// build dummy header
mol::EntityHandle eh = mol::CreateEntity();
StarLoopDesc tmmcif_h;
TestMMCifParserProtected tmmcif_p("testfiles/mmcif/atom_site.mmcif", eh);
tmmcif_h.SetCategory(StringRef("atom_site", 9));
tmmcif_h.Add(StringRef("auth_asym_id", 12));
tmmcif_h.Add(StringRef("id", 2));
tmmcif_h.Add(StringRef("label_alt_id", 12));
tmmcif_h.Add(StringRef("label_asym_id", 13));
tmmcif_h.Add(StringRef("label_atom_id", 13));
tmmcif_h.Add(StringRef("label_comp_id", 13));
tmmcif_h.Add(StringRef("label_entity_id", 15));
tmmcif_h.Add(StringRef("label_seq_id", 12));
tmmcif_h.Add(StringRef("type_symbol", 11));
tmmcif_h.Add(StringRef("Cartn_x", 7));
tmmcif_h.Add(StringRef("Cartn_y", 7));
tmmcif_h.Add(StringRef("Cartn_z", 7));
tmmcif_p.OnBeginLoop(tmmcif_h);
tmmcif_h.Add(StringRef("pdbx_PDB_model_num", 18));
BOOST_CHECK_THROW(tmmcif_p.OnBeginLoop(tmmcif_h), IOException);
}
BOOST_MESSAGE(" done.");
BOOST_MESSAGE(" done."); BOOST_MESSAGE(" done.");
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment