Skip to content

Commit

Permalink
test those exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
payetvin committed Dec 16, 2024
1 parent d976130 commit c83e3e7
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/tests/src/solver/modelParser/testSystemConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,43 @@ BOOST_FIXTURE_TEST_CASE(bad_param_name_in_component, Fixture)

BOOST_CHECK_THROW(SystemConverter::convert(systemObj, libraries), std::invalid_argument);
}

BOOST_FIXTURE_TEST_CASE(library_not_existing, Fixture)
{
const auto system = R"(
system:
id: base_system
model-libraries: [abc]
components:
- id: N
model: abc.node
scenario-group: group-234
)"s;

std::vector<SystemModel::Library> libraries = {lib};
SystemParser::System systemObj = parser.parse(system);

BOOST_CHECK_THROW(SystemConverter::convert(systemObj, libraries), std::runtime_error);
}

BOOST_FIXTURE_TEST_CASE(bad_library_model_format, Fixture)
{
const auto system = R"(
system:
id: base_system
model-libraries: [std]
components:
- id: N
model: std___node
scenario-group: group-234
parameters:
- id: cost
type: constant
value: 30
)"s;

std::vector<SystemModel::Library> libraries = {lib};
SystemParser::System systemObj = parser.parse(system);

BOOST_CHECK_THROW(SystemConverter::convert(systemObj, libraries), std::runtime_error);
}

0 comments on commit c83e3e7

Please sign in to comment.