Remove multiple definitions of STRINGIFY
This commit is contained in:
@ -99,20 +99,14 @@ LAMMPS_NS::LAMMPS *init_lammps(int argc, char **argv,
|
|||||||
lmp->input->one("variable newton_bond index off");
|
lmp->input->one("variable newton_bond index off");
|
||||||
}
|
}
|
||||||
|
|
||||||
#define STRINGIFY(val) XSTR(val)
|
|
||||||
#define XSTR(val) #val
|
|
||||||
std::string set_input_dir = "variable input_dir index ";
|
std::string set_input_dir = "variable input_dir index ";
|
||||||
set_input_dir += STRINGIFY(TEST_INPUT_FOLDER);
|
set_input_dir += INPUT_FOLDER;
|
||||||
lmp->input->one(set_input_dir.c_str());
|
lmp->input->one(set_input_dir.c_str());
|
||||||
for (auto pre_command : cfg.pre_commands)
|
for (auto pre_command : cfg.pre_commands)
|
||||||
lmp->input->one(pre_command.c_str());
|
lmp->input->one(pre_command.c_str());
|
||||||
|
|
||||||
std::string input_file = STRINGIFY(TEST_INPUT_FOLDER);
|
std::string input_file = INPUT_FOLDER + PATH_SEP + cfg.input_file;
|
||||||
input_file += "/";
|
|
||||||
input_file += cfg.input_file;
|
|
||||||
lmp->input->file(input_file.c_str());
|
lmp->input->file(input_file.c_str());
|
||||||
#undef STRINGIFY
|
|
||||||
#undef XSTR
|
|
||||||
|
|
||||||
std::string cmd("angle_style ");
|
std::string cmd("angle_style ");
|
||||||
cmd += cfg.angle_style;
|
cmd += cfg.angle_style;
|
||||||
@ -186,14 +180,8 @@ void data_lammps(LAMMPS_NS::LAMMPS *lmp, const TestConfig &cfg)
|
|||||||
cmd += cfg.basename + ".data";
|
cmd += cfg.basename + ".data";
|
||||||
lmp->input->one(cmd.c_str());
|
lmp->input->one(cmd.c_str());
|
||||||
|
|
||||||
#define STRINGIFY(val) XSTR(val)
|
std::string input_file = INPUT_FOLDER + PATH_SEP + cfg.input_file;
|
||||||
#define XSTR(val) #val
|
|
||||||
std::string input_file = STRINGIFY(TEST_INPUT_FOLDER);
|
|
||||||
input_file += "/";
|
|
||||||
input_file += cfg.input_file;
|
|
||||||
lmp->input->file(input_file.c_str());
|
lmp->input->file(input_file.c_str());
|
||||||
#undef STRINGIFY
|
|
||||||
#undef XSTR
|
|
||||||
|
|
||||||
for (auto angle_coeff : cfg.angle_coeff) {
|
for (auto angle_coeff : cfg.angle_coeff) {
|
||||||
cmd = "angle_coeff " + angle_coeff;
|
cmd = "angle_coeff " + angle_coeff;
|
||||||
|
|||||||
@ -49,6 +49,7 @@
|
|||||||
using ::testing::StartsWith;
|
using ::testing::StartsWith;
|
||||||
using ::testing::HasSubstr;
|
using ::testing::HasSubstr;
|
||||||
|
|
||||||
|
|
||||||
void cleanup_lammps(LAMMPS_NS::LAMMPS *lmp, const TestConfig &cfg)
|
void cleanup_lammps(LAMMPS_NS::LAMMPS *lmp, const TestConfig &cfg)
|
||||||
{
|
{
|
||||||
std::string name;
|
std::string name;
|
||||||
@ -90,7 +91,7 @@ LAMMPS_NS::LAMMPS *init_lammps(int argc, char **argv,
|
|||||||
if (nfail > 0) {
|
if (nfail > 0) {
|
||||||
delete info;
|
delete info;
|
||||||
cleanup_lammps(lmp,cfg);
|
cleanup_lammps(lmp,cfg);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newton) {
|
if (newton) {
|
||||||
@ -99,20 +100,15 @@ LAMMPS_NS::LAMMPS *init_lammps(int argc, char **argv,
|
|||||||
lmp->input->one("variable newton_bond index off");
|
lmp->input->one("variable newton_bond index off");
|
||||||
}
|
}
|
||||||
|
|
||||||
#define STRINGIFY(val) XSTR(val)
|
|
||||||
#define XSTR(val) #val
|
|
||||||
std::string set_input_dir = "variable input_dir index ";
|
std::string set_input_dir = "variable input_dir index ";
|
||||||
set_input_dir += STRINGIFY(TEST_INPUT_FOLDER);
|
set_input_dir += INPUT_FOLDER;
|
||||||
lmp->input->one(set_input_dir.c_str());
|
lmp->input->one(set_input_dir.c_str());
|
||||||
for (auto pre_command : cfg.pre_commands)
|
for (auto pre_command : cfg.pre_commands)
|
||||||
lmp->input->one(pre_command.c_str());
|
lmp->input->one(pre_command.c_str());
|
||||||
|
|
||||||
std::string input_file = STRINGIFY(TEST_INPUT_FOLDER);
|
std::string input_file = INPUT_FOLDER + "/" + cfg.input_file;
|
||||||
input_file += "/";
|
|
||||||
input_file += cfg.input_file;
|
|
||||||
lmp->input->file(input_file.c_str());
|
lmp->input->file(input_file.c_str());
|
||||||
#undef STRINGIFY
|
|
||||||
#undef XSTR
|
|
||||||
|
|
||||||
std::string cmd("bond_style ");
|
std::string cmd("bond_style ");
|
||||||
cmd += cfg.bond_style;
|
cmd += cfg.bond_style;
|
||||||
@ -186,14 +182,8 @@ void data_lammps(LAMMPS_NS::LAMMPS *lmp, const TestConfig &cfg)
|
|||||||
cmd += cfg.basename + ".data";
|
cmd += cfg.basename + ".data";
|
||||||
lmp->input->one(cmd.c_str());
|
lmp->input->one(cmd.c_str());
|
||||||
|
|
||||||
#define STRINGIFY(val) XSTR(val)
|
std::string input_file = INPUT_FOLDER + PATH_SEP + cfg.input_file;
|
||||||
#define XSTR(val) #val
|
|
||||||
std::string input_file = STRINGIFY(TEST_INPUT_FOLDER);
|
|
||||||
input_file += "/";
|
|
||||||
input_file += cfg.input_file;
|
|
||||||
lmp->input->file(input_file.c_str());
|
lmp->input->file(input_file.c_str());
|
||||||
#undef STRINGIFY
|
|
||||||
#undef XSTR
|
|
||||||
|
|
||||||
for (auto bond_coeff : cfg.bond_coeff) {
|
for (auto bond_coeff : cfg.bond_coeff) {
|
||||||
cmd = "bond_coeff " + bond_coeff;
|
cmd = "bond_coeff " + bond_coeff;
|
||||||
@ -801,15 +791,11 @@ TEST(BondStyle, single) {
|
|||||||
lmp->input->one("variable newton_bond delete");
|
lmp->input->one("variable newton_bond delete");
|
||||||
lmp->input->one("variable newton_bond index on");
|
lmp->input->one("variable newton_bond index on");
|
||||||
|
|
||||||
#define STRINGIFY(val) XSTR(val)
|
|
||||||
#define XSTR(val) #val
|
|
||||||
std::string set_input_dir = "variable input_dir index ";
|
std::string set_input_dir = "variable input_dir index ";
|
||||||
set_input_dir += STRINGIFY(TEST_INPUT_FOLDER);
|
set_input_dir += INPUT_FOLDER;
|
||||||
lmp->input->one(set_input_dir.c_str());
|
lmp->input->one(set_input_dir.c_str());
|
||||||
for (auto pre_command : test_config.pre_commands)
|
for (auto pre_command : test_config.pre_commands)
|
||||||
lmp->input->one(pre_command.c_str());
|
lmp->input->one(pre_command.c_str());
|
||||||
#undef STRINGIFY
|
|
||||||
#undef XSTR
|
|
||||||
|
|
||||||
lmp->input->one("atom_style molecular");
|
lmp->input->one("atom_style molecular");
|
||||||
lmp->input->one("units ${units}");
|
lmp->input->one("units ${units}");
|
||||||
|
|||||||
@ -99,20 +99,14 @@ LAMMPS_NS::LAMMPS *init_lammps(int argc, char **argv,
|
|||||||
lmp->input->one("variable newton_pair index off");
|
lmp->input->one("variable newton_pair index off");
|
||||||
}
|
}
|
||||||
|
|
||||||
#define STRINGIFY(val) XSTR(val)
|
|
||||||
#define XSTR(val) #val
|
|
||||||
std::string set_input_dir = "variable input_dir index ";
|
std::string set_input_dir = "variable input_dir index ";
|
||||||
set_input_dir += STRINGIFY(TEST_INPUT_FOLDER);
|
set_input_dir += INPUT_FOLDER;
|
||||||
lmp->input->one(set_input_dir.c_str());
|
lmp->input->one(set_input_dir.c_str());
|
||||||
for (auto pre_command : cfg.pre_commands)
|
for (auto pre_command : cfg.pre_commands)
|
||||||
lmp->input->one(pre_command.c_str());
|
lmp->input->one(pre_command.c_str());
|
||||||
|
|
||||||
std::string input_file = STRINGIFY(TEST_INPUT_FOLDER);
|
std::string input_file = INPUT_FOLDER + PATH_SEP + cfg.input_file;
|
||||||
input_file += "/";
|
|
||||||
input_file += cfg.input_file;
|
|
||||||
lmp->input->file(input_file.c_str());
|
lmp->input->file(input_file.c_str());
|
||||||
#undef STRINGIFY
|
|
||||||
#undef XSTR
|
|
||||||
|
|
||||||
std::string cmd("pair_style ");
|
std::string cmd("pair_style ");
|
||||||
cmd += cfg.pair_style;
|
cmd += cfg.pair_style;
|
||||||
@ -186,14 +180,8 @@ void data_lammps(LAMMPS_NS::LAMMPS *lmp, const TestConfig &cfg)
|
|||||||
cmd += cfg.basename + ".data";
|
cmd += cfg.basename + ".data";
|
||||||
lmp->input->one(cmd.c_str());
|
lmp->input->one(cmd.c_str());
|
||||||
|
|
||||||
#define STRINGIFY(val) XSTR(val)
|
std::string input_file = INPUT_FOLDER + PATH_SEP + cfg.input_file;
|
||||||
#define XSTR(val) #val
|
|
||||||
std::string input_file = STRINGIFY(TEST_INPUT_FOLDER);
|
|
||||||
input_file += "/";
|
|
||||||
input_file += cfg.input_file;
|
|
||||||
lmp->input->file(input_file.c_str());
|
lmp->input->file(input_file.c_str());
|
||||||
#undef STRINGIFY
|
|
||||||
#undef XSTR
|
|
||||||
|
|
||||||
for (auto pair_coeff : cfg.pair_coeff) {
|
for (auto pair_coeff : cfg.pair_coeff) {
|
||||||
cmd = "pair_coeff " + pair_coeff;
|
cmd = "pair_coeff " + pair_coeff;
|
||||||
@ -1050,15 +1038,11 @@ TEST(PairStyle, single) {
|
|||||||
lmp->input->one("variable newton_pair delete");
|
lmp->input->one("variable newton_pair delete");
|
||||||
lmp->input->one("variable newton_pair index on");
|
lmp->input->one("variable newton_pair index on");
|
||||||
|
|
||||||
#define STRINGIFY(val) XSTR(val)
|
|
||||||
#define XSTR(val) #val
|
|
||||||
std::string set_input_dir = "variable input_dir index ";
|
std::string set_input_dir = "variable input_dir index ";
|
||||||
set_input_dir += STRINGIFY(TEST_INPUT_FOLDER);
|
set_input_dir += INPUT_FOLDER;
|
||||||
lmp->input->one(set_input_dir.c_str());
|
lmp->input->one(set_input_dir.c_str());
|
||||||
for (auto pre_command : test_config.pre_commands)
|
for (auto pre_command : test_config.pre_commands)
|
||||||
lmp->input->one(pre_command.c_str());
|
lmp->input->one(pre_command.c_str());
|
||||||
#undef STRINGIFY
|
|
||||||
#undef XSTR
|
|
||||||
|
|
||||||
lmp->input->one("atom_style full");
|
lmp->input->one("atom_style full");
|
||||||
lmp->input->one("units ${units}");
|
lmp->input->one("units ${units}");
|
||||||
|
|||||||
@ -15,6 +15,7 @@
|
|||||||
#define TEST_MAIN_H
|
#define TEST_MAIN_H
|
||||||
|
|
||||||
#include "test_config.h"
|
#include "test_config.h"
|
||||||
|
#include <string>
|
||||||
|
|
||||||
extern TestConfig test_config;
|
extern TestConfig test_config;
|
||||||
extern bool print_stats;
|
extern bool print_stats;
|
||||||
@ -31,3 +32,14 @@ extern bool verbose;
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define STRINGIFY(val) XSTR(val)
|
||||||
|
#define XSTR(val) #val
|
||||||
|
static const std::string INPUT_FOLDER = STRINGIFY(TEST_INPUT_FOLDER);
|
||||||
|
#undef STRINGIFY
|
||||||
|
#undef XSTR
|
||||||
|
|
||||||
|
#if defined _WIN32
|
||||||
|
static const char PATH_SEP = '\\';
|
||||||
|
#else
|
||||||
|
static const char PATH_SEP = '/';
|
||||||
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user