libcellml
libcellml copied to clipboard
Parser creates extra import source items in the model
I'm not sure what's expected from this situation: where an imported component is parent to a concrete child? I didn't expect this though ... (edit: removed units to make the problem simpler, same behaviour).
std::string modelString =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<model xmlns=\"http://www.cellml.org/cellml/2.0#\">\n"
" <import xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:href=\"import.cellml\">\n"
" <component component_ref=\"myComponent\" name=\"myImportedComponent\"/>\n"
" </import>\n"
" <component name=\"myConcreteComponent\"/>\n"
" <encapsulation>\n"
" <component_ref component=\"myConcreteComponent\">\n"
" <component_ref component=\"myImportedComponent\"/>\n"
" </component_ref>\n"
" </encapsulation>\n"
"</model>";
auto parser = libcellml::Parser::create();
auto model = parser->parseModel(modelString);
EXPECT_EQ(size_t(1), model->importSourceCount()); // <<< model->importSourceCount() = 2!!