Skip to content
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

#770 Update following 3259 dynawo. #771

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions sources/Inputs/src/Configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ void updateValue(bool &value, const boost::property_tree::ptree &tree, const std
if (value_opt.is_initialized()) {
parameterValueModified.insert(key);
std::string value_str = value_opt->get_value<std::string>();
std::transform(value_str.begin(), value_str.end(), value_str.begin(), [](unsigned char c){ return static_cast<char>(std::tolower(c)); });
std::transform(value_str.begin(), value_str.end(), value_str.begin(), [](unsigned char c) { return static_cast<char>(std::tolower(c)); });
if (value_str == "false") {
value = false;
} else if (value_str == "true") {
Expand Down Expand Up @@ -189,7 +189,7 @@ Configuration::Configuration(const boost::filesystem::path &filepath, dfl::input

auto config = tree.get_child("dfl-config");

std::string prefixConfigFile = absolute(remove_file_name(filepath.generic_string()));
std::string prefixConfigFile = absolute(removeFileName(filepath.generic_string()));

bool saMode = false;
if (simulationKind == dfl::inputs::Configuration::SimulationKind::SECURITY_ANALYSIS)
Expand Down Expand Up @@ -246,7 +246,7 @@ void Configuration::updateStartingPointMode(const boost::property_tree::ptree &t
if (optionalStartingPointMode.is_initialized()) {
std::string startingPointMode = optionalStartingPointMode->get_value<std::string>();
std::transform(startingPointMode.begin(), startingPointMode.end(), startingPointMode.begin(),
[](unsigned char c){ return static_cast<char>(std::tolower(c)); });
[](unsigned char c) { return static_cast<char>(std::tolower(c)); });
if (startingPointMode == "warm") {
startingPointMode_ = dfl::inputs::Configuration::StartingPointMode::WARM;
} else if (startingPointMode == "flat") {
Expand Down Expand Up @@ -295,7 +295,7 @@ void Configuration::updateChosenOutput(const boost::property_tree::ptree &tree,
for (auto &chosenOutputElement : optionalChosenOutputs.get()) {
std::string chosenOutputName = chosenOutputElement.second.get_value<std::string>();
std::transform(chosenOutputName.begin(), chosenOutputName.end(), chosenOutputName.begin(),
[](unsigned char c){ return static_cast<char>(std::toupper(c)); });
[](unsigned char c) { return static_cast<char>(std::toupper(c)); });
if (chosenOutputName == "STEADYSTATE") {
chosenOutputs_.insert(dfl::inputs::Configuration::ChosenOutputEnum::STEADYSTATE);
} else if (chosenOutputName == "CONSTRAINTS") {
Expand Down
6 changes: 3 additions & 3 deletions tests/inputs/TestConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ TEST(Config, Nominal) {
ASSERT_FALSE(config.isShuntRegulationOn());
ASSERT_FALSE(config.isAutomaticSlackBusOn());

std::string prefixConfigFile = remove_file_name(createAbsolutePath("./res/config.json", current_path()));
std::string prefixConfigFile = removeFileName(createAbsolutePath("./res/config.json", currentPath()));

ASSERT_EQ(canonical(config.settingFilePath().string()), canonical("setting.xml", prefixConfigFile));
ASSERT_EQ(canonical(config.assemblingFilePath().string()), canonical("assembling.xml", prefixConfigFile));
Expand Down Expand Up @@ -113,7 +113,7 @@ TEST(Config, ConfigN) {
ASSERT_FALSE(config.isShuntRegulationOn());
ASSERT_FALSE(config.isAutomaticSlackBusOn());

std::string prefixConfigFile = remove_file_name(createAbsolutePath("./res/config_N.json", current_path()));
std::string prefixConfigFile = removeFileName(createAbsolutePath("./res/config_N.json", currentPath()));

ASSERT_EQ(canonical(config.settingFilePath().string()), canonical("setting.xml", prefixConfigFile));
ASSERT_EQ(canonical(config.assemblingFilePath().string()), canonical("assembling.xml", prefixConfigFile));
Expand Down Expand Up @@ -149,7 +149,7 @@ TEST(Config, ConfigSA) {
ASSERT_FALSE(config.isShuntRegulationOn());
ASSERT_FALSE(config.isAutomaticSlackBusOn());

std::string prefixConfigFile = remove_file_name(createAbsolutePath("./res/config_SA.json", current_path()));
std::string prefixConfigFile = removeFileName(createAbsolutePath("./res/config_SA.json", currentPath()));

ASSERT_EQ(canonical(config.settingFilePath().string()), canonical("setting.xml", prefixConfigFile));
ASSERT_EQ(canonical(config.assemblingFilePath().string()), canonical("assembling.xml", prefixConfigFile));
Expand Down
Loading