apply clang-format
This commit is contained in:
@ -55,13 +55,13 @@ TEST_F(LibraryCommands, from_file)
|
||||
const char cont_file[] = "in.cont";
|
||||
|
||||
fp = fopen(demo_file, "w");
|
||||
for (auto & inp : demo_input) {
|
||||
for (auto &inp : demo_input) {
|
||||
fputs(inp, fp);
|
||||
fputc('\n', fp);
|
||||
}
|
||||
fclose(fp);
|
||||
fp = fopen(cont_file, "w");
|
||||
for (auto & inp : cont_input) {
|
||||
for (auto &inp : cont_input) {
|
||||
fputs(inp, fp);
|
||||
fputc('\n', fp);
|
||||
}
|
||||
@ -85,7 +85,7 @@ TEST_F(LibraryCommands, from_line)
|
||||
{
|
||||
EXPECT_EQ(lammps_get_natoms(lmp), 0);
|
||||
if (!verbose) ::testing::internal::CaptureStdout();
|
||||
for (auto & inp : demo_input) {
|
||||
for (auto &inp : demo_input) {
|
||||
lammps_command(lmp, inp);
|
||||
}
|
||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||
@ -106,11 +106,11 @@ TEST_F(LibraryCommands, from_string)
|
||||
{
|
||||
std::string cmds("");
|
||||
|
||||
for (auto & inp : demo_input) {
|
||||
for (auto &inp : demo_input) {
|
||||
cmds += inp;
|
||||
cmds += "\n";
|
||||
}
|
||||
for (auto & inp : cont_input) {
|
||||
for (auto &inp : cont_input) {
|
||||
cmds += inp;
|
||||
cmds += "\n";
|
||||
}
|
||||
@ -126,11 +126,11 @@ TEST_F(LibraryCommands, from_string)
|
||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||
|
||||
cmds.clear();
|
||||
for (auto & inp : demo_input) {
|
||||
for (auto &inp : demo_input) {
|
||||
cmds += inp;
|
||||
cmds += "\r\n";
|
||||
}
|
||||
for (auto & inp : cont_input) {
|
||||
for (auto &inp : cont_input) {
|
||||
cmds += inp;
|
||||
cmds += "\r\n";
|
||||
}
|
||||
|
||||
@ -436,8 +436,10 @@ class AtomProperties : public ::testing::Test {
|
||||
protected:
|
||||
void *lmp;
|
||||
|
||||
AtomProperties()= default;;
|
||||
~AtomProperties() override= default;;
|
||||
AtomProperties() = default;
|
||||
;
|
||||
~AtomProperties() override = default;
|
||||
;
|
||||
|
||||
void SetUp() override
|
||||
{
|
||||
|
||||
@ -35,8 +35,8 @@ bool verbose = false;
|
||||
using LAMMPS_NS::utils::split_words;
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
using ::testing::ExitedWithCode;
|
||||
using ::testing::ContainsRegex;
|
||||
using ::testing::ExitedWithCode;
|
||||
using ::testing::StrEq;
|
||||
|
||||
class LatticeRegionTest : public LAMMPSTest {
|
||||
|
||||
@ -39,8 +39,8 @@ bool verbose = false;
|
||||
using LAMMPS_NS::utils::split_words;
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
using ::testing::ExitedWithCode;
|
||||
using ::testing::ContainsRegex;
|
||||
using ::testing::ExitedWithCode;
|
||||
using ::testing::StrEq;
|
||||
|
||||
class SimpleCommandsTest : public LAMMPSTest {
|
||||
@ -479,7 +479,8 @@ TEST_F(SimpleCommandsTest, Shell)
|
||||
test_var = getenv("TEST_VARIABLE");
|
||||
ASSERT_NE(test_var, nullptr);
|
||||
#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"));
|
||||
#else
|
||||
ASSERT_THAT(test_var, StrEq(""));
|
||||
@ -501,7 +502,8 @@ TEST_F(SimpleCommandsTest, CiteMe)
|
||||
|
||||
// find the two unique citations, but not the third
|
||||
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();
|
||||
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;
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
using ::testing::ExitedWithCode;
|
||||
using ::testing::ContainsRegex;
|
||||
using ::testing::ExitedWithCode;
|
||||
using ::testing::StrEq;
|
||||
|
||||
class VariableTest : public LAMMPSTest {
|
||||
@ -317,7 +317,7 @@ TEST_F(VariableTest, Expressions)
|
||||
ASSERT_TRUE(variable->equalstyle(ivar));
|
||||
ASSERT_DOUBLE_EQ(variable->compute_equal(ivar), 2.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_DOUBLE_EQ(variable->compute_equal("v_seven"), -1);
|
||||
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";
|
||||
|
||||
fp = fopen(demo_file, "w");
|
||||
for (auto & inp : demo_input) {
|
||||
for (auto &inp : demo_input) {
|
||||
fputs(inp, fp);
|
||||
fputc('\n', fp);
|
||||
}
|
||||
fclose(fp);
|
||||
fp = fopen(cont_file, "w");
|
||||
for (auto & inp : cont_input) {
|
||||
for (auto &inp : cont_input) {
|
||||
fputs(inp, fp);
|
||||
fputc('\n', fp);
|
||||
}
|
||||
@ -84,7 +84,7 @@ TEST_F(Input_commands, from_file)
|
||||
TEST_F(Input_commands, from_line)
|
||||
{
|
||||
EXPECT_EQ(lmp->atom->natoms, 0);
|
||||
for (auto & inp : demo_input) {
|
||||
for (auto &inp : demo_input) {
|
||||
lmp->input->one(inp);
|
||||
}
|
||||
EXPECT_EQ(lmp->atom->natoms, 1);
|
||||
|
||||
@ -372,8 +372,8 @@ TEST(LAMMPS_init, NoOpenMP)
|
||||
::testing::internal::CaptureStdout();
|
||||
LAMMPS *lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD);
|
||||
std::string output = ::testing::internal::GetCapturedStdout();
|
||||
EXPECT_THAT(output,
|
||||
ContainsRegex(".*OMP_NUM_THREADS environment is not set.*Defaulting to 1 thread.*"));
|
||||
EXPECT_THAT(output, ContainsRegex(
|
||||
".*OMP_NUM_THREADS environment is not set.*Defaulting to 1 thread.*"));
|
||||
EXPECT_EQ(lmp->comm->nthreads, 1);
|
||||
::testing::internal::CaptureStdout();
|
||||
delete lmp;
|
||||
|
||||
@ -374,7 +374,7 @@ void TestConfigReader::tags(const yaml_event_t &event)
|
||||
{
|
||||
std::stringstream data((char *)event.data.scalar.value);
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
@ -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));
|
||||
});
|
||||
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([&] {
|
||||
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);
|
||||
ASSERT_NEAR(pe_2, pe_rerun,1.0e-14);
|
||||
ASSERT_NEAR(pe_2, pe_rerun, 1.0e-14);
|
||||
delete_file(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));
|
||||
});
|
||||
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([&] {
|
||||
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);
|
||||
ASSERT_NEAR(pe_2, pe_rerun,1.0e-14);
|
||||
ASSERT_NEAR(pe_2, pe_rerun, 1.0e-14);
|
||||
delete_file(dump_file);
|
||||
}
|
||||
|
||||
|
||||
@ -334,7 +334,9 @@ TEST_F(FileOperationsTest, write_restart)
|
||||
ASSERT_FILE_EXISTS("multi2-0.restart");
|
||||
ASSERT_FILE_EXISTS("multi3-base.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")) {
|
||||
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.*"));
|
||||
TEST_FAILURE(".*ERROR: Create_atoms molecule must have atom types.*",
|
||||
command("create_atoms 0 single 0.0 0.0 0.0 mol notype 542465"););
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(MoleculeFileTest, extramass)
|
||||
{
|
||||
@ -197,7 +197,8 @@ TEST_F(MoleculeFileTest, extramass)
|
||||
command("atom_style atomic");
|
||||
command("region box block 0 1 0 1 0 1");
|
||||
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");
|
||||
command("create_atoms 0 single 0.0 0.0 0.0 mol extramass 73546");
|
||||
auto output = END_CAPTURE_OUTPUT();
|
||||
@ -222,7 +223,9 @@ TEST_F(MoleculeFileTest, twofiles)
|
||||
BEGIN_CAPTURE_OUTPUT();
|
||||
command("molecule twomols moltest.h2o.mol moltest.co2.mol offset 2 1 1 0 0");
|
||||
auto output = END_CAPTURE_OUTPUT();
|
||||
ASSERT_THAT(output, ContainsRegex(".*Read molecule template twomols:.*\n.*1 molecules.*\n"
|
||||
ASSERT_THAT(
|
||||
output,
|
||||
ContainsRegex(".*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"
|
||||
".*1 angles with max type 1.*\n.*0 dihedrals.*\n.*0 impropers.*\n"
|
||||
".*Read molecule template twomols:.*\n.*1 molecules.*\n"
|
||||
|
||||
@ -72,7 +72,7 @@ TEST_F(TextFileReaderTest, permissions)
|
||||
{
|
||||
platform::unlink("text_reader_noperms.file");
|
||||
FILE *fp = fopen("text_reader_noperms.file", "w");
|
||||
ASSERT_NE(fp,nullptr);
|
||||
ASSERT_NE(fp, nullptr);
|
||||
fputs("word\n", fp);
|
||||
fclose(fp);
|
||||
chmod("text_reader_noperms.file", 0);
|
||||
|
||||
@ -43,9 +43,9 @@ bool verbose = false;
|
||||
using LAMMPS_NS::utils::split_words;
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
using ::testing::ContainsRegex;
|
||||
using ::testing::Eq;
|
||||
using ::testing::HasSubstr;
|
||||
using ::testing::ContainsRegex;
|
||||
using ::testing::StrEq;
|
||||
|
||||
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ inline static bool SimilarVecUnsigned(Vector a, Vector b, int n, Scalar eps = 1.
|
||||
return true;
|
||||
else {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -838,15 +838,15 @@ TEST(Utils, date2num)
|
||||
|
||||
TEST(Utils, current_date)
|
||||
{
|
||||
auto vals = ValueTokenizer(utils::current_date(),"-");
|
||||
auto vals = ValueTokenizer(utils::current_date(), "-");
|
||||
int year = vals.next_int();
|
||||
int month = vals.next_int();
|
||||
int day = vals.next_int();
|
||||
ASSERT_GT(year,2020);
|
||||
ASSERT_GE(month,1);
|
||||
ASSERT_GE(day,1);
|
||||
ASSERT_LE(month,12);
|
||||
ASSERT_LE(day,31);
|
||||
ASSERT_GT(year, 2020);
|
||||
ASSERT_GE(month, 1);
|
||||
ASSERT_GE(day, 1);
|
||||
ASSERT_LE(month, 12);
|
||||
ASSERT_LE(day, 31);
|
||||
}
|
||||
|
||||
TEST(Utils, binary_search)
|
||||
|
||||
Reference in New Issue
Block a user