Merge branch 'master' into fmt_upgrade
This commit is contained in:
@ -20,9 +20,9 @@
|
||||
#include "input.h"
|
||||
#include "region.h"
|
||||
|
||||
#include "../testing/core.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "../testing/core.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
@ -74,7 +74,7 @@ protected:
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
atomic_system();
|
||||
|
||||
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("variable molid atom floor(id/4)+1");
|
||||
command("variable charge atom 2.0*sin(PI/32*id)");
|
||||
@ -245,7 +245,7 @@ TEST_F(GroupTest, Molecular)
|
||||
ASSERT_EQ(group->count(group->find("three")), 15);
|
||||
ASSERT_DOUBLE_EQ(group->mass(group->find("half")), 40);
|
||||
ASSERT_DOUBLE_EQ(group->mass(group->find("half"), domain->find_region("top")), 10);
|
||||
ASSERT_DOUBLE_EQ(group->charge(group->find("top")), 0);
|
||||
ASSERT_NEAR(group->charge(group->find("top")), 0, 1.0e-14);
|
||||
ASSERT_DOUBLE_EQ(group->charge(group->find("right"), domain->find_region("top")), 0);
|
||||
|
||||
TEST_FAILURE(".*ERROR: Illegal group command.*", command("group three include xxx"););
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "../testing/core.h"
|
||||
#include "fmt/format.h"
|
||||
#include "info.h"
|
||||
#include "input.h"
|
||||
@ -22,7 +23,6 @@
|
||||
#include "variable.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "../testing/core.h"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <mpi.h>
|
||||
@ -36,7 +36,6 @@ namespace LAMMPS_NS {
|
||||
using ::testing::MatchesRegex;
|
||||
using ::testing::StrEq;
|
||||
|
||||
|
||||
class KimCommandsTest : public LAMMPSTest {
|
||||
protected:
|
||||
Variable *variable;
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "../testing/core.h"
|
||||
#include "atom.h"
|
||||
#include "domain.h"
|
||||
#include "fmt/format.h"
|
||||
@ -22,7 +23,6 @@
|
||||
#include "utils.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "../testing/core.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
@ -40,7 +40,6 @@ using ::testing::ExitedWithCode;
|
||||
using ::testing::MatchesRegex;
|
||||
using ::testing::StrEq;
|
||||
|
||||
|
||||
class LatticeRegionTest : public LAMMPSTest {
|
||||
protected:
|
||||
void SetUp() override
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
// unit tests for checking LAMMPS MPI load balancing
|
||||
|
||||
#define LAMMPS_LIB_MPI 1
|
||||
#include "lammps.h"
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
#include "domain.h"
|
||||
#include "neighbor.h"
|
||||
#include "input.h"
|
||||
#include "timer.h"
|
||||
#include "info.h"
|
||||
#include "input.h"
|
||||
#include "lammps.h"
|
||||
#include "neighbor.h"
|
||||
#include "timer.h"
|
||||
#include <string>
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
@ -21,8 +21,7 @@ using ::testing::HasSubstr;
|
||||
using ::testing::StartsWith;
|
||||
using ::testing::StrEq;
|
||||
|
||||
namespace LAMMPS_NS
|
||||
{
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class MPILoadBalanceTest : public ::testing::Test {
|
||||
public:
|
||||
@ -54,7 +53,6 @@ protected:
|
||||
command("create_box 1 box");
|
||||
command("mass 1 1.0");
|
||||
|
||||
|
||||
command("pair_style lj/cut 2.5");
|
||||
command("pair_coeff 1 1 1.0 1.0 2.5");
|
||||
|
||||
@ -85,55 +83,55 @@ TEST_F(MPILoadBalanceTest, grid_yz)
|
||||
ASSERT_EQ(lmp->comm->nprocs, 4);
|
||||
|
||||
// initial state
|
||||
switch(lmp->comm->me) {
|
||||
case 0:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 8);
|
||||
break;
|
||||
case 1:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||
break;
|
||||
case 2:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||
break;
|
||||
case 3:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||
break;
|
||||
switch (lmp->comm->me) {
|
||||
case 0:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 8);
|
||||
break;
|
||||
case 1:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||
break;
|
||||
case 2:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||
break;
|
||||
case 3:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
command("balance 1 x uniform y 0.125 z uniform");
|
||||
|
||||
// state after balance command
|
||||
switch(lmp->comm->me) {
|
||||
case 0:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 4);
|
||||
break;
|
||||
case 1:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||
break;
|
||||
case 2:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 4);
|
||||
break;
|
||||
case 3:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||
break;
|
||||
switch (lmp->comm->me) {
|
||||
case 0:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 4);
|
||||
break;
|
||||
case 1:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||
break;
|
||||
case 2:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 4);
|
||||
break;
|
||||
case 3:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
command("balance 1 x uniform y 0.125 z 0.125");
|
||||
|
||||
// state after second balance command
|
||||
switch(lmp->comm->me) {
|
||||
case 0:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 2);
|
||||
break;
|
||||
case 1:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 2);
|
||||
break;
|
||||
case 2:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 2);
|
||||
break;
|
||||
case 3:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 2);
|
||||
break;
|
||||
switch (lmp->comm->me) {
|
||||
case 0:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 2);
|
||||
break;
|
||||
case 1:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 2);
|
||||
break;
|
||||
case 2:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 2);
|
||||
break;
|
||||
case 3:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -150,37 +148,37 @@ TEST_F(MPILoadBalanceTest, rcb)
|
||||
command("create_atoms 1 single 5 5 5");
|
||||
|
||||
// initial state
|
||||
switch(lmp->comm->me) {
|
||||
case 0:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 8);
|
||||
break;
|
||||
case 1:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||
break;
|
||||
case 2:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||
break;
|
||||
case 3:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||
break;
|
||||
switch (lmp->comm->me) {
|
||||
case 0:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 8);
|
||||
break;
|
||||
case 1:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||
break;
|
||||
case 2:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||
break;
|
||||
case 3:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
command("balance 1 rcb");
|
||||
|
||||
// state after balance command
|
||||
switch(lmp->comm->me) {
|
||||
case 0:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 2);
|
||||
break;
|
||||
case 1:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 2);
|
||||
break;
|
||||
case 2:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 2);
|
||||
break;
|
||||
case 3:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 2);
|
||||
break;
|
||||
switch (lmp->comm->me) {
|
||||
case 0:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 2);
|
||||
break;
|
||||
case 1:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 2);
|
||||
break;
|
||||
case 2:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 2);
|
||||
break;
|
||||
case 3:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 2);
|
||||
break;
|
||||
}
|
||||
|
||||
// box dimensions should have minimal size
|
||||
@ -209,19 +207,19 @@ TEST_F(MPILoadBalanceTest, rcb_min_size)
|
||||
command("create_atoms 1 single 0.25 0.25 0.25");
|
||||
|
||||
// initial state
|
||||
switch(lmp->comm->me) {
|
||||
case 0:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 8);
|
||||
break;
|
||||
case 1:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||
break;
|
||||
case 2:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||
break;
|
||||
case 3:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||
break;
|
||||
switch (lmp->comm->me) {
|
||||
case 0:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 8);
|
||||
break;
|
||||
case 1:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||
break;
|
||||
case 2:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||
break;
|
||||
case 3:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
// this should fail and not change the boxes
|
||||
@ -229,19 +227,19 @@ TEST_F(MPILoadBalanceTest, rcb_min_size)
|
||||
command("balance 1 rcb");
|
||||
|
||||
// state after balance command
|
||||
switch(lmp->comm->me) {
|
||||
case 0:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 8);
|
||||
break;
|
||||
case 1:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||
break;
|
||||
case 2:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||
break;
|
||||
case 3:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||
break;
|
||||
switch (lmp->comm->me) {
|
||||
case 0:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 8);
|
||||
break;
|
||||
case 1:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||
break;
|
||||
case 2:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||
break;
|
||||
case 3:
|
||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
// box dimensions should have minimal size
|
||||
@ -254,4 +252,4 @@ TEST_F(MPILoadBalanceTest, rcb_min_size)
|
||||
ASSERT_GT(dz, lmp->neighbor->skin);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "../testing/core.h"
|
||||
#include "atom.h"
|
||||
#include "fmt/format.h"
|
||||
#include "info.h"
|
||||
@ -21,7 +22,6 @@
|
||||
#include "utils.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "../testing/core.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <mpi.h>
|
||||
@ -36,7 +36,6 @@ using ::testing::MatchesRegex;
|
||||
|
||||
#define GETIDX(i) lmp->atom->map(i)
|
||||
|
||||
|
||||
#define STRINGIFY(val) XSTR(val)
|
||||
#define XSTR(val) #val
|
||||
|
||||
@ -638,10 +637,10 @@ TEST_F(ResetIDsTest, DeathTests)
|
||||
TEST_FAILURE(".*ERROR: Illegal reset_mol_ids command.*",
|
||||
command("reset_mol_ids all compress"););
|
||||
|
||||
TEST_FAILURE(".*ERROR: Illegal reset_mol_ids command.*",
|
||||
TEST_FAILURE(".*ERROR: Expected boolean parameter instead of 'xxx'.*",
|
||||
command("reset_mol_ids all compress xxx"););
|
||||
TEST_FAILURE(".*ERROR: Illegal reset_mol_ids command.*", command("reset_mol_ids all single"););
|
||||
TEST_FAILURE(".*ERROR: Illegal reset_mol_ids command.*",
|
||||
TEST_FAILURE(".*ERROR: Expected boolean parameter instead of 'xxx'.*",
|
||||
command("reset_mol_ids all single xxx"););
|
||||
}
|
||||
|
||||
|
||||
@ -23,10 +23,10 @@
|
||||
#include "utils.h"
|
||||
#include "variable.h"
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "../testing/core.h"
|
||||
#include "../testing/utils.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
@ -37,7 +37,6 @@
|
||||
// whether to print verbose output (i.e. not capturing LAMMPS screen output).
|
||||
bool verbose = false;
|
||||
|
||||
|
||||
using LAMMPS_NS::utils::split_words;
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
@ -161,7 +160,8 @@ TEST_F(SimpleCommandsTest, Partition)
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("echo none");
|
||||
END_HIDE_OUTPUT();
|
||||
TEST_FAILURE(".*ERROR: Illegal partition command .*", command("partition xxx 1 echo none"););
|
||||
TEST_FAILURE(".*ERROR: Expected boolean parameter instead of 'xxx'.*",
|
||||
command("partition xxx 1 echo none"););
|
||||
TEST_FAILURE(".*ERROR: Numeric index 2 is out of bounds.*",
|
||||
command("partition yes 2 echo none"););
|
||||
|
||||
@ -205,7 +205,8 @@ TEST_F(SimpleCommandsTest, Processors)
|
||||
ASSERT_EQ(lmp->comm->user_procgrid[2], 0);
|
||||
|
||||
TEST_FAILURE(".*ERROR: Illegal processors command .*", command("processors -1 0 0"););
|
||||
TEST_FAILURE(".*ERROR: Specified processors != physical processors.*", command("processors 100 100 100"););
|
||||
TEST_FAILURE(".*ERROR: Specified processors != physical processors.*",
|
||||
command("processors 100 100 100"););
|
||||
}
|
||||
|
||||
TEST_F(SimpleCommandsTest, Quit)
|
||||
@ -248,6 +249,8 @@ TEST_F(SimpleCommandsTest, Suffix)
|
||||
ASSERT_EQ(lmp->suffix2, nullptr);
|
||||
|
||||
TEST_FAILURE(".*ERROR: May only enable suffixes after defining one.*", command("suffix on"););
|
||||
TEST_FAILURE(".*ERROR: May only enable suffixes after defining one.*", command("suffix yes"););
|
||||
TEST_FAILURE(".*ERROR: May only enable suffixes after defining one.*", command("suffix true"););
|
||||
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("suffix one");
|
||||
@ -271,6 +274,26 @@ TEST_F(SimpleCommandsTest, Suffix)
|
||||
END_HIDE_OUTPUT();
|
||||
ASSERT_EQ(lmp->suffix_enable, 0);
|
||||
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("suffix yes");
|
||||
END_HIDE_OUTPUT();
|
||||
ASSERT_EQ(lmp->suffix_enable, 1);
|
||||
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("suffix no");
|
||||
END_HIDE_OUTPUT();
|
||||
ASSERT_EQ(lmp->suffix_enable, 0);
|
||||
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("suffix true");
|
||||
END_HIDE_OUTPUT();
|
||||
ASSERT_EQ(lmp->suffix_enable, 1);
|
||||
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("suffix false");
|
||||
END_HIDE_OUTPUT();
|
||||
ASSERT_EQ(lmp->suffix_enable, 0);
|
||||
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("suffix on");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
@ -22,9 +22,9 @@
|
||||
#include "region.h"
|
||||
#include "variable.h"
|
||||
|
||||
#include "../testing/core.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "../testing/core.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
@ -40,7 +40,6 @@ using ::testing::ExitedWithCode;
|
||||
using ::testing::MatchesRegex;
|
||||
using ::testing::StrEq;
|
||||
|
||||
|
||||
class VariableTest : public LAMMPSTest {
|
||||
protected:
|
||||
Group *group;
|
||||
@ -50,7 +49,7 @@ protected:
|
||||
void SetUp() override
|
||||
{
|
||||
testbinary = "VariableTest";
|
||||
args = {"-log", "none", "-echo", "screen", "-nocite", "-v", "num", "1"};
|
||||
args = {"-log", "none", "-echo", "screen", "-nocite", "-v", "num", "1"};
|
||||
LAMMPSTest::SetUp();
|
||||
group = lmp->group;
|
||||
domain = lmp->domain;
|
||||
@ -162,8 +161,8 @@ TEST_F(VariableTest, CreateDelete)
|
||||
variable->internal_set(variable->find("ten"), 2.5);
|
||||
ASSERT_THAT(variable->retrieve("ten"), StrEq("2.5"));
|
||||
ASSERT_THAT(variable->retrieve("file"), StrEq("0"));
|
||||
FILE *fp = fopen("MYFILE","w");
|
||||
fputs(" ",fp);
|
||||
FILE *fp = fopen("MYFILE", "w");
|
||||
fputs(" ", fp);
|
||||
fclose(fp);
|
||||
ASSERT_THAT(variable->retrieve("file"), StrEq("1"));
|
||||
unlink("MYFILE");
|
||||
@ -218,7 +217,9 @@ TEST_F(VariableTest, CreateDelete)
|
||||
|
||||
TEST_F(VariableTest, AtomicSystem)
|
||||
{
|
||||
HIDE_OUTPUT([&] { command("atom_modify map array"); });
|
||||
HIDE_OUTPUT([&] {
|
||||
command("atom_modify map array");
|
||||
});
|
||||
atomic_system();
|
||||
file_vars();
|
||||
|
||||
@ -443,7 +444,7 @@ TEST_F(VariableTest, IfCommand)
|
||||
BEGIN_CAPTURE_OUTPUT();
|
||||
command("if x!=x|^a!=b then 'print \"bingo!\"'");
|
||||
text = END_CAPTURE_OUTPUT();
|
||||
|
||||
|
||||
ASSERT_THAT(text, MatchesRegex(".*bingo!.*"));
|
||||
|
||||
TEST_FAILURE(".*ERROR: Invalid Boolean syntax in if command.*",
|
||||
|
||||
Reference in New Issue
Block a user