apply clang-format
This commit is contained in:
@ -20,7 +20,7 @@ const char *cont_input[] = {"create_atoms 1 single &", "0.2 0.1 0.1"};
|
|||||||
class LibraryCommands : public ::testing::Test {
|
class LibraryCommands : public ::testing::Test {
|
||||||
protected:
|
protected:
|
||||||
void *lmp;
|
void *lmp;
|
||||||
LibraryCommands() = default;
|
LibraryCommands() = default;
|
||||||
~LibraryCommands() override = default;
|
~LibraryCommands() override = default;
|
||||||
|
|
||||||
void SetUp() override
|
void SetUp() override
|
||||||
@ -55,13 +55,13 @@ TEST_F(LibraryCommands, from_file)
|
|||||||
const char cont_file[] = "in.cont";
|
const char cont_file[] = "in.cont";
|
||||||
|
|
||||||
fp = fopen(demo_file, "w");
|
fp = fopen(demo_file, "w");
|
||||||
for (auto & inp : demo_input) {
|
for (auto &inp : demo_input) {
|
||||||
fputs(inp, fp);
|
fputs(inp, fp);
|
||||||
fputc('\n', fp);
|
fputc('\n', fp);
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
fp = fopen(cont_file, "w");
|
fp = fopen(cont_file, "w");
|
||||||
for (auto & inp : cont_input) {
|
for (auto &inp : cont_input) {
|
||||||
fputs(inp, fp);
|
fputs(inp, fp);
|
||||||
fputc('\n', fp);
|
fputc('\n', fp);
|
||||||
}
|
}
|
||||||
@ -85,7 +85,7 @@ TEST_F(LibraryCommands, from_line)
|
|||||||
{
|
{
|
||||||
EXPECT_EQ(lammps_get_natoms(lmp), 0);
|
EXPECT_EQ(lammps_get_natoms(lmp), 0);
|
||||||
if (!verbose) ::testing::internal::CaptureStdout();
|
if (!verbose) ::testing::internal::CaptureStdout();
|
||||||
for (auto & inp : demo_input) {
|
for (auto &inp : demo_input) {
|
||||||
lammps_command(lmp, inp);
|
lammps_command(lmp, inp);
|
||||||
}
|
}
|
||||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||||
@ -106,11 +106,11 @@ TEST_F(LibraryCommands, from_string)
|
|||||||
{
|
{
|
||||||
std::string cmds("");
|
std::string cmds("");
|
||||||
|
|
||||||
for (auto & inp : demo_input) {
|
for (auto &inp : demo_input) {
|
||||||
cmds += inp;
|
cmds += inp;
|
||||||
cmds += "\n";
|
cmds += "\n";
|
||||||
}
|
}
|
||||||
for (auto & inp : cont_input) {
|
for (auto &inp : cont_input) {
|
||||||
cmds += inp;
|
cmds += inp;
|
||||||
cmds += "\n";
|
cmds += "\n";
|
||||||
}
|
}
|
||||||
@ -126,11 +126,11 @@ TEST_F(LibraryCommands, from_string)
|
|||||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||||
|
|
||||||
cmds.clear();
|
cmds.clear();
|
||||||
for (auto & inp : demo_input) {
|
for (auto &inp : demo_input) {
|
||||||
cmds += inp;
|
cmds += inp;
|
||||||
cmds += "\r\n";
|
cmds += "\r\n";
|
||||||
}
|
}
|
||||||
for (auto & inp : cont_input) {
|
for (auto &inp : cont_input) {
|
||||||
cmds += inp;
|
cmds += inp;
|
||||||
cmds += "\r\n";
|
cmds += "\r\n";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,7 +22,7 @@ protected:
|
|||||||
void *lmp;
|
void *lmp;
|
||||||
std::string INPUT_DIR = STRINGIFY(TEST_INPUT_FOLDER);
|
std::string INPUT_DIR = STRINGIFY(TEST_INPUT_FOLDER);
|
||||||
|
|
||||||
LibraryConfig() = default;
|
LibraryConfig() = default;
|
||||||
~LibraryConfig() override = default;
|
~LibraryConfig() override = default;
|
||||||
|
|
||||||
void SetUp() override
|
void SetUp() override
|
||||||
|
|||||||
@ -23,7 +23,7 @@ protected:
|
|||||||
void *lmp;
|
void *lmp;
|
||||||
std::string INPUT_DIR = STRINGIFY(TEST_INPUT_FOLDER);
|
std::string INPUT_DIR = STRINGIFY(TEST_INPUT_FOLDER);
|
||||||
|
|
||||||
LibraryProperties() = default;
|
LibraryProperties() = default;
|
||||||
~LibraryProperties() override = default;
|
~LibraryProperties() override = default;
|
||||||
|
|
||||||
void SetUp() override
|
void SetUp() override
|
||||||
@ -436,8 +436,10 @@ class AtomProperties : public ::testing::Test {
|
|||||||
protected:
|
protected:
|
||||||
void *lmp;
|
void *lmp;
|
||||||
|
|
||||||
AtomProperties()= default;;
|
AtomProperties() = default;
|
||||||
~AtomProperties() override= default;;
|
;
|
||||||
|
~AtomProperties() override = default;
|
||||||
|
;
|
||||||
|
|
||||||
void SetUp() override
|
void SetUp() override
|
||||||
{
|
{
|
||||||
|
|||||||
@ -23,7 +23,7 @@ protected:
|
|||||||
void *lmp;
|
void *lmp;
|
||||||
std::string INPUT_DIR = STRINGIFY(TEST_INPUT_FOLDER);
|
std::string INPUT_DIR = STRINGIFY(TEST_INPUT_FOLDER);
|
||||||
|
|
||||||
GatherProperties() = default;
|
GatherProperties() = default;
|
||||||
~GatherProperties() override = default;
|
~GatherProperties() override = default;
|
||||||
|
|
||||||
void SetUp() override
|
void SetUp() override
|
||||||
|
|||||||
@ -35,8 +35,8 @@ bool verbose = false;
|
|||||||
using LAMMPS_NS::utils::split_words;
|
using LAMMPS_NS::utils::split_words;
|
||||||
|
|
||||||
namespace LAMMPS_NS {
|
namespace LAMMPS_NS {
|
||||||
using ::testing::ExitedWithCode;
|
|
||||||
using ::testing::ContainsRegex;
|
using ::testing::ContainsRegex;
|
||||||
|
using ::testing::ExitedWithCode;
|
||||||
using ::testing::StrEq;
|
using ::testing::StrEq;
|
||||||
|
|
||||||
class LatticeRegionTest : public LAMMPSTest {
|
class LatticeRegionTest : public LAMMPSTest {
|
||||||
|
|||||||
@ -39,8 +39,8 @@ bool verbose = false;
|
|||||||
using LAMMPS_NS::utils::split_words;
|
using LAMMPS_NS::utils::split_words;
|
||||||
|
|
||||||
namespace LAMMPS_NS {
|
namespace LAMMPS_NS {
|
||||||
using ::testing::ExitedWithCode;
|
|
||||||
using ::testing::ContainsRegex;
|
using ::testing::ContainsRegex;
|
||||||
|
using ::testing::ExitedWithCode;
|
||||||
using ::testing::StrEq;
|
using ::testing::StrEq;
|
||||||
|
|
||||||
class SimpleCommandsTest : public LAMMPSTest {
|
class SimpleCommandsTest : public LAMMPSTest {
|
||||||
@ -412,14 +412,14 @@ TEST_F(SimpleCommandsTest, Plugin)
|
|||||||
text = ::testing::internal::GetCapturedStdout();
|
text = ::testing::internal::GetCapturedStdout();
|
||||||
if (verbose) std::cout << text;
|
if (verbose) std::cout << text;
|
||||||
ASSERT_THAT(text, ContainsRegex(".*1: command style plugin hello"
|
ASSERT_THAT(text, ContainsRegex(".*1: command style plugin hello"
|
||||||
".*2: fix style plugin nve2.*"));
|
".*2: fix style plugin nve2.*"));
|
||||||
|
|
||||||
::testing::internal::CaptureStdout();
|
::testing::internal::CaptureStdout();
|
||||||
lmp->input->one(fmt::format(loadfmt, "hello"));
|
lmp->input->one(fmt::format(loadfmt, "hello"));
|
||||||
text = ::testing::internal::GetCapturedStdout();
|
text = ::testing::internal::GetCapturedStdout();
|
||||||
if (verbose) std::cout << text;
|
if (verbose) std::cout << text;
|
||||||
ASSERT_THAT(text, ContainsRegex(".*Ignoring load of command style hello: "
|
ASSERT_THAT(text, ContainsRegex(".*Ignoring load of command style hello: "
|
||||||
"must unload existing hello plugin.*"));
|
"must unload existing hello plugin.*"));
|
||||||
|
|
||||||
::testing::internal::CaptureStdout();
|
::testing::internal::CaptureStdout();
|
||||||
lmp->input->one("plugin unload command hello");
|
lmp->input->one("plugin unload command hello");
|
||||||
@ -479,7 +479,8 @@ TEST_F(SimpleCommandsTest, Shell)
|
|||||||
test_var = getenv("TEST_VARIABLE");
|
test_var = getenv("TEST_VARIABLE");
|
||||||
ASSERT_NE(test_var, nullptr);
|
ASSERT_NE(test_var, nullptr);
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
// we cannot create empty environment variables on Windows so platform::putenv() sets their value to "1"
|
// we cannot create empty environment variables on Windows so platform::putenv() sets their
|
||||||
|
// value to "1"
|
||||||
ASSERT_THAT(test_var, StrEq("1"));
|
ASSERT_THAT(test_var, StrEq("1"));
|
||||||
#else
|
#else
|
||||||
ASSERT_THAT(test_var, StrEq(""));
|
ASSERT_THAT(test_var, StrEq(""));
|
||||||
@ -501,7 +502,8 @@ TEST_F(SimpleCommandsTest, CiteMe)
|
|||||||
|
|
||||||
// find the two unique citations, but not the third
|
// find the two unique citations, but not the third
|
||||||
ASSERT_THAT(text, ContainsRegex("test citation one.\n.*test citation two.*"));
|
ASSERT_THAT(text, ContainsRegex("test citation one.\n.*test citation two.*"));
|
||||||
ASSERT_THAT(text, Not(ContainsRegex("test citation one.\n.*test citation two.*\n.*test citation one.*")));
|
ASSERT_THAT(text, Not(ContainsRegex(
|
||||||
|
"test citation one.\n.*test citation two.*\n.*test citation one.*")));
|
||||||
|
|
||||||
BEGIN_CAPTURE_OUTPUT();
|
BEGIN_CAPTURE_OUTPUT();
|
||||||
lmp->citeme->add("test citation one:\n 0\n");
|
lmp->citeme->add("test citation one:\n 0\n");
|
||||||
|
|||||||
@ -36,8 +36,8 @@ using LAMMPS_NS::MathConst::MY_PI;
|
|||||||
using LAMMPS_NS::utils::split_words;
|
using LAMMPS_NS::utils::split_words;
|
||||||
|
|
||||||
namespace LAMMPS_NS {
|
namespace LAMMPS_NS {
|
||||||
using ::testing::ExitedWithCode;
|
|
||||||
using ::testing::ContainsRegex;
|
using ::testing::ContainsRegex;
|
||||||
|
using ::testing::ExitedWithCode;
|
||||||
using ::testing::StrEq;
|
using ::testing::StrEq;
|
||||||
|
|
||||||
class VariableTest : public LAMMPSTest {
|
class VariableTest : public LAMMPSTest {
|
||||||
@ -317,7 +317,7 @@ TEST_F(VariableTest, Expressions)
|
|||||||
ASSERT_TRUE(variable->equalstyle(ivar));
|
ASSERT_TRUE(variable->equalstyle(ivar));
|
||||||
ASSERT_DOUBLE_EQ(variable->compute_equal(ivar), 2.0);
|
ASSERT_DOUBLE_EQ(variable->compute_equal(ivar), 2.0);
|
||||||
ASSERT_DOUBLE_EQ(variable->compute_equal("v_three"), 3.0);
|
ASSERT_DOUBLE_EQ(variable->compute_equal("v_three"), 3.0);
|
||||||
ASSERT_NEAR(variable->compute_equal("v_four"), MY_PI,1.0e-14);
|
ASSERT_NEAR(variable->compute_equal("v_four"), MY_PI, 1.0e-14);
|
||||||
ASSERT_GE(variable->compute_equal("v_five"), 20210310);
|
ASSERT_GE(variable->compute_equal("v_five"), 20210310);
|
||||||
ASSERT_DOUBLE_EQ(variable->compute_equal("v_seven"), -1);
|
ASSERT_DOUBLE_EQ(variable->compute_equal("v_seven"), -1);
|
||||||
ASSERT_DOUBLE_EQ(variable->compute_equal("v_eight"), 2.5);
|
ASSERT_DOUBLE_EQ(variable->compute_equal("v_eight"), 2.5);
|
||||||
|
|||||||
@ -60,13 +60,13 @@ TEST_F(Input_commands, from_file)
|
|||||||
const char cont_file[] = "in.cont";
|
const char cont_file[] = "in.cont";
|
||||||
|
|
||||||
fp = fopen(demo_file, "w");
|
fp = fopen(demo_file, "w");
|
||||||
for (auto & inp : demo_input) {
|
for (auto &inp : demo_input) {
|
||||||
fputs(inp, fp);
|
fputs(inp, fp);
|
||||||
fputc('\n', fp);
|
fputc('\n', fp);
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
fp = fopen(cont_file, "w");
|
fp = fopen(cont_file, "w");
|
||||||
for (auto & inp : cont_input) {
|
for (auto &inp : cont_input) {
|
||||||
fputs(inp, fp);
|
fputs(inp, fp);
|
||||||
fputc('\n', fp);
|
fputc('\n', fp);
|
||||||
}
|
}
|
||||||
@ -84,7 +84,7 @@ TEST_F(Input_commands, from_file)
|
|||||||
TEST_F(Input_commands, from_line)
|
TEST_F(Input_commands, from_line)
|
||||||
{
|
{
|
||||||
EXPECT_EQ(lmp->atom->natoms, 0);
|
EXPECT_EQ(lmp->atom->natoms, 0);
|
||||||
for (auto & inp : demo_input) {
|
for (auto &inp : demo_input) {
|
||||||
lmp->input->one(inp);
|
lmp->input->one(inp);
|
||||||
}
|
}
|
||||||
EXPECT_EQ(lmp->atom->natoms, 1);
|
EXPECT_EQ(lmp->atom->natoms, 1);
|
||||||
|
|||||||
@ -372,8 +372,8 @@ TEST(LAMMPS_init, NoOpenMP)
|
|||||||
::testing::internal::CaptureStdout();
|
::testing::internal::CaptureStdout();
|
||||||
LAMMPS *lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD);
|
LAMMPS *lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD);
|
||||||
std::string output = ::testing::internal::GetCapturedStdout();
|
std::string output = ::testing::internal::GetCapturedStdout();
|
||||||
EXPECT_THAT(output,
|
EXPECT_THAT(output, ContainsRegex(
|
||||||
ContainsRegex(".*OMP_NUM_THREADS environment is not set.*Defaulting to 1 thread.*"));
|
".*OMP_NUM_THREADS environment is not set.*Defaulting to 1 thread.*"));
|
||||||
EXPECT_EQ(lmp->comm->nthreads, 1);
|
EXPECT_EQ(lmp->comm->nthreads, 1);
|
||||||
::testing::internal::CaptureStdout();
|
::testing::internal::CaptureStdout();
|
||||||
delete lmp;
|
delete lmp;
|
||||||
|
|||||||
@ -289,7 +289,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
|||||||
// run_stress
|
// run_stress
|
||||||
stress = lmp->force->angle->virial;
|
stress = lmp->force->angle->virial;
|
||||||
block = fmt::format("{:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e}", stress[0],
|
block = fmt::format("{:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e}", stress[0],
|
||||||
stress[1], stress[2], stress[3], stress[4], stress[5]);
|
stress[1], stress[2], stress[3], stress[4], stress[5]);
|
||||||
writer.emit_block("run_stress", block);
|
writer.emit_block("run_stress", block);
|
||||||
|
|
||||||
block.clear();
|
block.clear();
|
||||||
|
|||||||
@ -289,7 +289,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
|||||||
// run_stress
|
// run_stress
|
||||||
stress = lmp->force->bond->virial;
|
stress = lmp->force->bond->virial;
|
||||||
block = fmt::format("{:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e}", stress[0],
|
block = fmt::format("{:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e}", stress[0],
|
||||||
stress[1], stress[2], stress[3], stress[4], stress[5]);
|
stress[1], stress[2], stress[3], stress[4], stress[5]);
|
||||||
writer.emit_block("run_stress", block);
|
writer.emit_block("run_stress", block);
|
||||||
|
|
||||||
block.clear();
|
block.clear();
|
||||||
|
|||||||
@ -374,7 +374,7 @@ void TestConfigReader::tags(const yaml_event_t &event)
|
|||||||
{
|
{
|
||||||
std::stringstream data((char *)event.data.scalar.value);
|
std::stringstream data((char *)event.data.scalar.value);
|
||||||
config.tags.clear();
|
config.tags.clear();
|
||||||
for (std::string tag; std::getline(data, tag, ','); ) {
|
for (std::string tag; std::getline(data, tag, ',');) {
|
||||||
config.tags.push_back(trim(tag));
|
config.tags.push_back(trim(tag));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -292,7 +292,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
|||||||
// run_stress
|
// run_stress
|
||||||
stress = lmp->force->dihedral->virial;
|
stress = lmp->force->dihedral->virial;
|
||||||
block = fmt::format("{:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e}", stress[0],
|
block = fmt::format("{:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e}", stress[0],
|
||||||
stress[1], stress[2], stress[3], stress[4], stress[5]);
|
stress[1], stress[2], stress[3], stress[4], stress[5]);
|
||||||
writer.emit_block("run_stress", block);
|
writer.emit_block("run_stress", block);
|
||||||
|
|
||||||
block.clear();
|
block.clear();
|
||||||
|
|||||||
@ -209,8 +209,8 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
|||||||
if (fix->thermo_virial) {
|
if (fix->thermo_virial) {
|
||||||
auto stress = fix->virial;
|
auto stress = fix->virial;
|
||||||
block = fmt::format("{:23.16e} {:23.16e} {:23.16e} "
|
block = fmt::format("{:23.16e} {:23.16e} {:23.16e} "
|
||||||
"{:23.16e} {:23.16e} {:23.16e}",
|
"{:23.16e} {:23.16e} {:23.16e}",
|
||||||
stress[0], stress[1], stress[2], stress[3], stress[4], stress[5]);
|
stress[0], stress[1], stress[2], stress[3], stress[4], stress[5]);
|
||||||
writer.emit_block("run_stress", block);
|
writer.emit_block("run_stress", block);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -283,7 +283,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
|||||||
// run_stress
|
// run_stress
|
||||||
stress = lmp->force->improper->virial;
|
stress = lmp->force->improper->virial;
|
||||||
block = fmt::format("{:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e}", stress[0],
|
block = fmt::format("{:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e}", stress[0],
|
||||||
stress[1], stress[2], stress[3], stress[4], stress[5]);
|
stress[1], stress[2], stress[3], stress[4], stress[5]);
|
||||||
writer.emit_block("run_stress", block);
|
writer.emit_block("run_stress", block);
|
||||||
|
|
||||||
block.clear();
|
block.clear();
|
||||||
|
|||||||
@ -2123,7 +2123,7 @@ TEST_F(AtomStyleTest, body_nparticle)
|
|||||||
"12.0 0.0 12.0 0.0 0.0 0.0\n"
|
"12.0 0.0 12.0 0.0 0.0 0.0\n"
|
||||||
"0.0 1.0 0.0\n"
|
"0.0 1.0 0.0\n"
|
||||||
"0.0 -3.0 0.0\n";
|
"0.0 -3.0 0.0\n";
|
||||||
FILE *fp = fopen("input_atom_styles.data", "w");
|
FILE *fp = fopen("input_atom_styles.data", "w");
|
||||||
fputs(data_file, fp);
|
fputs(data_file, fp);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
BEGIN_HIDE_OUTPUT();
|
BEGIN_HIDE_OUTPUT();
|
||||||
|
|||||||
@ -547,12 +547,12 @@ TEST_F(DumpAtomTest, rerun_bin)
|
|||||||
command(fmt::format("rerun {} first 1 last 1 every 1 post no dump x y z", dump_file));
|
command(fmt::format("rerun {} first 1 last 1 every 1 post no dump x y z", dump_file));
|
||||||
});
|
});
|
||||||
lmp->output->thermo->evaluate_keyword("pe", &pe_rerun);
|
lmp->output->thermo->evaluate_keyword("pe", &pe_rerun);
|
||||||
ASSERT_NEAR(pe_1, pe_rerun,1.0e-14);
|
ASSERT_NEAR(pe_1, pe_rerun, 1.0e-14);
|
||||||
HIDE_OUTPUT([&] {
|
HIDE_OUTPUT([&] {
|
||||||
command(fmt::format("rerun {} first 2 last 2 every 1 post yes dump x y z", dump_file));
|
command(fmt::format("rerun {} first 2 last 2 every 1 post yes dump x y z", dump_file));
|
||||||
});
|
});
|
||||||
lmp->output->thermo->evaluate_keyword("pe", &pe_rerun);
|
lmp->output->thermo->evaluate_keyword("pe", &pe_rerun);
|
||||||
ASSERT_NEAR(pe_2, pe_rerun,1.0e-14);
|
ASSERT_NEAR(pe_2, pe_rerun, 1.0e-14);
|
||||||
delete_file(dump_file);
|
delete_file(dump_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -346,7 +346,7 @@ TEST_F(DumpCustomTest, rerun)
|
|||||||
});
|
});
|
||||||
lmp->output->thermo->evaluate_keyword("pe", &pe_rerun);
|
lmp->output->thermo->evaluate_keyword("pe", &pe_rerun);
|
||||||
ASSERT_DOUBLE_EQ(pe_1, pe_rerun);
|
ASSERT_DOUBLE_EQ(pe_1, pe_rerun);
|
||||||
|
|
||||||
HIDE_OUTPUT([&] {
|
HIDE_OUTPUT([&] {
|
||||||
command(fmt::format("rerun {} first 2 last 2 every 1 post yes dump x y z", dump_file));
|
command(fmt::format("rerun {} first 2 last 2 every 1 post yes dump x y z", dump_file));
|
||||||
});
|
});
|
||||||
@ -375,12 +375,12 @@ TEST_F(DumpCustomTest, rerun_bin)
|
|||||||
command(fmt::format("rerun {} first 1 last 1 every 1 post no dump x y z", dump_file));
|
command(fmt::format("rerun {} first 1 last 1 every 1 post no dump x y z", dump_file));
|
||||||
});
|
});
|
||||||
lmp->output->thermo->evaluate_keyword("pe", &pe_rerun);
|
lmp->output->thermo->evaluate_keyword("pe", &pe_rerun);
|
||||||
ASSERT_NEAR(pe_1, pe_rerun,1.0e-14);
|
ASSERT_NEAR(pe_1, pe_rerun, 1.0e-14);
|
||||||
HIDE_OUTPUT([&] {
|
HIDE_OUTPUT([&] {
|
||||||
command(fmt::format("rerun {} first 2 last 2 every 1 post yes dump x y z", dump_file));
|
command(fmt::format("rerun {} first 2 last 2 every 1 post yes dump x y z", dump_file));
|
||||||
});
|
});
|
||||||
lmp->output->thermo->evaluate_keyword("pe", &pe_rerun);
|
lmp->output->thermo->evaluate_keyword("pe", &pe_rerun);
|
||||||
ASSERT_NEAR(pe_2, pe_rerun,1.0e-14);
|
ASSERT_NEAR(pe_2, pe_rerun, 1.0e-14);
|
||||||
delete_file(dump_file);
|
delete_file(dump_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -334,7 +334,9 @@ TEST_F(FileOperationsTest, write_restart)
|
|||||||
ASSERT_FILE_EXISTS("multi2-0.restart");
|
ASSERT_FILE_EXISTS("multi2-0.restart");
|
||||||
ASSERT_FILE_EXISTS("multi3-base.restart");
|
ASSERT_FILE_EXISTS("multi3-base.restart");
|
||||||
ASSERT_FILE_EXISTS("multi3-0.restart");
|
ASSERT_FILE_EXISTS("multi3-0.restart");
|
||||||
if (info->has_package("MPIIO")) { ASSERT_FILE_EXISTS("test.restart.mpiio"); }
|
if (info->has_package("MPIIO")) {
|
||||||
|
ASSERT_FILE_EXISTS("test.restart.mpiio");
|
||||||
|
}
|
||||||
|
|
||||||
if (!info->has_package("MPIIO")) {
|
if (!info->has_package("MPIIO")) {
|
||||||
TEST_FAILURE(".*ERROR: Writing to MPI-IO filename when MPIIO package is not inst.*",
|
TEST_FAILURE(".*ERROR: Writing to MPI-IO filename when MPIIO package is not inst.*",
|
||||||
|
|||||||
@ -189,7 +189,7 @@ TEST_F(MoleculeFileTest, notype)
|
|||||||
".*0 fragments.*\n.*1 atoms.*\n.*0 bonds.*"));
|
".*0 fragments.*\n.*1 atoms.*\n.*0 bonds.*"));
|
||||||
TEST_FAILURE(".*ERROR: Create_atoms molecule must have atom types.*",
|
TEST_FAILURE(".*ERROR: Create_atoms molecule must have atom types.*",
|
||||||
command("create_atoms 0 single 0.0 0.0 0.0 mol notype 542465"););
|
command("create_atoms 0 single 0.0 0.0 0.0 mol notype 542465"););
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MoleculeFileTest, extramass)
|
TEST_F(MoleculeFileTest, extramass)
|
||||||
{
|
{
|
||||||
@ -197,12 +197,13 @@ TEST_F(MoleculeFileTest, extramass)
|
|||||||
command("atom_style atomic");
|
command("atom_style atomic");
|
||||||
command("region box block 0 1 0 1 0 1");
|
command("region box block 0 1 0 1 0 1");
|
||||||
command("create_box 1 box");
|
command("create_box 1 box");
|
||||||
run_mol_cmd(test_name, "", "Comment\n1 atoms\n\n Coords\n\n 1 0.0 0.0 0.0\n"
|
run_mol_cmd(test_name, "",
|
||||||
|
"Comment\n1 atoms\n\n Coords\n\n 1 0.0 0.0 0.0\n"
|
||||||
" Types\n\n 1 1\n Masses\n\n 1 1.0\n");
|
" Types\n\n 1 1\n Masses\n\n 1 1.0\n");
|
||||||
command("create_atoms 0 single 0.0 0.0 0.0 mol extramass 73546");
|
command("create_atoms 0 single 0.0 0.0 0.0 mol extramass 73546");
|
||||||
auto output = END_CAPTURE_OUTPUT();
|
auto output = END_CAPTURE_OUTPUT();
|
||||||
ASSERT_THAT(output, ContainsRegex(".*WARNING: Molecule attributes do not match "
|
ASSERT_THAT(output, ContainsRegex(".*WARNING: Molecule attributes do not match "
|
||||||
"system attributes.*"));
|
"system attributes.*"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MoleculeFileTest, twomols)
|
TEST_F(MoleculeFileTest, twomols)
|
||||||
@ -222,12 +223,14 @@ TEST_F(MoleculeFileTest, twofiles)
|
|||||||
BEGIN_CAPTURE_OUTPUT();
|
BEGIN_CAPTURE_OUTPUT();
|
||||||
command("molecule twomols moltest.h2o.mol moltest.co2.mol offset 2 1 1 0 0");
|
command("molecule twomols moltest.h2o.mol moltest.co2.mol offset 2 1 1 0 0");
|
||||||
auto output = END_CAPTURE_OUTPUT();
|
auto output = END_CAPTURE_OUTPUT();
|
||||||
ASSERT_THAT(output, ContainsRegex(".*Read molecule template twomols:.*\n.*1 molecules.*\n"
|
ASSERT_THAT(
|
||||||
".*0 fragments.*\n.*3 atoms with max type 2.*\n.*2 bonds with max type 1.*\n"
|
output,
|
||||||
".*1 angles with max type 1.*\n.*0 dihedrals.*\n.*0 impropers.*\n"
|
ContainsRegex(".*Read molecule template twomols:.*\n.*1 molecules.*\n"
|
||||||
".*Read molecule template twomols:.*\n.*1 molecules.*\n"
|
".*0 fragments.*\n.*3 atoms with max type 2.*\n.*2 bonds with max type 1.*\n"
|
||||||
".*0 fragments.*\n.*3 atoms with max type 4.*\n.*2 bonds with max type 2.*\n"
|
".*1 angles with max type 1.*\n.*0 dihedrals.*\n.*0 impropers.*\n"
|
||||||
".*1 angles with max type 2.*\n.*0 dihedrals.*"));
|
".*Read molecule template twomols:.*\n.*1 molecules.*\n"
|
||||||
|
".*0 fragments.*\n.*3 atoms with max type 4.*\n.*2 bonds with max type 2.*\n"
|
||||||
|
".*1 angles with max type 2.*\n.*0 dihedrals.*"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MoleculeFileTest, bonds)
|
TEST_F(MoleculeFileTest, bonds)
|
||||||
|
|||||||
@ -72,7 +72,7 @@ TEST_F(TextFileReaderTest, permissions)
|
|||||||
{
|
{
|
||||||
platform::unlink("text_reader_noperms.file");
|
platform::unlink("text_reader_noperms.file");
|
||||||
FILE *fp = fopen("text_reader_noperms.file", "w");
|
FILE *fp = fopen("text_reader_noperms.file", "w");
|
||||||
ASSERT_NE(fp,nullptr);
|
ASSERT_NE(fp, nullptr);
|
||||||
fputs("word\n", fp);
|
fputs("word\n", fp);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
chmod("text_reader_noperms.file", 0);
|
chmod("text_reader_noperms.file", 0);
|
||||||
|
|||||||
@ -43,9 +43,9 @@ bool verbose = false;
|
|||||||
using LAMMPS_NS::utils::split_words;
|
using LAMMPS_NS::utils::split_words;
|
||||||
|
|
||||||
namespace LAMMPS_NS {
|
namespace LAMMPS_NS {
|
||||||
|
using ::testing::ContainsRegex;
|
||||||
using ::testing::Eq;
|
using ::testing::Eq;
|
||||||
using ::testing::HasSubstr;
|
using ::testing::HasSubstr;
|
||||||
using ::testing::ContainsRegex;
|
|
||||||
using ::testing::StrEq;
|
using ::testing::StrEq;
|
||||||
|
|
||||||
class PythonPackageTest : public LAMMPSTest {
|
class PythonPackageTest : public LAMMPSTest {
|
||||||
|
|||||||
@ -48,7 +48,7 @@ inline static bool SimilarVec(Vector a, Vector b, int n, Scalar eps = 1.0e-06,
|
|||||||
Scalar ratio = 1.0e-06, Scalar ratio_denom = 1.0)
|
Scalar ratio = 1.0e-06, Scalar ratio_denom = 1.0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < n; i++)
|
for (int i = 0; i < n; i++)
|
||||||
if (! Similar(a[i], b[i], eps, ratio, ratio_denom)) return false;
|
if (!Similar(a[i], b[i], eps, ratio, ratio_denom)) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ inline static bool SimilarVecUnsigned(Vector a, Vector b, int n, Scalar eps = 1.
|
|||||||
return true;
|
return true;
|
||||||
else {
|
else {
|
||||||
for (int i = 0; i < n; i++)
|
for (int i = 0; i < n; i++)
|
||||||
if (! Similar(a[i], -b[i], eps, ratio, ratio_denom)) return false;
|
if (!Similar(a[i], -b[i], eps, ratio, ratio_denom)) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -464,7 +464,7 @@ void TestJacobi(int n, //<! matrix size
|
|||||||
Scalar const(*)[NF]>::SORT_INCREASING_ABS_EVALS);
|
Scalar const(*)[NF]>::SORT_INCREASING_ABS_EVALS);
|
||||||
#else
|
#else
|
||||||
ecalc.Diagonalize(M, evals, evecs,
|
ecalc.Diagonalize(M, evals, evecs,
|
||||||
Jacobi<Scalar, Scalar *, Scalar **,
|
Jacobi<Scalar, Scalar *, Scalar **,
|
||||||
Scalar const *const *>::SORT_INCREASING_ABS_EVALS);
|
Scalar const *const *>::SORT_INCREASING_ABS_EVALS);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -488,7 +488,7 @@ void TestJacobi(int n, //<! matrix size
|
|||||||
Scalar const(*)[NF]>::SORT_DECREASING_ABS_EVALS);
|
Scalar const(*)[NF]>::SORT_DECREASING_ABS_EVALS);
|
||||||
#else
|
#else
|
||||||
ecalc.Diagonalize(M, evals, evecs,
|
ecalc.Diagonalize(M, evals, evecs,
|
||||||
Jacobi<Scalar, Scalar *, Scalar **,
|
Jacobi<Scalar, Scalar *, Scalar **,
|
||||||
Scalar const *const *>::SORT_DECREASING_ABS_EVALS);
|
Scalar const *const *>::SORT_DECREASING_ABS_EVALS);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -511,7 +511,7 @@ void TestJacobi(int n, //<! matrix size
|
|||||||
Scalar const(*)[NF]>::SORT_INCREASING_EVALS);
|
Scalar const(*)[NF]>::SORT_INCREASING_EVALS);
|
||||||
#else
|
#else
|
||||||
ecalc.Diagonalize(M, evals, evecs,
|
ecalc.Diagonalize(M, evals, evecs,
|
||||||
Jacobi<Scalar, Scalar *, Scalar **,
|
Jacobi<Scalar, Scalar *, Scalar **,
|
||||||
Scalar const *const *>::SORT_INCREASING_EVALS);
|
Scalar const *const *>::SORT_INCREASING_EVALS);
|
||||||
#endif
|
#endif
|
||||||
for (int i = 1; i < n; i++)
|
for (int i = 1; i < n; i++)
|
||||||
@ -533,8 +533,8 @@ void TestJacobi(int n, //<! matrix size
|
|||||||
Jacobi<Scalar, Scalar *, Scalar(*)[NF], Scalar const(*)[NF]>::DO_NOT_SORT);
|
Jacobi<Scalar, Scalar *, Scalar(*)[NF], Scalar const(*)[NF]>::DO_NOT_SORT);
|
||||||
#else
|
#else
|
||||||
ecalc.Diagonalize(
|
ecalc.Diagonalize(
|
||||||
M, evals, evecs,
|
M, evals, evecs,
|
||||||
Jacobi<Scalar, Scalar *, Scalar **, Scalar const *const *>::DO_NOT_SORT);
|
Jacobi<Scalar, Scalar *, Scalar **, Scalar const *const *>::DO_NOT_SORT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} // if (test_code_coverage)
|
} // if (test_code_coverage)
|
||||||
|
|||||||
@ -68,10 +68,10 @@ TEST(Platform, putenv_unsetenv)
|
|||||||
|
|
||||||
ASSERT_EQ(platform::unsetenv(""), -1);
|
ASSERT_EQ(platform::unsetenv(""), -1);
|
||||||
ASSERT_EQ(platform::unsetenv("UNITTEST_VAR3=two"), -1);
|
ASSERT_EQ(platform::unsetenv("UNITTEST_VAR3=two"), -1);
|
||||||
var = getenv("UNITTEST_VAR1");
|
var = getenv("UNITTEST_VAR1");
|
||||||
ASSERT_NE(var, nullptr);
|
ASSERT_NE(var, nullptr);
|
||||||
ASSERT_EQ(platform::unsetenv("UNITTEST_VAR1"), 0);
|
ASSERT_EQ(platform::unsetenv("UNITTEST_VAR1"), 0);
|
||||||
var = getenv("UNITTEST_VAR1");
|
var = getenv("UNITTEST_VAR1");
|
||||||
ASSERT_EQ(var, nullptr);
|
ASSERT_EQ(var, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -838,15 +838,15 @@ TEST(Utils, date2num)
|
|||||||
|
|
||||||
TEST(Utils, current_date)
|
TEST(Utils, current_date)
|
||||||
{
|
{
|
||||||
auto vals = ValueTokenizer(utils::current_date(),"-");
|
auto vals = ValueTokenizer(utils::current_date(), "-");
|
||||||
int year = vals.next_int();
|
int year = vals.next_int();
|
||||||
int month = vals.next_int();
|
int month = vals.next_int();
|
||||||
int day = vals.next_int();
|
int day = vals.next_int();
|
||||||
ASSERT_GT(year,2020);
|
ASSERT_GT(year, 2020);
|
||||||
ASSERT_GE(month,1);
|
ASSERT_GE(month, 1);
|
||||||
ASSERT_GE(day,1);
|
ASSERT_GE(day, 1);
|
||||||
ASSERT_LE(month,12);
|
ASSERT_LE(month, 12);
|
||||||
ASSERT_LE(day,31);
|
ASSERT_LE(day, 31);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Utils, binary_search)
|
TEST(Utils, binary_search)
|
||||||
|
|||||||
Reference in New Issue
Block a user