mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-16 20:24:48 -06:00
Indentation for previous commit
This commit is contained in:
parent
e4080a3fe4
commit
7077cfb35c
@ -96,45 +96,45 @@ BOOST_FIXTURE_TEST_CASE(WithOutputDir, Fixture)
|
||||
using PathPair = std::pair<std::filesystem::path, std::filesystem::path>;
|
||||
|
||||
for (const bool createFaultyFileWithDirectory : {true, false}) {
|
||||
for (const auto& Case : {PathPair{input_path, input_path / "output1"},
|
||||
PathPair{input_path / "subdir", input_path / "output2"},
|
||||
PathPair{input_path / "subdir" / "subdir", input_path / "output3"}}) {
|
||||
const std::string output_path = "--output-dir=" + Case.second.string();
|
||||
const std::string input_file_path = (Case.first / "INPUT.DATA");
|
||||
for (const auto& Case : {PathPair{input_path, input_path / "output1"},
|
||||
PathPair{input_path / "subdir", input_path / "output2"},
|
||||
PathPair{input_path / "subdir" / "subdir", input_path / "output3"}}) {
|
||||
const std::string output_path = "--output-dir=" + Case.second.string();
|
||||
const std::string input_file_path = (Case.first / "INPUT.DATA");
|
||||
|
||||
const std::string output_dbg_path = (Case.second / "INPUT.DBG");
|
||||
if (createFaultyFileWithDirectory) {
|
||||
std::filesystem::create_directories(Case.second);
|
||||
// Create file with faulty content
|
||||
std::string dummy = R"(dummy)";
|
||||
std::ofstream of(output_dbg_path);
|
||||
of << dummy << std::endl;
|
||||
const std::string output_dbg_path = (Case.second / "INPUT.DBG");
|
||||
if (createFaultyFileWithDirectory) {
|
||||
std::filesystem::create_directories(Case.second);
|
||||
// Create file with faulty content
|
||||
std::string dummy = R"(dummy)";
|
||||
std::ofstream of(output_dbg_path);
|
||||
of << dummy << std::endl;
|
||||
}
|
||||
|
||||
const char* no_param[] = {"test_outputdir", input_file_path.c_str(),
|
||||
output_path.c_str(), nullptr};
|
||||
|
||||
using ParamsMeta = Opm::GetProp<Opm::Properties::TTag::FlowEarlyBird,
|
||||
Opm::Properties::ParameterMetaData>;
|
||||
ParamsMeta::clear();
|
||||
|
||||
Opm::Main main(3, const_cast<char**>(no_param), false);
|
||||
|
||||
BOOST_CHECK_EQUAL(main.justInitialize(), EXIT_SUCCESS);
|
||||
// Check if the files have been created at the right spot
|
||||
BOOST_CHECK(!std::filesystem::exists(input_path / "INPUT.PRT"));
|
||||
BOOST_CHECK(!std::filesystem::exists(input_path / "INPUT.DBG"));
|
||||
BOOST_CHECK(!std::filesystem::exists(Case.first / "INPUT.PRT"));
|
||||
BOOST_CHECK(!std::filesystem::exists(Case.first / "INPUT.DBG"));
|
||||
BOOST_CHECK(std::filesystem::exists(Case.second / "INPUT.PRT"));
|
||||
BOOST_CHECK(std::filesystem::exists(output_dbg_path));
|
||||
|
||||
// Check if the file with the faulty content has been removed and replaced by a valid one
|
||||
std::ifstream file(output_dbg_path);
|
||||
std::string line;
|
||||
std::getline(file, line);
|
||||
BOOST_CHECK(line.find("dummy") == std::string::npos);
|
||||
}
|
||||
|
||||
const char* no_param[] = {"test_outputdir", input_file_path.c_str(),
|
||||
output_path.c_str(), nullptr};
|
||||
|
||||
using ParamsMeta = Opm::GetProp<Opm::Properties::TTag::FlowEarlyBird,
|
||||
Opm::Properties::ParameterMetaData>;
|
||||
ParamsMeta::clear();
|
||||
|
||||
Opm::Main main(3, const_cast<char**>(no_param), false);
|
||||
|
||||
BOOST_CHECK_EQUAL(main.justInitialize(), EXIT_SUCCESS);
|
||||
// Check if the files have been created at the right spot
|
||||
BOOST_CHECK(!std::filesystem::exists(input_path / "INPUT.PRT"));
|
||||
BOOST_CHECK(!std::filesystem::exists(input_path / "INPUT.DBG"));
|
||||
BOOST_CHECK(!std::filesystem::exists(Case.first / "INPUT.PRT"));
|
||||
BOOST_CHECK(!std::filesystem::exists(Case.first / "INPUT.DBG"));
|
||||
BOOST_CHECK(std::filesystem::exists(Case.second / "INPUT.PRT"));
|
||||
BOOST_CHECK(std::filesystem::exists(output_dbg_path));
|
||||
|
||||
// Check if the file with the faulty content has been removed and replaced by a valid one
|
||||
std::ifstream file(output_dbg_path);
|
||||
std::string line;
|
||||
std::getline(file, line);
|
||||
BOOST_CHECK(line.find("dummy") == std::string::npos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user