From 3da31d9f5c72df749dfa67213f88219a65d90983 Mon Sep 17 00:00:00 2001 From: Hugh Sorby Date: Tue, 13 Oct 2026 15:12:14 +1300 Subject: [PATCH 1/3] Add a test to examine the bahaviour of map components parsing with CellML 1.X models. --- tests/connection/connection.cpp | 8 +++++ .../resources/cellml1X/map_components.cellml | 30 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 tests/resources/cellml1X/map_components.cellml diff --git a/tests/connection/connection.cpp b/tests/connection/connection.cpp index 76fda64dd..abefc260c 100644 --- a/tests/connection/connection.cpp +++ b/tests/connection/connection.cpp @@ -1588,3 +1588,11 @@ TEST(Connection, sameNamedVariablesInDifferentComponents) EXPECT_EQ(size_t(0), p->issueCount()); } + +TEST(Connection, mapComponentsAreOrderDependentInCellML1X) +{ + auto p = libcellml::Parser::create(false); + auto m = p->parseModel(fileContents("cellml1X/map_components.cellml")); + + EXPECT_EQ(size_t(0), p->errorCount()); +} diff --git a/tests/resources/cellml1X/map_components.cellml b/tests/resources/cellml1X/map_components.cellml new file mode 100644 index 000000000..7de46b31c --- /dev/null +++ b/tests/resources/cellml1X/map_components.cellml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 9013fb941759d14968eed818526458f2ccb569b0 Mon Sep 17 00:00:00 2001 From: Hugh Sorby Date: Tue, 13 Oct 2026 15:26:52 +1300 Subject: [PATCH 2/3] Ignore order when parsing map components in CellML1.X models. --- src/parser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parser.cpp b/src/parser.cpp index 3060c83f9..04f140841 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -1109,7 +1109,7 @@ void Parser::ParserImpl::loadConnection(const ModelPtr &model, const XmlNodePtr issue->mPimpl->setReferenceRule(Issue::ReferenceRule::CONNECTION_EXCLUDE_SELF); addIssue(issue); } else { - if (component1Name > component2Name) { + if (!mParsing1XVersion && (component1Name > component2Name)) { std::string tmp = component1Name; component1Name = component2Name; component2Name = tmp; From 851424e80d268887711fdce21a4289ff24938843 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Tue, 13 Oct 2026 18:57:39 +1300 Subject: [PATCH 3/3] Some minor cleaning up. --- tests/resources/cellml1X/connections.cellml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/resources/cellml1X/connections.cellml b/tests/resources/cellml1X/connections.cellml index 4c428e33b..a8b5d2118 100644 --- a/tests/resources/cellml1X/connections.cellml +++ b/tests/resources/cellml1X/connections.cellml @@ -39,7 +39,6 @@ - @@ -53,4 +52,4 @@ - \ No newline at end of file +