Remove duplicated read_yaml_file function
This commit is contained in:
@ -193,18 +193,6 @@ void data_lammps(LAMMPS_NS::LAMMPS *lmp, const TestConfig &cfg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// read/parse yaml file
|
|
||||||
|
|
||||||
bool read_yaml_file(const char *infile, TestConfig &config)
|
|
||||||
{
|
|
||||||
auto reader = TestConfigReader(config);
|
|
||||||
if (reader.parse_file(infile))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
config.basename = reader.get_basename();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// re-generate yaml file with current settings.
|
// re-generate yaml file with current settings.
|
||||||
|
|
||||||
void generate_yaml_file(const char *outfile, const TestConfig &config)
|
void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||||
|
|||||||
@ -194,18 +194,6 @@ void data_lammps(LAMMPS_NS::LAMMPS *lmp, const TestConfig &cfg)
|
|||||||
lmp->input->one("run 0 post no");
|
lmp->input->one("run 0 post no");
|
||||||
}
|
}
|
||||||
|
|
||||||
// read/parse yaml file
|
|
||||||
|
|
||||||
bool read_yaml_file(const char *infile, TestConfig &config)
|
|
||||||
{
|
|
||||||
auto reader = TestConfigReader(config);
|
|
||||||
if (reader.parse_file(infile))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
config.basename = reader.get_basename();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// re-generate yaml file with current settings.
|
// re-generate yaml file with current settings.
|
||||||
|
|
||||||
void generate_yaml_file(const char *outfile, const TestConfig &config)
|
void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||||
|
|||||||
@ -194,15 +194,6 @@ void data_lammps(LAMMPS_NS::LAMMPS *lmp, const TestConfig &cfg)
|
|||||||
|
|
||||||
// read/parse yaml file
|
// read/parse yaml file
|
||||||
|
|
||||||
bool read_yaml_file(const char *infile, TestConfig &config)
|
|
||||||
{
|
|
||||||
auto reader = TestConfigReader(config);
|
|
||||||
if (reader.parse_file(infile))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
config.basename = reader.get_basename();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// re-generate yaml file with current settings.
|
// re-generate yaml file with current settings.
|
||||||
|
|
||||||
|
|||||||
@ -13,14 +13,25 @@
|
|||||||
|
|
||||||
#include "test_main.h"
|
#include "test_main.h"
|
||||||
#include "test_config.h"
|
#include "test_config.h"
|
||||||
|
#include "test_config_reader.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
#include <mpi.h>
|
#include <mpi.h>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
// common read_yaml_file function
|
||||||
|
bool read_yaml_file(const char *infile, TestConfig &config)
|
||||||
|
{
|
||||||
|
auto reader = TestConfigReader(config);
|
||||||
|
if (reader.parse_file(infile))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
config.basename = reader.get_basename();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// need to be defined in unit test body
|
// need to be defined in unit test body
|
||||||
extern bool read_yaml_file(const char *, TestConfig &);
|
|
||||||
extern void generate_yaml_file(const char *, const TestConfig &);
|
extern void generate_yaml_file(const char *, const TestConfig &);
|
||||||
|
|
||||||
void usage(std::ostream &out, const char *name)
|
void usage(std::ostream &out, const char *name)
|
||||||
|
|||||||
Reference in New Issue
Block a user