Unverified Commit c0acb3a4 authored by Richard Berger's avatar Richard Berger
Browse files

Remove multiple definitions of STRINGIFY

parent c04a71a2
Loading
Loading
Loading
Loading
+3 −15
Original line number Diff line number Diff line
@@ -99,20 +99,14 @@ LAMMPS_NS::LAMMPS *init_lammps(int argc, char **argv,
        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 ";
    set_input_dir += STRINGIFY(TEST_INPUT_FOLDER);
    set_input_dir += INPUT_FOLDER;
    lmp->input->one(set_input_dir.c_str());
    for (auto pre_command : cfg.pre_commands)
        lmp->input->one(pre_command.c_str());

    std::string input_file = STRINGIFY(TEST_INPUT_FOLDER);
    input_file += "/";
    input_file += cfg.input_file;
    std::string input_file = INPUT_FOLDER + PATH_SEP + cfg.input_file;
    lmp->input->file(input_file.c_str());
#undef STRINGIFY
#undef XSTR

    std::string cmd("angle_style ");
    cmd += cfg.angle_style;
@@ -186,14 +180,8 @@ void data_lammps(LAMMPS_NS::LAMMPS *lmp, const TestConfig &cfg)
    cmd += cfg.basename + ".data";
    lmp->input->one(cmd.c_str());

#define STRINGIFY(val) XSTR(val)
#define XSTR(val) #val
    std::string input_file = STRINGIFY(TEST_INPUT_FOLDER);
    input_file += "/";
    input_file += cfg.input_file;
    std::string input_file = INPUT_FOLDER + PATH_SEP + cfg.input_file;
    lmp->input->file(input_file.c_str());
#undef STRINGIFY
#undef XSTR

    for (auto angle_coeff : cfg.angle_coeff) {
        cmd = "angle_coeff " + angle_coeff;
+7 −21
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@
using ::testing::StartsWith;
using ::testing::HasSubstr;


void cleanup_lammps(LAMMPS_NS::LAMMPS *lmp, const TestConfig &cfg)
{
    std::string name;
@@ -90,7 +91,7 @@ LAMMPS_NS::LAMMPS *init_lammps(int argc, char **argv,
    if (nfail > 0) {
        delete info;
        cleanup_lammps(lmp,cfg);
        return NULL;
        return nullptr;
    }

    if (newton) {
@@ -99,20 +100,15 @@ LAMMPS_NS::LAMMPS *init_lammps(int argc, char **argv,
        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 ";
    set_input_dir += STRINGIFY(TEST_INPUT_FOLDER);
    set_input_dir += INPUT_FOLDER;
    lmp->input->one(set_input_dir.c_str());
    for (auto pre_command : cfg.pre_commands)
        lmp->input->one(pre_command.c_str());

    std::string input_file = STRINGIFY(TEST_INPUT_FOLDER);
    input_file += "/";
    input_file += cfg.input_file;
    std::string input_file = INPUT_FOLDER + "/" + cfg.input_file;

    lmp->input->file(input_file.c_str());
#undef STRINGIFY
#undef XSTR

    std::string cmd("bond_style ");
    cmd += cfg.bond_style;
@@ -186,14 +182,8 @@ void data_lammps(LAMMPS_NS::LAMMPS *lmp, const TestConfig &cfg)
    cmd += cfg.basename + ".data";
    lmp->input->one(cmd.c_str());

#define STRINGIFY(val) XSTR(val)
#define XSTR(val) #val
    std::string input_file = STRINGIFY(TEST_INPUT_FOLDER);
    input_file += "/";
    input_file += cfg.input_file;
    std::string input_file = INPUT_FOLDER + PATH_SEP + cfg.input_file;
    lmp->input->file(input_file.c_str());
#undef STRINGIFY
#undef XSTR

    for (auto bond_coeff : cfg.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 index on");

#define STRINGIFY(val) XSTR(val)
#define XSTR(val) #val
    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());
    for (auto pre_command : test_config.pre_commands)
        lmp->input->one(pre_command.c_str());
#undef STRINGIFY
#undef XSTR

    lmp->input->one("atom_style molecular");
    lmp->input->one("units ${units}");
+4 −20
Original line number Diff line number Diff line
@@ -99,20 +99,14 @@ LAMMPS_NS::LAMMPS *init_lammps(int argc, char **argv,
        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 ";
    set_input_dir += STRINGIFY(TEST_INPUT_FOLDER);
    set_input_dir += INPUT_FOLDER;
    lmp->input->one(set_input_dir.c_str());
    for (auto pre_command : cfg.pre_commands)
        lmp->input->one(pre_command.c_str());

    std::string input_file = STRINGIFY(TEST_INPUT_FOLDER);
    input_file += "/";
    input_file += cfg.input_file;
    std::string input_file = INPUT_FOLDER + PATH_SEP + cfg.input_file;
    lmp->input->file(input_file.c_str());
#undef STRINGIFY
#undef XSTR

    std::string cmd("pair_style ");
    cmd += cfg.pair_style;
@@ -186,14 +180,8 @@ void data_lammps(LAMMPS_NS::LAMMPS *lmp, const TestConfig &cfg)
    cmd += cfg.basename + ".data";
    lmp->input->one(cmd.c_str());

#define STRINGIFY(val) XSTR(val)
#define XSTR(val) #val
    std::string input_file = STRINGIFY(TEST_INPUT_FOLDER);
    input_file += "/";
    input_file += cfg.input_file;
    std::string input_file = INPUT_FOLDER + PATH_SEP + cfg.input_file;
    lmp->input->file(input_file.c_str());
#undef STRINGIFY
#undef XSTR

    for (auto pair_coeff : cfg.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 index on");

#define STRINGIFY(val) XSTR(val)
#define XSTR(val) #val
    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());
    for (auto pre_command : test_config.pre_commands)
        lmp->input->one(pre_command.c_str());
#undef STRINGIFY
#undef XSTR

    lmp->input->one("atom_style full");
    lmp->input->one("units ${units}");
+12 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
#define TEST_MAIN_H

#include "test_config.h"
#include <string>

extern TestConfig test_config;
extern bool print_stats;
@@ -31,3 +32,14 @@ extern bool verbose;

#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