Skip to content

Commit

Permalink
add test system parser
Browse files Browse the repository at this point in the history
  • Loading branch information
payetvin committed Dec 11, 2024
1 parent 168eb54 commit 0c073d8
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/solver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ add_subdirectory(lps)
add_subdirectory(misc)
add_subdirectory(modelConverter)
add_subdirectory(modelParser)
add_subdirectory(systemConverter)
add_subdirectory(systemParser)
add_subdirectory(modeler)
add_subdirectory(optimisation)
Expand Down
4 changes: 3 additions & 1 deletion src/tests/src/solver/modelParser/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set(SOURCE_FILES
testConvertorVisitor.cpp
test_full.cpp
enum_operators.h
testSystemParser.cpp
)

# Add executable
Expand All @@ -14,9 +15,10 @@ add_executable(TestModelParser ${SOURCE_FILES})
target_link_libraries(TestModelParser
PRIVATE
Boost::unit_test_framework
Antares::solver-expressions
Antares::solver-expressions
Antares::modelConverter
Antares::modelParser
Antares::systemParser
Antares::antares-study-system-model
Antares::antlr-interface
)
Expand Down
44 changes: 44 additions & 0 deletions src/tests/src/solver/modelParser/testSystemParser.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright 2007-2024, RTE (https://www.rte-france.com)
* See AUTHORS.txt
* SPDX-License-Identifier: MPL-2.0
* This file is part of Antares-Simulator,
* Adequacy and Performance assessment for interconnected energy networks.
*
* Antares_Simulator is free software: you can redistribute it and/or modify
* it under the terms of the Mozilla Public Licence 2.0 as published by
* the Mozilla Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Antares_Simulator is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Mozilla Public Licence 2.0 for more details.
*
* You should have received a copy of the Mozilla Public Licence 2.0
* along with Antares_Simulator. If not, see <https://opensource.org/license/mpl-2-0/>.
*/

#define WIN32_LEAN_AND_MEAN

#include <boost/test/unit_test.hpp>

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

using namespace std::string_literals;
using namespace Antares::Solver;

BOOST_AUTO_TEST_CASE(EmptySystem)
{
SystemParser::Parser parser;
const auto system = R"(
system:
id: ""
description: ""
  model-libraries:
)"s;
SystemParser::System systemObj = parser.parse(system);
BOOST_CHECK(systemObj.id.empty());
BOOST_CHECK(systemObj.libraries.empty());
}

0 comments on commit 0c073d8

Please sign in to comment.