-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Throw a comprehensive exception when a terminal ref of a busbar section on is written in bus-breaker or bus-branch (#295) #323
Throw a comprehensive exception when a terminal ref of a busbar section on is written in bus-breaker or bus-branch (#295) #323
Conversation
// make sure no error is thrown while exporting to NODE_BREAKER topology | ||
std::stringstream ss; | ||
Network::writeXml("network.xiidm", ss, network, converter::ExportOptions(properties)); | ||
Network::readXml("network.xiidm", ss); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should properly assert that Network::readXml
and Network::writeXml
don't throw any exception using BOOST_CHECK_NO_THROW
. It seems to be possible to write something like that:
BOOST_CHECK_NO_THROW({
std::stringstream ss;
Network::writeXml("network.xiidm", ss, network, converter::ExportOptions(properties));
Network::readXml("network.xiidm", ss);
});
@@ -57,6 +59,11 @@ void TerminalRefXml::writeTerminalRef(const Terminal& terminal, NetworkXmlWriter | |||
if (!context.getFilter().test(c)) { | |||
throw PowsyblException(stdcxx::format("Oups, terminal ref point to a filtered equipment %1%", c.get().getId())); | |||
} | |||
if (terminal.getVoltageLevel().getTopologyKind() == TopologyKind::NODE_BREAKER | |||
&& context.getOptions().getTopologyLevel() != TopologyLevel::NODE_BREAKER | |||
&& stdcxx::isInstanceOf<BusbarSection>(terminal.getConnectable())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would put the &&
operators at the end of the line instead of the beginning of the lines
…on is written in bus-breaker or bus-branch (#295) Signed-off-by: Sébastien LAIGRE <[email protected]>
Signed-off-by: Mathieu BAGUE <[email protected]>
2f6a756
to
725d8fc
Compare
Kudos, SonarCloud Quality Gate passed! |
…on on is written in bus-breaker or bus-branch (#295) (#323) Signed-off-by: Sébastien LAIGRE <[email protected]> Signed-off-by: Mathieu BAGUE <[email protected]>
…on on is written in bus-breaker or bus-branch (#295) (#323) Signed-off-by: Sébastien LAIGRE <[email protected]> Signed-off-by: Mathieu BAGUE <[email protected]>
Signed-off-by: Sébastien LAIGRE [email protected]
Please check if the PR fulfills these requirements (please use
'[x]'
to check the checkboxes, or submit the PR and then click the checkboxes)Does this PR already have an issue describing the problem ? If so, link to this issue using
'#XXX'
and skip the rest#295
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
What is the current behavior? (You can also link to an open issue here)
What is the new behavior (if this is a feature change)?
Does this PR introduce a breaking change or deprecate an API? If yes, check the following:
Other information:
(if any of the questions/checkboxes don't apply, please delete them entirely)