Skip to content

Commit

Permalink
c
Browse files Browse the repository at this point in the history
  • Loading branch information
payetvin committed Dec 12, 2024
1 parent 5757d2c commit 1507574
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions src/tests/src/solver/modelParser/testSystemParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,9 @@ BOOST_AUTO_TEST_CASE(simple_id)
system:
id: base_system
description: a basic system
model-libraries: []
components: []
)"s;
SystemParser::System systemObj = parser.parse(system);
BOOST_CHECK_EQUAL(systemObj.id, "base_system");
BOOST_CHECK(systemObj.libraries.empty());
BOOST_CHECK(systemObj.components.empty());
}

BOOST_AUTO_TEST_CASE(libraries_one_model)
Expand All @@ -67,13 +63,10 @@ BOOST_AUTO_TEST_CASE(libraries_one_model)
const auto system = R"(
system:
id: base_system
description: a basic system
model-libraries: [abc]
components: []
)"s;
SystemParser::System systemObj = parser.parse(system);
BOOST_CHECK_EQUAL(systemObj.libraries[0], "abc");
BOOST_CHECK(systemObj.components.empty());
}

BOOST_AUTO_TEST_CASE(libraries_list_of_models)
Expand All @@ -82,7 +75,7 @@ BOOST_AUTO_TEST_CASE(libraries_list_of_models)
const auto system = R"(
system:
id: base_system
description: a basic system
description: 3 model libraries
model-libraries: [abc, def, 123]
components: []
)"s;
Expand All @@ -92,3 +85,21 @@ BOOST_AUTO_TEST_CASE(libraries_list_of_models)
BOOST_CHECK_EQUAL(systemObj.libraries[2], "123");
BOOST_CHECK(systemObj.components.empty());
}

BOOST_AUTO_TEST_CASE(one_component)
{
SystemParser::Parser parser;
const auto system = R"(
system:
id: base_system
description: one simple component
components:
- id: N
model: abcde
scenario-group: group-234
)"s;
SystemParser::System systemObj = parser.parse(system);
BOOST_CHECK_EQUAL(systemObj.components[0].id, "N");
BOOST_CHECK_EQUAL(systemObj.components[0].model, "abcde");
BOOST_CHECK_EQUAL(systemObj.components[0].scenarioGroup, "group-234");
}

0 comments on commit 1507574

Please sign in to comment.