Skip to content

Commit

Permalink
Add repeatedConnectionCross test.
Browse files Browse the repository at this point in the history
  • Loading branch information
hsorby committed May 15, 2024
1 parent 9deffb3 commit ef6ab6f
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/connection/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1379,6 +1379,34 @@ TEST(Connection, repeatedConnection)
EXPECT_EQ(expectedIssue, p->error(0)->description());
}

TEST(Connection, repeatedConnectionCross)
{
const std::string in =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<model xmlns=\"http://www.cellml.org/cellml/2.0#\" name=\"connection\">\n"
" <component name=\"component1\">\n"
" <variable name=\"variable1\" units=\"dimensionless\"/>\n"
" </component>\n"
" <component name=\"component2\">\n"
" <variable name=\"variable2\" units=\"dimensionless\"/>\n"
" </component>\n"
" <connection component_1=\"component1\" component_2=\"component2\">\n"
" <map_variables variable_1=\"variable1\" variable_2=\"variable2\"/>\n"
" </connection>\n"
" <connection component_1=\"component2\" component_2=\"component1\">\n"
" <map_variables variable_1=\"variable2\" variable_2=\"variable1\"/>\n"
" </connection>\n"
"</model>\n";

libcellml::ParserPtr p = libcellml::Parser::create();
libcellml::ModelPtr m = p->parseModel(in);

const std::string expectedIssue = "Connection in model 'connection' between 'component1' and 'component2' is not unique.";

EXPECT_EQ(size_t(1), p->errorCount());
EXPECT_EQ(expectedIssue, p->error(0)->description());
}

TEST(Connection, repeatedMapVariables)
{
const std::string in =
Expand Down

0 comments on commit ef6ab6f

Please sign in to comment.