Skip to content

Commit

Permalink
test empty ok
Browse files Browse the repository at this point in the history
  • Loading branch information
payetvin committed Dec 12, 2024
1 parent 0c073d8 commit 7380bbb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
6 changes: 1 addition & 5 deletions src/solver/systemParser/encoders.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,8 @@ struct convert<Antares::Solver::SystemParser::System>
{
static bool decode(const Node& node, Antares::Solver::SystemParser::System& rhs)
{
if (!node.IsMap())
{
return false;
}
rhs.id = node["id"].as<std::string>();
rhs.libraries = as_fallback_default<std::vector<std::string>>(node["model-libaries"]);
rhs.libraries = as_fallback_default<std::vector<std::string>>(node["model-libraries"]);
rhs.components = as_fallback_default<std::vector<Antares::Solver::SystemParser::Component>>(
node["components"]);
return true;
Expand Down
8 changes: 5 additions & 3 deletions src/tests/src/solver/modelParser/testSystemParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

#include <boost/test/unit_test.hpp>

#include "antares/study/system-model/system.h"
#include "antares/solver/systemParser/parser.h"
#include <antares/study/system-model/system.h>
#include <antares/solver/systemParser/parser.h>

using namespace std::string_literals;
using namespace Antares::Solver;
Expand All @@ -36,9 +36,11 @@ BOOST_AUTO_TEST_CASE(EmptySystem)
system:
id: ""
description: ""
  model-libraries:
port-types: []
models: []
)"s;
SystemParser::System systemObj = parser.parse(system);
BOOST_CHECK(systemObj.id.empty());
BOOST_CHECK(systemObj.libraries.empty());
BOOST_CHECK(systemObj.components.empty());
}

0 comments on commit 7380bbb

Please sign in to comment.