reformat unittest tree with clang-format
This commit is contained in:
@ -20,9 +20,9 @@
|
|||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "region.h"
|
#include "region.h"
|
||||||
|
|
||||||
|
#include "../testing/core.h"
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "../testing/core.h"
|
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -74,7 +74,7 @@ protected:
|
|||||||
END_HIDE_OUTPUT();
|
END_HIDE_OUTPUT();
|
||||||
|
|
||||||
atomic_system();
|
atomic_system();
|
||||||
|
|
||||||
BEGIN_HIDE_OUTPUT();
|
BEGIN_HIDE_OUTPUT();
|
||||||
command("variable molid atom floor(id/4)+1");
|
command("variable molid atom floor(id/4)+1");
|
||||||
command("variable charge atom 2.0*sin(PI/32*id)");
|
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_EQ(group->count(group->find("three")), 15);
|
||||||
ASSERT_DOUBLE_EQ(group->mass(group->find("half")), 40);
|
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->mass(group->find("half"), domain->find_region("top")), 10);
|
||||||
ASSERT_NEAR(group->charge(group->find("top")), 0,1.0e-14);
|
ASSERT_NEAR(group->charge(group->find("top")), 0, 1.0e-14);
|
||||||
ASSERT_DOUBLE_EQ(group->charge(group->find("right"), domain->find_region("top")), 0);
|
ASSERT_DOUBLE_EQ(group->charge(group->find("right"), domain->find_region("top")), 0);
|
||||||
|
|
||||||
TEST_FAILURE(".*ERROR: Illegal group command.*", command("group three include xxx"););
|
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.
|
See the README file in the top-level LAMMPS directory.
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#include "../testing/core.h"
|
||||||
#include "fmt/format.h"
|
#include "fmt/format.h"
|
||||||
#include "info.h"
|
#include "info.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
@ -22,7 +23,6 @@
|
|||||||
#include "variable.h"
|
#include "variable.h"
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "../testing/core.h"
|
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <mpi.h>
|
#include <mpi.h>
|
||||||
@ -36,7 +36,6 @@ namespace LAMMPS_NS {
|
|||||||
using ::testing::MatchesRegex;
|
using ::testing::MatchesRegex;
|
||||||
using ::testing::StrEq;
|
using ::testing::StrEq;
|
||||||
|
|
||||||
|
|
||||||
class KimCommandsTest : public LAMMPSTest {
|
class KimCommandsTest : public LAMMPSTest {
|
||||||
protected:
|
protected:
|
||||||
Variable *variable;
|
Variable *variable;
|
||||||
|
|||||||
@ -11,6 +11,7 @@
|
|||||||
See the README file in the top-level LAMMPS directory.
|
See the README file in the top-level LAMMPS directory.
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#include "../testing/core.h"
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "domain.h"
|
#include "domain.h"
|
||||||
#include "fmt/format.h"
|
#include "fmt/format.h"
|
||||||
@ -22,7 +23,6 @@
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "../testing/core.h"
|
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@ -40,7 +40,6 @@ using ::testing::ExitedWithCode;
|
|||||||
using ::testing::MatchesRegex;
|
using ::testing::MatchesRegex;
|
||||||
using ::testing::StrEq;
|
using ::testing::StrEq;
|
||||||
|
|
||||||
|
|
||||||
class LatticeRegionTest : public LAMMPSTest {
|
class LatticeRegionTest : public LAMMPSTest {
|
||||||
protected:
|
protected:
|
||||||
void SetUp() override
|
void SetUp() override
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
// unit tests for checking LAMMPS MPI load balancing
|
// unit tests for checking LAMMPS MPI load balancing
|
||||||
|
|
||||||
#define LAMMPS_LIB_MPI 1
|
#define LAMMPS_LIB_MPI 1
|
||||||
#include "lammps.h"
|
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "comm.h"
|
#include "comm.h"
|
||||||
#include "domain.h"
|
#include "domain.h"
|
||||||
#include "neighbor.h"
|
|
||||||
#include "input.h"
|
|
||||||
#include "timer.h"
|
|
||||||
#include "info.h"
|
#include "info.h"
|
||||||
|
#include "input.h"
|
||||||
|
#include "lammps.h"
|
||||||
|
#include "neighbor.h"
|
||||||
|
#include "timer.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
@ -21,8 +21,7 @@ using ::testing::HasSubstr;
|
|||||||
using ::testing::StartsWith;
|
using ::testing::StartsWith;
|
||||||
using ::testing::StrEq;
|
using ::testing::StrEq;
|
||||||
|
|
||||||
namespace LAMMPS_NS
|
namespace LAMMPS_NS {
|
||||||
{
|
|
||||||
|
|
||||||
class MPILoadBalanceTest : public ::testing::Test {
|
class MPILoadBalanceTest : public ::testing::Test {
|
||||||
public:
|
public:
|
||||||
@ -54,7 +53,6 @@ protected:
|
|||||||
command("create_box 1 box");
|
command("create_box 1 box");
|
||||||
command("mass 1 1.0");
|
command("mass 1 1.0");
|
||||||
|
|
||||||
|
|
||||||
command("pair_style lj/cut 2.5");
|
command("pair_style lj/cut 2.5");
|
||||||
command("pair_coeff 1 1 1.0 1.0 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);
|
ASSERT_EQ(lmp->comm->nprocs, 4);
|
||||||
|
|
||||||
// initial state
|
// initial state
|
||||||
switch(lmp->comm->me) {
|
switch (lmp->comm->me) {
|
||||||
case 0:
|
case 0:
|
||||||
ASSERT_EQ(lmp->atom->nlocal, 8);
|
ASSERT_EQ(lmp->atom->nlocal, 8);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
command("balance 1 x uniform y 0.125 z uniform");
|
command("balance 1 x uniform y 0.125 z uniform");
|
||||||
|
|
||||||
// state after balance command
|
// state after balance command
|
||||||
switch(lmp->comm->me) {
|
switch (lmp->comm->me) {
|
||||||
case 0:
|
case 0:
|
||||||
ASSERT_EQ(lmp->atom->nlocal, 4);
|
ASSERT_EQ(lmp->atom->nlocal, 4);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
ASSERT_EQ(lmp->atom->nlocal, 4);
|
ASSERT_EQ(lmp->atom->nlocal, 4);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
command("balance 1 x uniform y 0.125 z 0.125");
|
command("balance 1 x uniform y 0.125 z 0.125");
|
||||||
|
|
||||||
// state after second balance command
|
// state after second balance command
|
||||||
switch(lmp->comm->me) {
|
switch (lmp->comm->me) {
|
||||||
case 0:
|
case 0:
|
||||||
ASSERT_EQ(lmp->atom->nlocal, 2);
|
ASSERT_EQ(lmp->atom->nlocal, 2);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
ASSERT_EQ(lmp->atom->nlocal, 2);
|
ASSERT_EQ(lmp->atom->nlocal, 2);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
ASSERT_EQ(lmp->atom->nlocal, 2);
|
ASSERT_EQ(lmp->atom->nlocal, 2);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
ASSERT_EQ(lmp->atom->nlocal, 2);
|
ASSERT_EQ(lmp->atom->nlocal, 2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,37 +148,37 @@ TEST_F(MPILoadBalanceTest, rcb)
|
|||||||
command("create_atoms 1 single 5 5 5");
|
command("create_atoms 1 single 5 5 5");
|
||||||
|
|
||||||
// initial state
|
// initial state
|
||||||
switch(lmp->comm->me) {
|
switch (lmp->comm->me) {
|
||||||
case 0:
|
case 0:
|
||||||
ASSERT_EQ(lmp->atom->nlocal, 8);
|
ASSERT_EQ(lmp->atom->nlocal, 8);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
command("balance 1 rcb");
|
command("balance 1 rcb");
|
||||||
|
|
||||||
// state after balance command
|
// state after balance command
|
||||||
switch(lmp->comm->me) {
|
switch (lmp->comm->me) {
|
||||||
case 0:
|
case 0:
|
||||||
ASSERT_EQ(lmp->atom->nlocal, 2);
|
ASSERT_EQ(lmp->atom->nlocal, 2);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
ASSERT_EQ(lmp->atom->nlocal, 2);
|
ASSERT_EQ(lmp->atom->nlocal, 2);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
ASSERT_EQ(lmp->atom->nlocal, 2);
|
ASSERT_EQ(lmp->atom->nlocal, 2);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
ASSERT_EQ(lmp->atom->nlocal, 2);
|
ASSERT_EQ(lmp->atom->nlocal, 2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// box dimensions should have minimal size
|
// 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");
|
command("create_atoms 1 single 0.25 0.25 0.25");
|
||||||
|
|
||||||
// initial state
|
// initial state
|
||||||
switch(lmp->comm->me) {
|
switch (lmp->comm->me) {
|
||||||
case 0:
|
case 0:
|
||||||
ASSERT_EQ(lmp->atom->nlocal, 8);
|
ASSERT_EQ(lmp->atom->nlocal, 8);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// this should fail and not change the boxes
|
// this should fail and not change the boxes
|
||||||
@ -229,19 +227,19 @@ TEST_F(MPILoadBalanceTest, rcb_min_size)
|
|||||||
command("balance 1 rcb");
|
command("balance 1 rcb");
|
||||||
|
|
||||||
// state after balance command
|
// state after balance command
|
||||||
switch(lmp->comm->me) {
|
switch (lmp->comm->me) {
|
||||||
case 0:
|
case 0:
|
||||||
ASSERT_EQ(lmp->atom->nlocal, 8);
|
ASSERT_EQ(lmp->atom->nlocal, 8);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
ASSERT_EQ(lmp->atom->nlocal, 0);
|
ASSERT_EQ(lmp->atom->nlocal, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// box dimensions should have minimal size
|
// box dimensions should have minimal size
|
||||||
@ -254,4 +252,4 @@ TEST_F(MPILoadBalanceTest, rcb_min_size)
|
|||||||
ASSERT_GT(dz, lmp->neighbor->skin);
|
ASSERT_GT(dz, lmp->neighbor->skin);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // namespace LAMMPS_NS
|
||||||
|
|||||||
@ -11,6 +11,7 @@
|
|||||||
See the README file in the top-level LAMMPS directory.
|
See the README file in the top-level LAMMPS directory.
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#include "../testing/core.h"
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "fmt/format.h"
|
#include "fmt/format.h"
|
||||||
#include "info.h"
|
#include "info.h"
|
||||||
@ -21,7 +22,6 @@
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "../testing/core.h"
|
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <mpi.h>
|
#include <mpi.h>
|
||||||
@ -36,7 +36,6 @@ using ::testing::MatchesRegex;
|
|||||||
|
|
||||||
#define GETIDX(i) lmp->atom->map(i)
|
#define GETIDX(i) lmp->atom->map(i)
|
||||||
|
|
||||||
|
|
||||||
#define STRINGIFY(val) XSTR(val)
|
#define STRINGIFY(val) XSTR(val)
|
||||||
#define XSTR(val) #val
|
#define XSTR(val) #val
|
||||||
|
|
||||||
|
|||||||
@ -23,10 +23,10 @@
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "variable.h"
|
#include "variable.h"
|
||||||
|
|
||||||
#include "gmock/gmock.h"
|
|
||||||
#include "gtest/gtest.h"
|
|
||||||
#include "../testing/core.h"
|
#include "../testing/core.h"
|
||||||
#include "../testing/utils.h"
|
#include "../testing/utils.h"
|
||||||
|
#include "gmock/gmock.h"
|
||||||
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@ -37,7 +37,6 @@
|
|||||||
// whether to print verbose output (i.e. not capturing LAMMPS screen output).
|
// whether to print verbose output (i.e. not capturing LAMMPS screen output).
|
||||||
bool verbose = false;
|
bool verbose = false;
|
||||||
|
|
||||||
|
|
||||||
using LAMMPS_NS::utils::split_words;
|
using LAMMPS_NS::utils::split_words;
|
||||||
|
|
||||||
namespace LAMMPS_NS {
|
namespace LAMMPS_NS {
|
||||||
@ -205,7 +204,8 @@ TEST_F(SimpleCommandsTest, Processors)
|
|||||||
ASSERT_EQ(lmp->comm->user_procgrid[2], 0);
|
ASSERT_EQ(lmp->comm->user_procgrid[2], 0);
|
||||||
|
|
||||||
TEST_FAILURE(".*ERROR: Illegal processors command .*", command("processors -1 0 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)
|
TEST_F(SimpleCommandsTest, Quit)
|
||||||
|
|||||||
@ -22,9 +22,9 @@
|
|||||||
#include "region.h"
|
#include "region.h"
|
||||||
#include "variable.h"
|
#include "variable.h"
|
||||||
|
|
||||||
|
#include "../testing/core.h"
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "../testing/core.h"
|
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -40,7 +40,6 @@ using ::testing::ExitedWithCode;
|
|||||||
using ::testing::MatchesRegex;
|
using ::testing::MatchesRegex;
|
||||||
using ::testing::StrEq;
|
using ::testing::StrEq;
|
||||||
|
|
||||||
|
|
||||||
class VariableTest : public LAMMPSTest {
|
class VariableTest : public LAMMPSTest {
|
||||||
protected:
|
protected:
|
||||||
Group *group;
|
Group *group;
|
||||||
@ -50,7 +49,7 @@ protected:
|
|||||||
void SetUp() override
|
void SetUp() override
|
||||||
{
|
{
|
||||||
testbinary = "VariableTest";
|
testbinary = "VariableTest";
|
||||||
args = {"-log", "none", "-echo", "screen", "-nocite", "-v", "num", "1"};
|
args = {"-log", "none", "-echo", "screen", "-nocite", "-v", "num", "1"};
|
||||||
LAMMPSTest::SetUp();
|
LAMMPSTest::SetUp();
|
||||||
group = lmp->group;
|
group = lmp->group;
|
||||||
domain = lmp->domain;
|
domain = lmp->domain;
|
||||||
@ -162,8 +161,8 @@ TEST_F(VariableTest, CreateDelete)
|
|||||||
variable->internal_set(variable->find("ten"), 2.5);
|
variable->internal_set(variable->find("ten"), 2.5);
|
||||||
ASSERT_THAT(variable->retrieve("ten"), StrEq("2.5"));
|
ASSERT_THAT(variable->retrieve("ten"), StrEq("2.5"));
|
||||||
ASSERT_THAT(variable->retrieve("file"), StrEq("0"));
|
ASSERT_THAT(variable->retrieve("file"), StrEq("0"));
|
||||||
FILE *fp = fopen("MYFILE","w");
|
FILE *fp = fopen("MYFILE", "w");
|
||||||
fputs(" ",fp);
|
fputs(" ", fp);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
ASSERT_THAT(variable->retrieve("file"), StrEq("1"));
|
ASSERT_THAT(variable->retrieve("file"), StrEq("1"));
|
||||||
unlink("MYFILE");
|
unlink("MYFILE");
|
||||||
@ -218,7 +217,9 @@ TEST_F(VariableTest, CreateDelete)
|
|||||||
|
|
||||||
TEST_F(VariableTest, AtomicSystem)
|
TEST_F(VariableTest, AtomicSystem)
|
||||||
{
|
{
|
||||||
HIDE_OUTPUT([&] { command("atom_modify map array"); });
|
HIDE_OUTPUT([&] {
|
||||||
|
command("atom_modify map array");
|
||||||
|
});
|
||||||
atomic_system();
|
atomic_system();
|
||||||
file_vars();
|
file_vars();
|
||||||
|
|
||||||
@ -443,7 +444,7 @@ TEST_F(VariableTest, IfCommand)
|
|||||||
BEGIN_CAPTURE_OUTPUT();
|
BEGIN_CAPTURE_OUTPUT();
|
||||||
command("if x!=x|^a!=b then 'print \"bingo!\"'");
|
command("if x!=x|^a!=b then 'print \"bingo!\"'");
|
||||||
text = END_CAPTURE_OUTPUT();
|
text = END_CAPTURE_OUTPUT();
|
||||||
|
|
||||||
ASSERT_THAT(text, MatchesRegex(".*bingo!.*"));
|
ASSERT_THAT(text, MatchesRegex(".*bingo!.*"));
|
||||||
|
|
||||||
TEST_FAILURE(".*ERROR: Invalid Boolean syntax in if command.*",
|
TEST_FAILURE(".*ERROR: Invalid Boolean syntax in if command.*",
|
||||||
|
|||||||
@ -13,9 +13,9 @@
|
|||||||
|
|
||||||
#include "test_config_reader.h"
|
#include "test_config_reader.h"
|
||||||
#include "test_config.h"
|
#include "test_config.h"
|
||||||
|
#include "utils.h"
|
||||||
#include "yaml.h"
|
#include "yaml.h"
|
||||||
#include "yaml_reader.h"
|
#include "yaml_reader.h"
|
||||||
#include "utils.h"
|
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|||||||
@ -938,8 +938,7 @@ TEST(FixTimestep, omp)
|
|||||||
// rigid fixes need work to test properly with r-RESPA,
|
// rigid fixes need work to test properly with r-RESPA,
|
||||||
// also, torque is not supported by respa/omp
|
// also, torque is not supported by respa/omp
|
||||||
ifix = lmp->modify->find_fix("test");
|
ifix = lmp->modify->find_fix("test");
|
||||||
if (!utils::strmatch(lmp->modify->fix[ifix]->style, "^rigid")
|
if (!utils::strmatch(lmp->modify->fix[ifix]->style, "^rigid") && !lmp->atom->torque) {
|
||||||
&& !lmp->atom->torque) {
|
|
||||||
|
|
||||||
if (!verbose) ::testing::internal::CaptureStdout();
|
if (!verbose) ::testing::internal::CaptureStdout();
|
||||||
cleanup_lammps(lmp, test_config);
|
cleanup_lammps(lmp, test_config);
|
||||||
|
|||||||
@ -41,15 +41,13 @@ bool read_yaml_file(const char *infile, TestConfig &config)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// write out common header items for yaml files
|
// write out common header items for yaml files
|
||||||
void write_yaml_header(YamlWriter *writer,
|
void write_yaml_header(YamlWriter *writer, TestConfig *cfg, const char *version)
|
||||||
TestConfig *cfg,
|
|
||||||
const char *version)
|
|
||||||
{
|
{
|
||||||
// lammps_version
|
// lammps_version
|
||||||
writer->emit("lammps_version", version);
|
writer->emit("lammps_version", version);
|
||||||
|
|
||||||
// date_generated
|
// date_generated
|
||||||
std::time_t now = time(NULL);
|
std::time_t now = time(NULL);
|
||||||
std::string block = trim(ctime(&now));
|
std::string block = trim(ctime(&now));
|
||||||
writer->emit("date_generated", block);
|
writer->emit("date_generated", block);
|
||||||
|
|
||||||
@ -59,8 +57,10 @@ void write_yaml_header(YamlWriter *writer,
|
|||||||
// skip tests
|
// skip tests
|
||||||
block.clear();
|
block.clear();
|
||||||
for (auto &skip : cfg->skip_tests) {
|
for (auto &skip : cfg->skip_tests) {
|
||||||
if (block.empty()) block = skip;
|
if (block.empty())
|
||||||
else block += " " + skip;
|
block = skip;
|
||||||
|
else
|
||||||
|
block += " " + skip;
|
||||||
}
|
}
|
||||||
writer->emit("skip_tests", block);
|
writer->emit("skip_tests", block);
|
||||||
|
|
||||||
|
|||||||
@ -23,8 +23,7 @@ extern bool verbose;
|
|||||||
extern std::string INPUT_FOLDER;
|
extern std::string INPUT_FOLDER;
|
||||||
|
|
||||||
// convenience method to write out common entries
|
// convenience method to write out common entries
|
||||||
void write_yaml_header(class YamlWriter *writer, TestConfig *cfg,
|
void write_yaml_header(class YamlWriter *writer, TestConfig *cfg, const char *version);
|
||||||
const char *version);
|
|
||||||
|
|
||||||
#define EXPECT_FP_LE_WITH_EPS(val1, val2, eps) \
|
#define EXPECT_FP_LE_WITH_EPS(val1, val2, eps) \
|
||||||
do { \
|
do { \
|
||||||
@ -42,4 +41,3 @@ static const char PATH_SEP = '/';
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -279,7 +279,8 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
|||||||
// init_stress
|
// init_stress
|
||||||
auto stress = lmp->force->pair->virial;
|
auto stress = lmp->force->pair->virial;
|
||||||
// avoid false positives on tiny stresses. force to zero instead.
|
// avoid false positives on tiny stresses. force to zero instead.
|
||||||
for (int i = 0; i < 6; ++i) if (fabs(stress[i]) < 1.0e-13) stress[i] = 0.0;
|
for (int i = 0; i < 6; ++i)
|
||||||
|
if (fabs(stress[i]) < 1.0e-13) stress[i] = 0.0;
|
||||||
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("init_stress", block);
|
writer.emit_block("init_stress", block);
|
||||||
@ -305,8 +306,9 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
|||||||
// run_stress
|
// run_stress
|
||||||
stress = lmp->force->pair->virial;
|
stress = lmp->force->pair->virial;
|
||||||
// avoid false positives on tiny stresses. force to zero instead.
|
// avoid false positives on tiny stresses. force to zero instead.
|
||||||
for (int i = 0; i < 6; ++i) if (fabs(stress[i]) < 1.0e-13) stress[i] = 0.0;
|
for (int i = 0; i < 6; ++i)
|
||||||
block = fmt::format("{:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e}", stress[0],
|
if (fabs(stress[i]) < 1.0e-13) stress[i] = 0.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);
|
||||||
|
|
||||||
|
|||||||
@ -12,8 +12,8 @@
|
|||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
#include "yaml_writer.h"
|
#include "yaml_writer.h"
|
||||||
#include "yaml.h"
|
|
||||||
#include "fmt/format.h"
|
#include "fmt/format.h"
|
||||||
|
#include "yaml.h"
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -52,17 +52,17 @@ YamlWriter::~YamlWriter()
|
|||||||
|
|
||||||
void YamlWriter::emit(const std::string &key, const double value)
|
void YamlWriter::emit(const std::string &key, const double value)
|
||||||
{
|
{
|
||||||
emit(key,fmt::format("{}",value));
|
emit(key, fmt::format("{}", value));
|
||||||
}
|
}
|
||||||
|
|
||||||
void YamlWriter::emit(const std::string &key, const long value)
|
void YamlWriter::emit(const std::string &key, const long value)
|
||||||
{
|
{
|
||||||
emit(key,fmt::format("{}",value));
|
emit(key, fmt::format("{}", value));
|
||||||
}
|
}
|
||||||
|
|
||||||
void YamlWriter::emit(const std::string &key, const int value)
|
void YamlWriter::emit(const std::string &key, const int value)
|
||||||
{
|
{
|
||||||
emit(key,fmt::format("{}",value));
|
emit(key, fmt::format("{}", value));
|
||||||
}
|
}
|
||||||
|
|
||||||
void YamlWriter::emit(const std::string &key, const std::string &value)
|
void YamlWriter::emit(const std::string &key, const std::string &value)
|
||||||
|
|||||||
@ -17,9 +17,9 @@
|
|||||||
#include "../testing/systems/melt.h"
|
#include "../testing/systems/melt.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
extern const char * COMPRESS_SUFFIX;
|
extern const char *COMPRESS_SUFFIX;
|
||||||
extern const char * COMPRESS_EXTENSION;
|
extern const char *COMPRESS_EXTENSION;
|
||||||
extern char * COMPRESS_BINARY;
|
extern char *COMPRESS_BINARY;
|
||||||
|
|
||||||
class CompressedDumpTest : public MeltTest {
|
class CompressedDumpTest : public MeltTest {
|
||||||
protected:
|
protected:
|
||||||
@ -27,19 +27,23 @@ protected:
|
|||||||
std::string compression_style;
|
std::string compression_style;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CompressedDumpTest(const std::string & dump_style) : MeltTest(), dump_style(dump_style) {
|
CompressedDumpTest(const std::string &dump_style) : MeltTest(), dump_style(dump_style)
|
||||||
|
{
|
||||||
compression_style = fmt::format("{}/{}", dump_style, COMPRESS_SUFFIX);
|
compression_style = fmt::format("{}/{}", dump_style, COMPRESS_SUFFIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string text_dump_filename(std::string ident) {
|
std::string text_dump_filename(std::string ident)
|
||||||
|
{
|
||||||
return fmt::format("dump_{}_text_{}", COMPRESS_SUFFIX, ident);
|
return fmt::format("dump_{}_text_{}", COMPRESS_SUFFIX, ident);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string compressed_dump_filename(std::string ident) {
|
std::string compressed_dump_filename(std::string ident)
|
||||||
|
{
|
||||||
return fmt::format("dump_{}_compressed_{}.{}", COMPRESS_SUFFIX, ident, COMPRESS_EXTENSION);
|
return fmt::format("dump_{}_compressed_{}.{}", COMPRESS_SUFFIX, ident, COMPRESS_EXTENSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string converted_dump_filename(std::string ident) {
|
std::string converted_dump_filename(std::string ident)
|
||||||
|
{
|
||||||
return fmt::format("dump_{}_compressed_{}", COMPRESS_SUFFIX, ident);
|
return fmt::format("dump_{}_compressed_{}", COMPRESS_SUFFIX, ident);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,21 +68,22 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void generate_text_and_compressed_dump(std::string text_file, std::string compressed_file,
|
void generate_text_and_compressed_dump(std::string text_file, std::string compressed_file,
|
||||||
std::string dump_options, std::string dump_modify_options, int ntimesteps)
|
std::string dump_options,
|
||||||
|
std::string dump_modify_options, int ntimesteps)
|
||||||
{
|
{
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file,
|
generate_text_and_compressed_dump(text_file, compressed_file, dump_options, dump_options,
|
||||||
dump_options, dump_options,
|
|
||||||
dump_modify_options, dump_modify_options, ntimesteps);
|
dump_modify_options, dump_modify_options, ntimesteps);
|
||||||
}
|
}
|
||||||
|
|
||||||
void generate_text_and_compressed_dump(std::string text_file, std::string compressed_file,
|
void generate_text_and_compressed_dump(std::string text_file, std::string compressed_file,
|
||||||
std::string text_options, std::string compressed_options,
|
std::string text_options, std::string compressed_options,
|
||||||
std::string text_modify_options, std::string compressed_modify_options,
|
std::string text_modify_options,
|
||||||
int ntimesteps)
|
std::string compressed_modify_options, int ntimesteps)
|
||||||
{
|
{
|
||||||
BEGIN_HIDE_OUTPUT();
|
BEGIN_HIDE_OUTPUT();
|
||||||
command(fmt::format("dump id0 all {} 1 {} {}", dump_style, text_file, text_options));
|
command(fmt::format("dump id0 all {} 1 {} {}", dump_style, text_file, text_options));
|
||||||
command(fmt::format("dump id1 all {} 1 {} {}", compression_style, compressed_file, compressed_options));
|
command(fmt::format("dump id1 all {} 1 {} {}", compression_style, compressed_file,
|
||||||
|
compressed_options));
|
||||||
|
|
||||||
if (!text_modify_options.empty()) {
|
if (!text_modify_options.empty()) {
|
||||||
command(fmt::format("dump_modify id0 {}", text_modify_options));
|
command(fmt::format("dump_modify id0 {}", text_modify_options));
|
||||||
|
|||||||
@ -11,8 +11,8 @@
|
|||||||
See the README file in the top-level LAMMPS directory.
|
See the README file in the top-level LAMMPS directory.
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
#include "compressed_dump_test.h"
|
|
||||||
#include "../testing/utils.h"
|
#include "../testing/utils.h"
|
||||||
|
#include "compressed_dump_test.h"
|
||||||
#include "fmt/format.h"
|
#include "fmt/format.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
@ -20,10 +20,10 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
const char * COMPRESS_SUFFIX = nullptr;
|
const char *COMPRESS_SUFFIX = nullptr;
|
||||||
const char * COMPRESS_EXTENSION = nullptr;
|
const char *COMPRESS_EXTENSION = nullptr;
|
||||||
char * COMPRESS_BINARY = nullptr;
|
char *COMPRESS_BINARY = nullptr;
|
||||||
bool verbose = false;
|
bool verbose = false;
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@ -35,11 +35,11 @@ int main(int argc, char **argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strcmp(argv[1], "gz") == 0) {
|
if (strcmp(argv[1], "gz") == 0) {
|
||||||
COMPRESS_SUFFIX = "gz";
|
COMPRESS_SUFFIX = "gz";
|
||||||
COMPRESS_EXTENSION = "gz";
|
COMPRESS_EXTENSION = "gz";
|
||||||
} else if(strcmp(argv[1], "zstd") == 0) {
|
} else if (strcmp(argv[1], "zstd") == 0) {
|
||||||
COMPRESS_SUFFIX = "zstd";
|
COMPRESS_SUFFIX = "zstd";
|
||||||
COMPRESS_EXTENSION = "zst";
|
COMPRESS_EXTENSION = "zst";
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "usage: " << argv[0] << " (gz|zstd)\n\n" << std::endl;
|
std::cerr << "usage: " << argv[0] << " (gz|zstd)\n\n" << std::endl;
|
||||||
|
|||||||
@ -4751,10 +4751,10 @@ TEST_F(AtomStyleTest, property_atom)
|
|||||||
expected.has_mass_setflag = true;
|
expected.has_mass_setflag = true;
|
||||||
expected.has_sametag = true;
|
expected.has_sametag = true;
|
||||||
expected.has_extra = true;
|
expected.has_extra = true;
|
||||||
expected.has_ivname = true;
|
expected.has_ivname = true;
|
||||||
expected.has_dvname = true;
|
expected.has_dvname = true;
|
||||||
expected.has_ianame = true;
|
expected.has_ianame = true;
|
||||||
expected.has_daname = true;
|
expected.has_daname = true;
|
||||||
expected.nextra_store = 12;
|
expected.nextra_store = 12;
|
||||||
|
|
||||||
ASSERT_ATOM_STATE_EQ(lmp->atom, expected);
|
ASSERT_ATOM_STATE_EQ(lmp->atom, expected);
|
||||||
|
|||||||
@ -20,13 +20,11 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
using ::testing::Eq;
|
using ::testing::Eq;
|
||||||
|
|
||||||
class DumpAtomCompressTest : public CompressedDumpTest {
|
class DumpAtomCompressTest : public CompressedDumpTest {
|
||||||
public:
|
public:
|
||||||
DumpAtomCompressTest() : CompressedDumpTest("atom") {
|
DumpAtomCompressTest() : CompressedDumpTest("atom") {}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------
|
||||||
@ -40,8 +38,9 @@ TEST_F(DumpAtomCompressTest, compressed_run0)
|
|||||||
auto text_file = text_dump_filename("run0.melt");
|
auto text_file = text_dump_filename("run0.melt");
|
||||||
auto compressed_file = compressed_dump_filename("run0.melt");
|
auto compressed_file = compressed_dump_filename("run0.melt");
|
||||||
|
|
||||||
if(compression_style == "atom/zstd") {
|
if (compression_style == "atom/zstd") {
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "", "", "checksum yes", 0);
|
generate_text_and_compressed_dump(text_file, compressed_file, "", "", "", "checksum yes",
|
||||||
|
0);
|
||||||
} else {
|
} else {
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "", 0);
|
generate_text_and_compressed_dump(text_file, compressed_file, "", "", 0);
|
||||||
}
|
}
|
||||||
@ -68,8 +67,9 @@ TEST_F(DumpAtomCompressTest, compressed_no_buffer_run0)
|
|||||||
auto text_file = text_dump_filename("no_buffer_run0.melt");
|
auto text_file = text_dump_filename("no_buffer_run0.melt");
|
||||||
auto compressed_file = compressed_dump_filename("no_buffer_run0.melt");
|
auto compressed_file = compressed_dump_filename("no_buffer_run0.melt");
|
||||||
|
|
||||||
if(compression_style == "atom/zstd") {
|
if (compression_style == "atom/zstd") {
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "", "buffer no", "buffer no checksum yes", 0);
|
generate_text_and_compressed_dump(text_file, compressed_file, "", "", "buffer no",
|
||||||
|
"buffer no checksum yes", 0);
|
||||||
} else {
|
} else {
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "buffer no", 0);
|
generate_text_and_compressed_dump(text_file, compressed_file, "", "buffer no", 0);
|
||||||
}
|
}
|
||||||
@ -103,7 +103,7 @@ TEST_F(DumpAtomCompressTest, compressed_multi_file_run1)
|
|||||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||||
|
|
||||||
if(compression_style == "atom/zstd") {
|
if (compression_style == "atom/zstd") {
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "", "", "checksum no", 1);
|
generate_text_and_compressed_dump(text_file, compressed_file, "", "", "", "checksum no", 1);
|
||||||
} else {
|
} else {
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "", 1);
|
generate_text_and_compressed_dump(text_file, compressed_file, "", "", 1);
|
||||||
@ -369,12 +369,13 @@ TEST_F(DumpAtomCompressTest, compressed_modify_bad_param)
|
|||||||
if (compression_style != "atom/gz") GTEST_SKIP();
|
if (compression_style != "atom/gz") GTEST_SKIP();
|
||||||
|
|
||||||
BEGIN_HIDE_OUTPUT();
|
BEGIN_HIDE_OUTPUT();
|
||||||
command(fmt::format("dump id1 all {} 1 {}", compression_style, compressed_dump_filename("modify_bad_param_run0_*.melt")));
|
command(fmt::format("dump id1 all {} 1 {}", compression_style,
|
||||||
|
compressed_dump_filename("modify_bad_param_run0_*.melt")));
|
||||||
END_HIDE_OUTPUT();
|
END_HIDE_OUTPUT();
|
||||||
|
|
||||||
TEST_FAILURE(".*ERROR on proc 0: Illegal dump_modify command: Compression level must in the range of.*",
|
TEST_FAILURE(
|
||||||
command("dump_modify id1 compression_level 12");
|
".*ERROR on proc 0: Illegal dump_modify command: Compression level must in the range of.*",
|
||||||
);
|
command("dump_modify id1 compression_level 12"););
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DumpAtomCompressTest, compressed_modify_multi_bad_param)
|
TEST_F(DumpAtomCompressTest, compressed_modify_multi_bad_param)
|
||||||
@ -382,12 +383,13 @@ TEST_F(DumpAtomCompressTest, compressed_modify_multi_bad_param)
|
|||||||
if (compression_style != "atom/gz") GTEST_SKIP();
|
if (compression_style != "atom/gz") GTEST_SKIP();
|
||||||
|
|
||||||
BEGIN_HIDE_OUTPUT();
|
BEGIN_HIDE_OUTPUT();
|
||||||
command(fmt::format("dump id1 all {} 1 {}", compression_style, compressed_dump_filename("modify_multi_bad_param_run0_*.melt")));
|
command(fmt::format("dump id1 all {} 1 {}", compression_style,
|
||||||
|
compressed_dump_filename("modify_multi_bad_param_run0_*.melt")));
|
||||||
END_HIDE_OUTPUT();
|
END_HIDE_OUTPUT();
|
||||||
|
|
||||||
TEST_FAILURE(".*ERROR on proc 0: Illegal dump_modify command: Compression level must in the range of.*",
|
TEST_FAILURE(
|
||||||
command("dump_modify id1 pad 3 compression_level 12");
|
".*ERROR on proc 0: Illegal dump_modify command: Compression level must in the range of.*",
|
||||||
);
|
command("dump_modify id1 pad 3 compression_level 12"););
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DumpAtomCompressTest, compressed_modify_clevel_run0)
|
TEST_F(DumpAtomCompressTest, compressed_modify_clevel_run0)
|
||||||
@ -398,7 +400,8 @@ TEST_F(DumpAtomCompressTest, compressed_modify_clevel_run0)
|
|||||||
auto text_file = text_dump_filename(base_name);
|
auto text_file = text_dump_filename(base_name);
|
||||||
auto compressed_file = compressed_dump_filename(base_name);
|
auto compressed_file = compressed_dump_filename(base_name);
|
||||||
|
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "", "", "compression_level 3", 0);
|
generate_text_and_compressed_dump(text_file, compressed_file, "", "", "", "compression_level 3",
|
||||||
|
0);
|
||||||
|
|
||||||
TearDown();
|
TearDown();
|
||||||
|
|
||||||
|
|||||||
@ -97,7 +97,8 @@ TEST_F(DumpCfgTest, write_dump)
|
|||||||
ASSERT_THAT(lines[0], Eq("Number of particles = 32"));
|
ASSERT_THAT(lines[0], Eq("Number of particles = 32"));
|
||||||
delete_file("dump_cfg0.melt.cfg");
|
delete_file("dump_cfg0.melt.cfg");
|
||||||
|
|
||||||
TEST_FAILURE(".*ERROR: Unrecognized dump style 'xxx'.*", command("write_dump all xxx test.xxx"););
|
TEST_FAILURE(".*ERROR: Unrecognized dump style 'xxx'.*",
|
||||||
|
command("write_dump all xxx test.xxx"););
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DumpCfgTest, unwrap_run0)
|
TEST_F(DumpCfgTest, unwrap_run0)
|
||||||
|
|||||||
@ -20,13 +20,11 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
using ::testing::Eq;
|
using ::testing::Eq;
|
||||||
|
|
||||||
class DumpCfgCompressTest : public CompressedDumpTest {
|
class DumpCfgCompressTest : public CompressedDumpTest {
|
||||||
public:
|
public:
|
||||||
DumpCfgCompressTest() : CompressedDumpTest("cfg") {
|
DumpCfgCompressTest() : CompressedDumpTest("cfg") {}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------
|
||||||
@ -46,8 +44,9 @@ TEST_F(DumpCfgCompressTest, compressed_run0)
|
|||||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||||
auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||||
|
|
||||||
if(compression_style == "cfg/zstd") {
|
if (compression_style == "cfg/zstd") {
|
||||||
generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "", "checksum yes", 0);
|
generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "",
|
||||||
|
"checksum yes", 0);
|
||||||
} else {
|
} else {
|
||||||
generate_text_and_compressed_dump(text_files, compressed_files, fields, "", 0);
|
generate_text_and_compressed_dump(text_files, compressed_files, fields, "", 0);
|
||||||
}
|
}
|
||||||
@ -79,8 +78,9 @@ TEST_F(DumpCfgCompressTest, compressed_no_buffer_run0)
|
|||||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||||
auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||||
|
|
||||||
if(compression_style == "cfg/zstd") {
|
if (compression_style == "cfg/zstd") {
|
||||||
generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "buffer no", "buffer no", 0);
|
generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "buffer no",
|
||||||
|
"buffer no", 0);
|
||||||
} else {
|
} else {
|
||||||
generate_text_and_compressed_dump(text_files, compressed_files, fields, "buffer no", 0);
|
generate_text_and_compressed_dump(text_files, compressed_files, fields, "buffer no", 0);
|
||||||
}
|
}
|
||||||
@ -110,7 +110,7 @@ TEST_F(DumpCfgCompressTest, compressed_unwrap_run0)
|
|||||||
auto base_name_0 = "unwrap_run0.melt.cfg";
|
auto base_name_0 = "unwrap_run0.melt.cfg";
|
||||||
auto text_file_0 = text_dump_filename(base_name_0);
|
auto text_file_0 = text_dump_filename(base_name_0);
|
||||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||||
auto fields = "mass type xsu ysu zsu id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
auto fields = "mass type xsu ysu zsu id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||||
|
|
||||||
generate_text_and_compressed_dump(text_files, compressed_files, fields, "", 0);
|
generate_text_and_compressed_dump(text_files, compressed_files, fields, "", 0);
|
||||||
|
|
||||||
@ -143,8 +143,9 @@ TEST_F(DumpCfgCompressTest, compressed_multi_file_run1)
|
|||||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||||
auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||||
|
|
||||||
if(compression_style == "cfg/zstd") {
|
if (compression_style == "cfg/zstd") {
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "", "checksum no", 1);
|
generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "",
|
||||||
|
"checksum no", 1);
|
||||||
} else {
|
} else {
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, "", 1);
|
generate_text_and_compressed_dump(text_file, compressed_file, fields, "", 1);
|
||||||
}
|
}
|
||||||
@ -262,28 +263,31 @@ TEST_F(DumpCfgCompressTest, compressed_modify_bad_param)
|
|||||||
{
|
{
|
||||||
if (compression_style != "cfg/gz") GTEST_SKIP();
|
if (compression_style != "cfg/gz") GTEST_SKIP();
|
||||||
|
|
||||||
auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||||
BEGIN_HIDE_OUTPUT();
|
BEGIN_HIDE_OUTPUT();
|
||||||
command(fmt::format("dump id1 all {} 1 {} {}", compression_style, compressed_dump_filename("modify_bad_param_run0_*.melt.cfg"), fields));
|
command(fmt::format("dump id1 all {} 1 {} {}", compression_style,
|
||||||
|
compressed_dump_filename("modify_bad_param_run0_*.melt.cfg"), fields));
|
||||||
END_HIDE_OUTPUT();
|
END_HIDE_OUTPUT();
|
||||||
|
|
||||||
TEST_FAILURE(".*ERROR on proc 0: Illegal dump_modify command: Compression level must in the range of.*",
|
TEST_FAILURE(
|
||||||
command("dump_modify id1 compression_level 12");
|
".*ERROR on proc 0: Illegal dump_modify command: Compression level must in the range of.*",
|
||||||
);
|
command("dump_modify id1 compression_level 12"););
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DumpCfgCompressTest, compressed_modify_multi_bad_param)
|
TEST_F(DumpCfgCompressTest, compressed_modify_multi_bad_param)
|
||||||
{
|
{
|
||||||
if (compression_style != "cfg/gz") GTEST_SKIP();
|
if (compression_style != "cfg/gz") GTEST_SKIP();
|
||||||
|
|
||||||
auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||||
BEGIN_HIDE_OUTPUT();
|
BEGIN_HIDE_OUTPUT();
|
||||||
command(fmt::format("dump id1 all {} 1 {} {}", compression_style, compressed_dump_filename("modify_multi_bad_param_run0_*.melt.cfg"), fields));
|
command(fmt::format("dump id1 all {} 1 {} {}", compression_style,
|
||||||
|
compressed_dump_filename("modify_multi_bad_param_run0_*.melt.cfg"),
|
||||||
|
fields));
|
||||||
END_HIDE_OUTPUT();
|
END_HIDE_OUTPUT();
|
||||||
|
|
||||||
TEST_FAILURE(".*ERROR on proc 0: Illegal dump_modify command: Compression level must in the range of.*",
|
TEST_FAILURE(
|
||||||
command("dump_modify id1 pad 3 compression_level 12");
|
".*ERROR on proc 0: Illegal dump_modify command: Compression level must in the range of.*",
|
||||||
);
|
command("dump_modify id1 pad 3 compression_level 12"););
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DumpCfgCompressTest, compressed_modify_clevel_run0)
|
TEST_F(DumpCfgCompressTest, compressed_modify_clevel_run0)
|
||||||
@ -298,7 +302,8 @@ TEST_F(DumpCfgCompressTest, compressed_modify_clevel_run0)
|
|||||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||||
auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||||
|
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "", "compression_level 3", 0);
|
generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "",
|
||||||
|
"compression_level 3", 0);
|
||||||
|
|
||||||
TearDown();
|
TearDown();
|
||||||
|
|
||||||
|
|||||||
@ -20,13 +20,11 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
using ::testing::Eq;
|
using ::testing::Eq;
|
||||||
|
|
||||||
class DumpCustomCompressTest : public CompressedDumpTest {
|
class DumpCustomCompressTest : public CompressedDumpTest {
|
||||||
public:
|
public:
|
||||||
DumpCustomCompressTest() : CompressedDumpTest("custom") {
|
DumpCustomCompressTest() : CompressedDumpTest("custom") {}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(DumpCustomCompressTest, compressed_run1)
|
TEST_F(DumpCustomCompressTest, compressed_run1)
|
||||||
@ -38,8 +36,9 @@ TEST_F(DumpCustomCompressTest, compressed_run1)
|
|||||||
auto compressed_file = compressed_dump_filename(base_name);
|
auto compressed_file = compressed_dump_filename(base_name);
|
||||||
auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||||
|
|
||||||
if(compression_style == "custom/zstd") {
|
if (compression_style == "custom/zstd") {
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "units yes", "units yes checksum yes", 1);
|
generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "units yes",
|
||||||
|
"units yes checksum yes", 1);
|
||||||
} else {
|
} else {
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, "units yes", 1);
|
generate_text_and_compressed_dump(text_file, compressed_file, fields, "units yes", 1);
|
||||||
}
|
}
|
||||||
@ -67,8 +66,9 @@ TEST_F(DumpCustomCompressTest, compressed_with_time_run1)
|
|||||||
auto compressed_file = compressed_dump_filename(base_name);
|
auto compressed_file = compressed_dump_filename(base_name);
|
||||||
auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||||
|
|
||||||
if(compression_style == "custom/zstd") {
|
if (compression_style == "custom/zstd") {
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "time yes", "time yes checksum yes", 1);
|
generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "time yes",
|
||||||
|
"time yes checksum yes", 1);
|
||||||
} else {
|
} else {
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, "time yes", 1);
|
generate_text_and_compressed_dump(text_file, compressed_file, fields, "time yes", 1);
|
||||||
}
|
}
|
||||||
@ -96,8 +96,9 @@ TEST_F(DumpCustomCompressTest, compressed_no_buffer_run1)
|
|||||||
auto compressed_file = compressed_dump_filename(base_name);
|
auto compressed_file = compressed_dump_filename(base_name);
|
||||||
auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||||
|
|
||||||
if(compression_style == "custom/zstd") {
|
if (compression_style == "custom/zstd") {
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "buffer no", "buffer no checksum yes", 1);
|
generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "buffer no",
|
||||||
|
"buffer no checksum yes", 1);
|
||||||
} else {
|
} else {
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, "buffer no", 1);
|
generate_text_and_compressed_dump(text_file, compressed_file, fields, "buffer no", 1);
|
||||||
}
|
}
|
||||||
@ -158,8 +159,9 @@ TEST_F(DumpCustomCompressTest, compressed_multi_file_run1)
|
|||||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||||
auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||||
|
|
||||||
if(compression_style == "custom/zstd") {
|
if (compression_style == "custom/zstd") {
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "", "checksum no", 1);
|
generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "",
|
||||||
|
"checksum no", 1);
|
||||||
} else {
|
} else {
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, "", 1);
|
generate_text_and_compressed_dump(text_file, compressed_file, fields, "", 1);
|
||||||
}
|
}
|
||||||
@ -278,11 +280,12 @@ TEST_F(DumpCustomCompressTest, compressed_modify_bad_param)
|
|||||||
if (compression_style != "custom/gz") GTEST_SKIP();
|
if (compression_style != "custom/gz") GTEST_SKIP();
|
||||||
|
|
||||||
auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||||
command(fmt::format("dump id1 all {} 1 {} {}", compression_style, compressed_dump_filename("modify_bad_param_run0_*.melt.custom"), fields));
|
command(fmt::format("dump id1 all {} 1 {} {}", compression_style,
|
||||||
|
compressed_dump_filename("modify_bad_param_run0_*.melt.custom"), fields));
|
||||||
|
|
||||||
TEST_FAILURE(".*ERROR on proc 0: Illegal dump_modify command: Compression level must in the range of.*",
|
TEST_FAILURE(
|
||||||
command("dump_modify id1 compression_level 12");
|
".*ERROR on proc 0: Illegal dump_modify command: Compression level must in the range of.*",
|
||||||
);
|
command("dump_modify id1 compression_level 12"););
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DumpCustomCompressTest, compressed_modify_multi_bad_param)
|
TEST_F(DumpCustomCompressTest, compressed_modify_multi_bad_param)
|
||||||
@ -290,11 +293,13 @@ TEST_F(DumpCustomCompressTest, compressed_modify_multi_bad_param)
|
|||||||
if (compression_style != "custom/gz") GTEST_SKIP();
|
if (compression_style != "custom/gz") GTEST_SKIP();
|
||||||
|
|
||||||
auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||||
command(fmt::format("dump id1 all {} 1 {} {}", compression_style, compressed_dump_filename("modify_multi_bad_param_run0_*.melt.custom"), fields));
|
command(fmt::format("dump id1 all {} 1 {} {}", compression_style,
|
||||||
|
compressed_dump_filename("modify_multi_bad_param_run0_*.melt.custom"),
|
||||||
|
fields));
|
||||||
|
|
||||||
TEST_FAILURE(".*ERROR on proc 0: Illegal dump_modify command: Compression level must in the range of.*",
|
TEST_FAILURE(
|
||||||
command("dump_modify id1 pad 3 compression_level 12");
|
".*ERROR on proc 0: Illegal dump_modify command: Compression level must in the range of.*",
|
||||||
);
|
command("dump_modify id1 pad 3 compression_level 12"););
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DumpCustomCompressTest, compressed_modify_clevel_run0)
|
TEST_F(DumpCustomCompressTest, compressed_modify_clevel_run0)
|
||||||
@ -306,7 +311,8 @@ TEST_F(DumpCustomCompressTest, compressed_modify_clevel_run0)
|
|||||||
auto compressed_file = compressed_dump_filename(base_name);
|
auto compressed_file = compressed_dump_filename(base_name);
|
||||||
|
|
||||||
auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "", "compression_level 3", 0);
|
generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "",
|
||||||
|
"compression_level 3", 0);
|
||||||
|
|
||||||
TearDown();
|
TearDown();
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,8 @@ public:
|
|||||||
END_HIDE_OUTPUT();
|
END_HIDE_OUTPUT();
|
||||||
}
|
}
|
||||||
|
|
||||||
void generate_dump(std::string dump_file, std::string dump_options, std::string dump_modify_options, int ntimesteps)
|
void generate_dump(std::string dump_file, std::string dump_options,
|
||||||
|
std::string dump_modify_options, int ntimesteps)
|
||||||
{
|
{
|
||||||
BEGIN_HIDE_OUTPUT();
|
BEGIN_HIDE_OUTPUT();
|
||||||
command(fmt::format("dump id all {} 1 {} {}", dump_style, dump_file, dump_options));
|
command(fmt::format("dump id all {} 1 {} {}", dump_style, dump_file, dump_options));
|
||||||
@ -59,7 +60,8 @@ public:
|
|||||||
END_HIDE_OUTPUT();
|
END_HIDE_OUTPUT();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetUp() override {
|
void SetUp() override
|
||||||
|
{
|
||||||
MeltTest::SetUp();
|
MeltTest::SetUp();
|
||||||
|
|
||||||
BEGIN_HIDE_OUTPUT();
|
BEGIN_HIDE_OUTPUT();
|
||||||
|
|||||||
@ -20,15 +20,14 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
using ::testing::Eq;
|
using ::testing::Eq;
|
||||||
|
|
||||||
class DumpLocalCompressTest : public CompressedDumpTest {
|
class DumpLocalCompressTest : public CompressedDumpTest {
|
||||||
public:
|
public:
|
||||||
DumpLocalCompressTest() : CompressedDumpTest("local") {
|
DumpLocalCompressTest() : CompressedDumpTest("local") {}
|
||||||
}
|
|
||||||
|
|
||||||
void SetUp() override {
|
void SetUp() override
|
||||||
|
{
|
||||||
CompressedDumpTest::SetUp();
|
CompressedDumpTest::SetUp();
|
||||||
|
|
||||||
BEGIN_HIDE_OUTPUT();
|
BEGIN_HIDE_OUTPUT();
|
||||||
@ -49,8 +48,9 @@ TEST_F(DumpLocalCompressTest, compressed_run0)
|
|||||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||||
auto fields = "index c_comp[1]";
|
auto fields = "index c_comp[1]";
|
||||||
|
|
||||||
if(compression_style == "local/zstd") {
|
if (compression_style == "local/zstd") {
|
||||||
generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "", "checksum yes", 0);
|
generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "",
|
||||||
|
"checksum yes", 0);
|
||||||
} else {
|
} else {
|
||||||
generate_text_and_compressed_dump(text_files, compressed_files, fields, "", 0);
|
generate_text_and_compressed_dump(text_files, compressed_files, fields, "", 0);
|
||||||
}
|
}
|
||||||
@ -81,8 +81,9 @@ TEST_F(DumpLocalCompressTest, compressed_no_buffer_run0)
|
|||||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||||
auto fields = "index c_comp[1]";
|
auto fields = "index c_comp[1]";
|
||||||
|
|
||||||
if(compression_style == "local/zstd") {
|
if (compression_style == "local/zstd") {
|
||||||
generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "buffer no", "buffer no checksum yes", 0);
|
generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "buffer no",
|
||||||
|
"buffer no checksum yes", 0);
|
||||||
} else {
|
} else {
|
||||||
generate_text_and_compressed_dump(text_files, compressed_files, fields, "buffer no", 0);
|
generate_text_and_compressed_dump(text_files, compressed_files, fields, "buffer no", 0);
|
||||||
}
|
}
|
||||||
@ -113,8 +114,9 @@ TEST_F(DumpLocalCompressTest, compressed_with_time_run0)
|
|||||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||||
auto fields = "index c_comp[1]";
|
auto fields = "index c_comp[1]";
|
||||||
|
|
||||||
if(compression_style == "local/zstd") {
|
if (compression_style == "local/zstd") {
|
||||||
generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "time yes", "time yes checksum yes", 0);
|
generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "time yes",
|
||||||
|
"time yes checksum yes", 0);
|
||||||
} else {
|
} else {
|
||||||
generate_text_and_compressed_dump(text_files, compressed_files, fields, "time yes", 0);
|
generate_text_and_compressed_dump(text_files, compressed_files, fields, "time yes", 0);
|
||||||
}
|
}
|
||||||
@ -145,8 +147,9 @@ TEST_F(DumpLocalCompressTest, compressed_with_units_run0)
|
|||||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||||
auto fields = "index c_comp[1]";
|
auto fields = "index c_comp[1]";
|
||||||
|
|
||||||
if(compression_style == "local/zstd") {
|
if (compression_style == "local/zstd") {
|
||||||
generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "units yes", "units yes checksum yes", 0);
|
generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "units yes",
|
||||||
|
"units yes checksum yes", 0);
|
||||||
} else {
|
} else {
|
||||||
generate_text_and_compressed_dump(text_files, compressed_files, fields, "units yes", 0);
|
generate_text_and_compressed_dump(text_files, compressed_files, fields, "units yes", 0);
|
||||||
}
|
}
|
||||||
@ -178,8 +181,9 @@ TEST_F(DumpLocalCompressTest, compressed_triclinic_run0)
|
|||||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||||
auto fields = "index c_comp[1]";
|
auto fields = "index c_comp[1]";
|
||||||
|
|
||||||
if(compression_style == "local/zstd") {
|
if (compression_style == "local/zstd") {
|
||||||
generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "", "checksum yes", 0);
|
generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "",
|
||||||
|
"checksum yes", 0);
|
||||||
} else {
|
} else {
|
||||||
generate_text_and_compressed_dump(text_files, compressed_files, fields, "", 0);
|
generate_text_and_compressed_dump(text_files, compressed_files, fields, "", 0);
|
||||||
}
|
}
|
||||||
@ -213,8 +217,9 @@ TEST_F(DumpLocalCompressTest, compressed_multi_file_run1)
|
|||||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||||
auto fields = "index c_comp[1]";
|
auto fields = "index c_comp[1]";
|
||||||
|
|
||||||
if(compression_style == "local/zstd") {
|
if (compression_style == "local/zstd") {
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "", "checksum no", 1);
|
generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "",
|
||||||
|
"checksum no", 1);
|
||||||
} else {
|
} else {
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, "", 1);
|
generate_text_and_compressed_dump(text_file, compressed_file, fields, "", 1);
|
||||||
}
|
}
|
||||||
@ -332,30 +337,33 @@ TEST_F(DumpLocalCompressTest, compressed_modify_bad_param)
|
|||||||
{
|
{
|
||||||
if (compression_style != "local/gz") GTEST_SKIP();
|
if (compression_style != "local/gz") GTEST_SKIP();
|
||||||
|
|
||||||
auto fields = "index c_comp[1]";
|
auto fields = "index c_comp[1]";
|
||||||
|
|
||||||
BEGIN_HIDE_OUTPUT();
|
BEGIN_HIDE_OUTPUT();
|
||||||
command(fmt::format("dump id1 all {} 1 {} {}", compression_style, compressed_dump_filename("modify_bad_param_run0_*.melt.local"), fields));
|
command(fmt::format("dump id1 all {} 1 {} {}", compression_style,
|
||||||
|
compressed_dump_filename("modify_bad_param_run0_*.melt.local"), fields));
|
||||||
END_HIDE_OUTPUT();
|
END_HIDE_OUTPUT();
|
||||||
|
|
||||||
TEST_FAILURE(".*ERROR on proc 0: Illegal dump_modify command: Compression level must in the range of.*",
|
TEST_FAILURE(
|
||||||
command("dump_modify id1 compression_level 12");
|
".*ERROR on proc 0: Illegal dump_modify command: Compression level must in the range of.*",
|
||||||
);
|
command("dump_modify id1 compression_level 12"););
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DumpLocalCompressTest, compressed_modify_multi_bad_param)
|
TEST_F(DumpLocalCompressTest, compressed_modify_multi_bad_param)
|
||||||
{
|
{
|
||||||
if (compression_style != "local/gz") GTEST_SKIP();
|
if (compression_style != "local/gz") GTEST_SKIP();
|
||||||
|
|
||||||
auto fields = "index c_comp[1]";
|
auto fields = "index c_comp[1]";
|
||||||
|
|
||||||
BEGIN_HIDE_OUTPUT();
|
BEGIN_HIDE_OUTPUT();
|
||||||
command(fmt::format("dump id1 all {} 1 {} {}", compression_style, compressed_dump_filename("modify_multi_bad_param_run0_*.melt.local"), fields));
|
command(fmt::format("dump id1 all {} 1 {} {}", compression_style,
|
||||||
|
compressed_dump_filename("modify_multi_bad_param_run0_*.melt.local"),
|
||||||
|
fields));
|
||||||
END_HIDE_OUTPUT();
|
END_HIDE_OUTPUT();
|
||||||
|
|
||||||
TEST_FAILURE(".*ERROR on proc 0: Illegal dump_modify command: Compression level must in the range of.*",
|
TEST_FAILURE(
|
||||||
command("dump_modify id1 pad 3 compression_level 12");
|
".*ERROR on proc 0: Illegal dump_modify command: Compression level must in the range of.*",
|
||||||
);
|
command("dump_modify id1 pad 3 compression_level 12"););
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DumpLocalCompressTest, compressed_modify_clevel_run0)
|
TEST_F(DumpLocalCompressTest, compressed_modify_clevel_run0)
|
||||||
@ -365,9 +373,10 @@ TEST_F(DumpLocalCompressTest, compressed_modify_clevel_run0)
|
|||||||
auto base_name = "modify_clevel_run0.melt.local";
|
auto base_name = "modify_clevel_run0.melt.local";
|
||||||
auto text_file = text_dump_filename(base_name);
|
auto text_file = text_dump_filename(base_name);
|
||||||
auto compressed_file = compressed_dump_filename(base_name);
|
auto compressed_file = compressed_dump_filename(base_name);
|
||||||
auto fields = "index c_comp[1]";
|
auto fields = "index c_comp[1]";
|
||||||
|
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "", "compression_level 3", 0);
|
generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "",
|
||||||
|
"compression_level 3", 0);
|
||||||
|
|
||||||
TearDown();
|
TearDown();
|
||||||
|
|
||||||
|
|||||||
@ -20,13 +20,11 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
using ::testing::Eq;
|
using ::testing::Eq;
|
||||||
|
|
||||||
class DumpXYZCompressTest : public CompressedDumpTest {
|
class DumpXYZCompressTest : public CompressedDumpTest {
|
||||||
public:
|
public:
|
||||||
DumpXYZCompressTest() : CompressedDumpTest("xyz") {
|
DumpXYZCompressTest() : CompressedDumpTest("xyz") {}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(DumpXYZCompressTest, compressed_run0)
|
TEST_F(DumpXYZCompressTest, compressed_run0)
|
||||||
@ -40,8 +38,9 @@ TEST_F(DumpXYZCompressTest, compressed_run0)
|
|||||||
auto text_file_0 = text_dump_filename(base_name_0);
|
auto text_file_0 = text_dump_filename(base_name_0);
|
||||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||||
|
|
||||||
if(compression_style == "xyz/zstd") {
|
if (compression_style == "xyz/zstd") {
|
||||||
generate_text_and_compressed_dump(text_files, compressed_files, "", "", "", "checksum yes", 0);
|
generate_text_and_compressed_dump(text_files, compressed_files, "", "", "", "checksum yes",
|
||||||
|
0);
|
||||||
} else {
|
} else {
|
||||||
generate_text_and_compressed_dump(text_files, compressed_files, "", "", 0);
|
generate_text_and_compressed_dump(text_files, compressed_files, "", "", 0);
|
||||||
}
|
}
|
||||||
@ -71,8 +70,9 @@ TEST_F(DumpXYZCompressTest, compressed_no_buffer_run0)
|
|||||||
auto text_file_0 = text_dump_filename(base_name_0);
|
auto text_file_0 = text_dump_filename(base_name_0);
|
||||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||||
|
|
||||||
if(compression_style == "xyz/zstd") {
|
if (compression_style == "xyz/zstd") {
|
||||||
generate_text_and_compressed_dump(text_files, compressed_files, "", "", "buffer no", "buffer no", 0);
|
generate_text_and_compressed_dump(text_files, compressed_files, "", "", "buffer no",
|
||||||
|
"buffer no", 0);
|
||||||
} else {
|
} else {
|
||||||
generate_text_and_compressed_dump(text_files, compressed_files, "", "buffer no", 0);
|
generate_text_and_compressed_dump(text_files, compressed_files, "", "buffer no", 0);
|
||||||
}
|
}
|
||||||
@ -105,7 +105,7 @@ TEST_F(DumpXYZCompressTest, compressed_multi_file_run1)
|
|||||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||||
|
|
||||||
if(compression_style == "xyz/zstd") {
|
if (compression_style == "xyz/zstd") {
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "", "", "checksum no", 1);
|
generate_text_and_compressed_dump(text_file, compressed_file, "", "", "", "checksum no", 1);
|
||||||
} else {
|
} else {
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "", 1);
|
generate_text_and_compressed_dump(text_file, compressed_file, "", "", 1);
|
||||||
@ -223,12 +223,13 @@ TEST_F(DumpXYZCompressTest, compressed_modify_bad_param)
|
|||||||
if (compression_style != "xyz/gz") GTEST_SKIP();
|
if (compression_style != "xyz/gz") GTEST_SKIP();
|
||||||
|
|
||||||
BEGIN_HIDE_OUTPUT();
|
BEGIN_HIDE_OUTPUT();
|
||||||
command(fmt::format("dump id1 all {} 1 {}", compression_style, compressed_dump_filename("modify_bad_param_run0_*.melt.xyz")));
|
command(fmt::format("dump id1 all {} 1 {}", compression_style,
|
||||||
|
compressed_dump_filename("modify_bad_param_run0_*.melt.xyz")));
|
||||||
END_HIDE_OUTPUT();
|
END_HIDE_OUTPUT();
|
||||||
|
|
||||||
TEST_FAILURE(".*ERROR on proc 0: Illegal dump_modify command: Compression level must in the range of.*",
|
TEST_FAILURE(
|
||||||
command("dump_modify id1 compression_level 12");
|
".*ERROR on proc 0: Illegal dump_modify command: Compression level must in the range of.*",
|
||||||
);
|
command("dump_modify id1 compression_level 12"););
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DumpXYZCompressTest, compressed_modify_multi_bad_param)
|
TEST_F(DumpXYZCompressTest, compressed_modify_multi_bad_param)
|
||||||
@ -236,12 +237,13 @@ TEST_F(DumpXYZCompressTest, compressed_modify_multi_bad_param)
|
|||||||
if (compression_style != "xyz/gz") GTEST_SKIP();
|
if (compression_style != "xyz/gz") GTEST_SKIP();
|
||||||
|
|
||||||
BEGIN_HIDE_OUTPUT();
|
BEGIN_HIDE_OUTPUT();
|
||||||
command(fmt::format("dump id1 all {} 1 {}", compression_style, compressed_dump_filename("modify_multi_bad_param_run0_*.melt.xyz")));
|
command(fmt::format("dump id1 all {} 1 {}", compression_style,
|
||||||
|
compressed_dump_filename("modify_multi_bad_param_run0_*.melt.xyz")));
|
||||||
END_HIDE_OUTPUT();
|
END_HIDE_OUTPUT();
|
||||||
|
|
||||||
TEST_FAILURE(".*ERROR on proc 0: Illegal dump_modify command: Compression level must in the range of.*",
|
TEST_FAILURE(
|
||||||
command("dump_modify id1 pad 3 compression_level 12");
|
".*ERROR on proc 0: Illegal dump_modify command: Compression level must in the range of.*",
|
||||||
);
|
command("dump_modify id1 pad 3 compression_level 12"););
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DumpXYZCompressTest, compressed_modify_clevel_run0)
|
TEST_F(DumpXYZCompressTest, compressed_modify_clevel_run0)
|
||||||
@ -252,7 +254,8 @@ TEST_F(DumpXYZCompressTest, compressed_modify_clevel_run0)
|
|||||||
auto text_file = text_dump_filename(base_name);
|
auto text_file = text_dump_filename(base_name);
|
||||||
auto compressed_file = compressed_dump_filename(base_name);
|
auto compressed_file = compressed_dump_filename(base_name);
|
||||||
|
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "", "", "compression_level 3", 0);
|
generate_text_and_compressed_dump(text_file, compressed_file, "", "", "", "compression_level 3",
|
||||||
|
0);
|
||||||
|
|
||||||
TearDown();
|
TearDown();
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,7 @@
|
|||||||
See the README file in the top-level LAMMPS directory.
|
See the README file in the top-level LAMMPS directory.
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#include "../testing/core.h"
|
||||||
#include "MANYBODY/pair_eim.h"
|
#include "MANYBODY/pair_eim.h"
|
||||||
#include "info.h"
|
#include "info.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
@ -18,7 +19,6 @@
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "../testing/core.h"
|
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <mpi.h>
|
#include <mpi.h>
|
||||||
@ -39,7 +39,7 @@ protected:
|
|||||||
testbinary = "EIMPotentialFileReaderTest";
|
testbinary = "EIMPotentialFileReaderTest";
|
||||||
LAMMPSTest::SetUp();
|
LAMMPSTest::SetUp();
|
||||||
ASSERT_NE(lmp, nullptr);
|
ASSERT_NE(lmp, nullptr);
|
||||||
|
|
||||||
BEGIN_HIDE_OUTPUT();
|
BEGIN_HIDE_OUTPUT();
|
||||||
command("units metal");
|
command("units metal");
|
||||||
END_HIDE_OUTPUT();
|
END_HIDE_OUTPUT();
|
||||||
|
|||||||
@ -56,13 +56,15 @@ protected:
|
|||||||
out.open("file_with_long_lines_test.txt", std::ios_base::out | std::ios_base::binary);
|
out.open("file_with_long_lines_test.txt", std::ios_base::out | std::ios_base::binary);
|
||||||
ASSERT_TRUE(out.good());
|
ASSERT_TRUE(out.good());
|
||||||
out << "zero ##########################################################"
|
out << "zero ##########################################################"
|
||||||
"##################################################################"
|
"##################################################################"
|
||||||
"##################################################################"
|
"##################################################################"
|
||||||
"############################################################\n";
|
"############################################################\n";
|
||||||
out << "one line\ntwo_lines\n\n";
|
out << "one line\ntwo_lines\n\n";
|
||||||
for (int i = 0; i < 100; ++i) out << "one two ";
|
for (int i = 0; i < 100; ++i)
|
||||||
|
out << "one two ";
|
||||||
out << "\nthree\nfour five #";
|
out << "\nthree\nfour five #";
|
||||||
for (int i = 0; i < 1000; ++i) out << '#';
|
for (int i = 0; i < 1000; ++i)
|
||||||
|
out << '#';
|
||||||
out.close();
|
out.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,7 +76,7 @@ protected:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr int MAX_BUF_SIZE=128;
|
static constexpr int MAX_BUF_SIZE = 128;
|
||||||
|
|
||||||
TEST_F(FileOperationsTest, safe_fgets)
|
TEST_F(FileOperationsTest, safe_fgets)
|
||||||
{
|
{
|
||||||
@ -123,51 +125,51 @@ TEST_F(FileOperationsTest, fgets_trunc)
|
|||||||
memset(buf, 0, MAX_BUF_SIZE);
|
memset(buf, 0, MAX_BUF_SIZE);
|
||||||
ptr = utils::fgets_trunc(buf, MAX_BUF_SIZE, fp);
|
ptr = utils::fgets_trunc(buf, MAX_BUF_SIZE, fp);
|
||||||
ASSERT_THAT(buf, StrEq("one line\n"));
|
ASSERT_THAT(buf, StrEq("one line\n"));
|
||||||
ASSERT_NE(ptr,nullptr);
|
ASSERT_NE(ptr, nullptr);
|
||||||
|
|
||||||
// read line of exactly the buffer length
|
// read line of exactly the buffer length
|
||||||
memset(buf, 0, MAX_BUF_SIZE);
|
memset(buf, 0, MAX_BUF_SIZE);
|
||||||
ptr = utils::fgets_trunc(buf, sizeof("two_lines\n"), fp);
|
ptr = utils::fgets_trunc(buf, sizeof("two_lines\n"), fp);
|
||||||
ASSERT_THAT(buf, StrEq("two_lines\n"));
|
ASSERT_THAT(buf, StrEq("two_lines\n"));
|
||||||
ASSERT_NE(ptr,nullptr);
|
ASSERT_NE(ptr, nullptr);
|
||||||
|
|
||||||
memset(buf, 0, MAX_BUF_SIZE);
|
memset(buf, 0, MAX_BUF_SIZE);
|
||||||
ptr = utils::fgets_trunc(buf, MAX_BUF_SIZE, fp);
|
ptr = utils::fgets_trunc(buf, MAX_BUF_SIZE, fp);
|
||||||
ASSERT_THAT(buf, StrEq("\n"));
|
ASSERT_THAT(buf, StrEq("\n"));
|
||||||
ASSERT_NE(ptr,nullptr);
|
ASSERT_NE(ptr, nullptr);
|
||||||
|
|
||||||
memset(buf, 0, MAX_BUF_SIZE);
|
memset(buf, 0, MAX_BUF_SIZE);
|
||||||
ptr = utils::fgets_trunc(buf, 4, fp);
|
ptr = utils::fgets_trunc(buf, 4, fp);
|
||||||
ASSERT_THAT(buf, StrEq("no\n"));
|
ASSERT_THAT(buf, StrEq("no\n"));
|
||||||
ASSERT_NE(ptr,nullptr);
|
ASSERT_NE(ptr, nullptr);
|
||||||
|
|
||||||
ptr = utils::fgets_trunc(buf, MAX_BUF_SIZE, fp);
|
ptr = utils::fgets_trunc(buf, MAX_BUF_SIZE, fp);
|
||||||
ASSERT_EQ(ptr,nullptr);
|
ASSERT_EQ(ptr, nullptr);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
fp = fopen("file_with_long_lines_test.txt", "r");
|
fp = fopen("file_with_long_lines_test.txt", "r");
|
||||||
ASSERT_NE(fp,nullptr);
|
ASSERT_NE(fp, nullptr);
|
||||||
|
|
||||||
memset(buf, 0, MAX_BUF_SIZE);
|
memset(buf, 0, MAX_BUF_SIZE);
|
||||||
ptr = utils::fgets_trunc(buf, MAX_BUF_SIZE, fp);
|
ptr = utils::fgets_trunc(buf, MAX_BUF_SIZE, fp);
|
||||||
ASSERT_NE(ptr,nullptr);
|
ASSERT_NE(ptr, nullptr);
|
||||||
ASSERT_THAT(buf, StrEq("zero ##########################################################"
|
ASSERT_THAT(buf, StrEq("zero ##########################################################"
|
||||||
"###############################################################\n"));
|
"###############################################################\n"));
|
||||||
|
|
||||||
ptr = utils::fgets_trunc(buf, MAX_BUF_SIZE, fp);
|
ptr = utils::fgets_trunc(buf, MAX_BUF_SIZE, fp);
|
||||||
ASSERT_THAT(buf, StrEq("one line\n"));
|
ASSERT_THAT(buf, StrEq("one line\n"));
|
||||||
ASSERT_NE(ptr,nullptr);
|
ASSERT_NE(ptr, nullptr);
|
||||||
|
|
||||||
ptr = utils::fgets_trunc(buf, MAX_BUF_SIZE, fp);
|
ptr = utils::fgets_trunc(buf, MAX_BUF_SIZE, fp);
|
||||||
ASSERT_THAT(buf, StrEq("two_lines\n"));
|
ASSERT_THAT(buf, StrEq("two_lines\n"));
|
||||||
ASSERT_NE(ptr,nullptr);
|
ASSERT_NE(ptr, nullptr);
|
||||||
|
|
||||||
ptr = utils::fgets_trunc(buf, MAX_BUF_SIZE, fp);
|
ptr = utils::fgets_trunc(buf, MAX_BUF_SIZE, fp);
|
||||||
ASSERT_THAT(buf, StrEq("\n"));
|
ASSERT_THAT(buf, StrEq("\n"));
|
||||||
ASSERT_NE(ptr,nullptr);
|
ASSERT_NE(ptr, nullptr);
|
||||||
|
|
||||||
ptr = utils::fgets_trunc(buf, MAX_BUF_SIZE, fp);
|
ptr = utils::fgets_trunc(buf, MAX_BUF_SIZE, fp);
|
||||||
ASSERT_NE(ptr,nullptr);
|
ASSERT_NE(ptr, nullptr);
|
||||||
ASSERT_THAT(buf, StrEq("one two one two one two one two one two one two one two one two "
|
ASSERT_THAT(buf, StrEq("one two one two one two one two one two one two one two one two "
|
||||||
"one two one two one two one two one two one two one two one tw\n"));
|
"one two one two one two one two one two one two one two one tw\n"));
|
||||||
|
|
||||||
@ -286,8 +288,7 @@ TEST_F(FileOperationsTest, error_all_one)
|
|||||||
command("echo none");
|
command("echo none");
|
||||||
command("log none");
|
command("log none");
|
||||||
END_HIDE_OUTPUT();
|
END_HIDE_OUTPUT();
|
||||||
TEST_FAILURE(".*ERROR: exit \\(testme.cpp:10\\).*",
|
TEST_FAILURE(".*ERROR: exit \\(testme.cpp:10\\).*", lmp->error->all("testme.cpp", 10, "exit"););
|
||||||
lmp->error->all("testme.cpp", 10, "exit"););
|
|
||||||
TEST_FAILURE(".*ERROR: exit too \\(testme.cpp:10\\).*",
|
TEST_FAILURE(".*ERROR: exit too \\(testme.cpp:10\\).*",
|
||||||
lmp->error->all("testme.cpp", 10, "exit {}", "too"););
|
lmp->error->all("testme.cpp", 10, "exit {}", "too"););
|
||||||
TEST_FAILURE(".*ERROR: argument not found \\(testme.cpp:10\\).*",
|
TEST_FAILURE(".*ERROR: argument not found \\(testme.cpp:10\\).*",
|
||||||
|
|||||||
@ -11,11 +11,11 @@
|
|||||||
See the README file in the top-level LAMMPS directory.
|
See the README file in the top-level LAMMPS directory.
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#include "../testing/core.h"
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "../testing/core.h"
|
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|||||||
@ -11,6 +11,7 @@
|
|||||||
See the README file in the top-level LAMMPS directory.
|
See the README file in the top-level LAMMPS directory.
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#include "../testing/core.h"
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "info.h"
|
#include "info.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
@ -19,7 +20,6 @@
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "../testing/core.h"
|
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <mpi.h>
|
#include <mpi.h>
|
||||||
@ -34,8 +34,7 @@ using utils::split_words;
|
|||||||
|
|
||||||
#define test_name test_info_->name()
|
#define test_name test_info_->name()
|
||||||
|
|
||||||
|
static void create_molecule_files(const std::string &h2o_filename, const std::string &co2_filename)
|
||||||
static void create_molecule_files(const std::string & h2o_filename, const std::string & co2_filename)
|
|
||||||
{
|
{
|
||||||
// create molecule files
|
// create molecule files
|
||||||
const char h2o_file[] = "# Water molecule. SPC/E model.\n\n3 atoms\n2 bonds\n1 angles\n\n"
|
const char h2o_file[] = "# Water molecule. SPC/E model.\n\n3 atoms\n2 bonds\n1 angles\n\n"
|
||||||
@ -77,11 +76,10 @@ bool verbose = false;
|
|||||||
|
|
||||||
class MoleculeFileTest : public LAMMPSTest {
|
class MoleculeFileTest : public LAMMPSTest {
|
||||||
protected:
|
protected:
|
||||||
static void SetUpTestSuite() {
|
static void SetUpTestSuite() { create_molecule_files("moltest.h2o.mol", "moltest.co2.mol"); }
|
||||||
create_molecule_files("moltest.h2o.mol", "moltest.co2.mol");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void TearDownTestSuite() {
|
static void TearDownTestSuite()
|
||||||
|
{
|
||||||
remove("moltest.h2o.mol");
|
remove("moltest.h2o.mol");
|
||||||
remove("moltest.co2.mol");
|
remove("moltest.co2.mol");
|
||||||
}
|
}
|
||||||
@ -93,10 +91,7 @@ protected:
|
|||||||
ASSERT_NE(lmp, nullptr);
|
ASSERT_NE(lmp, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TearDown() override
|
void TearDown() override { LAMMPSTest::TearDown(); }
|
||||||
{
|
|
||||||
LAMMPSTest::TearDown();
|
|
||||||
}
|
|
||||||
|
|
||||||
void run_mol_cmd(const std::string &name, const std::string &args, const std::string &content)
|
void run_mol_cmd(const std::string &name, const std::string &args, const std::string &content)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -11,6 +11,7 @@
|
|||||||
See the README file in the top-level LAMMPS directory.
|
See the README file in the top-level LAMMPS directory.
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#include "../testing/core.h"
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "force.h"
|
#include "force.h"
|
||||||
#include "info.h"
|
#include "info.h"
|
||||||
@ -20,7 +21,6 @@
|
|||||||
#include "thermo.h"
|
#include "thermo.h"
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "../testing/core.h"
|
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|||||||
@ -20,9 +20,9 @@
|
|||||||
#include "MANYBODY/pair_tersoff.h"
|
#include "MANYBODY/pair_tersoff.h"
|
||||||
#include "MANYBODY/pair_tersoff_mod.h"
|
#include "MANYBODY/pair_tersoff_mod.h"
|
||||||
#include "MANYBODY/pair_tersoff_mod_c.h"
|
#include "MANYBODY/pair_tersoff_mod_c.h"
|
||||||
|
#include "MANYBODY/pair_tersoff_table.h"
|
||||||
#include "MANYBODY/pair_tersoff_zbl.h"
|
#include "MANYBODY/pair_tersoff_zbl.h"
|
||||||
#include "MANYBODY/pair_vashishta.h"
|
#include "MANYBODY/pair_vashishta.h"
|
||||||
#include "MANYBODY/pair_tersoff_table.h"
|
|
||||||
#include "info.h"
|
#include "info.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "potential_file_reader.h"
|
#include "potential_file_reader.h"
|
||||||
@ -318,7 +318,7 @@ TEST_F(OpenPotentialTest, No_file)
|
|||||||
command("units metal");
|
command("units metal");
|
||||||
FILE *fp = utils::open_potential("Unknown.sw", lmp, &convert_flag);
|
FILE *fp = utils::open_potential("Unknown.sw", lmp, &convert_flag);
|
||||||
END_HIDE_OUTPUT();
|
END_HIDE_OUTPUT();
|
||||||
ASSERT_EQ(fp,nullptr);
|
ASSERT_EQ(fp, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
|
|||||||
@ -78,18 +78,17 @@ TEST_F(TextFileReaderTest, permissions)
|
|||||||
|
|
||||||
TEST_F(TextFileReaderTest, nofp)
|
TEST_F(TextFileReaderTest, nofp)
|
||||||
{
|
{
|
||||||
ASSERT_THROW({ TextFileReader reader(nullptr, "test"); },
|
ASSERT_THROW({ TextFileReader reader(nullptr, "test"); }, FileReaderException);
|
||||||
FileReaderException);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(TextFileReaderTest, usefp)
|
TEST_F(TextFileReaderTest, usefp)
|
||||||
{
|
{
|
||||||
test_files();
|
test_files();
|
||||||
FILE *fp = fopen("text_reader_two.file","r");
|
FILE *fp = fopen("text_reader_two.file", "r");
|
||||||
ASSERT_NE(fp,nullptr);
|
ASSERT_NE(fp, nullptr);
|
||||||
|
|
||||||
auto reader = new TextFileReader(fp, "test");
|
auto reader = new TextFileReader(fp, "test");
|
||||||
auto line = reader->next_line();
|
auto line = reader->next_line();
|
||||||
ASSERT_STREQ(line, "4 ");
|
ASSERT_STREQ(line, "4 ");
|
||||||
line = reader->next_line(1);
|
line = reader->next_line(1);
|
||||||
ASSERT_STREQ(line, "4 0.5 ");
|
ASSERT_STREQ(line, "4 0.5 ");
|
||||||
@ -100,14 +99,14 @@ TEST_F(TextFileReaderTest, usefp)
|
|||||||
ASSERT_STREQ(values.next_string().c_str(), "1.5");
|
ASSERT_STREQ(values.next_string().c_str(), "1.5");
|
||||||
ASSERT_NE(reader->next_line(), nullptr);
|
ASSERT_NE(reader->next_line(), nullptr);
|
||||||
double data[20];
|
double data[20];
|
||||||
ASSERT_THROW({ reader->next_dvector(data,20); }, FileReaderException);
|
ASSERT_THROW({ reader->next_dvector(data, 20); }, FileReaderException);
|
||||||
ASSERT_THROW({ reader->skip_line(); }, EOFException);
|
ASSERT_THROW({ reader->skip_line(); }, EOFException);
|
||||||
ASSERT_EQ(reader->next_line(), nullptr);
|
ASSERT_EQ(reader->next_line(), nullptr);
|
||||||
delete reader;
|
delete reader;
|
||||||
|
|
||||||
// check that we reached EOF and the destructor didn't close the file.
|
// check that we reached EOF and the destructor didn't close the file.
|
||||||
ASSERT_EQ(feof(fp),1);
|
ASSERT_EQ(feof(fp), 1);
|
||||||
ASSERT_EQ(fclose(fp),0);
|
ASSERT_EQ(fclose(fp), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(TextFileReaderTest, comments)
|
TEST_F(TextFileReaderTest, comments)
|
||||||
@ -126,7 +125,7 @@ TEST_F(TextFileReaderTest, comments)
|
|||||||
ASSERT_STREQ(values.next_string().c_str(), "1.5");
|
ASSERT_STREQ(values.next_string().c_str(), "1.5");
|
||||||
ASSERT_NE(reader.next_line(), nullptr);
|
ASSERT_NE(reader.next_line(), nullptr);
|
||||||
double data[20];
|
double data[20];
|
||||||
ASSERT_THROW({ reader.next_dvector(data,20); }, FileReaderException);
|
ASSERT_THROW({ reader.next_dvector(data, 20); }, FileReaderException);
|
||||||
ASSERT_THROW({ reader.skip_line(); }, EOFException);
|
ASSERT_THROW({ reader.skip_line(); }, EOFException);
|
||||||
ASSERT_EQ(reader.next_line(), nullptr);
|
ASSERT_EQ(reader.next_line(), nullptr);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,15 +14,15 @@
|
|||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "info.h"
|
#include "info.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "variable.h"
|
|
||||||
#include "library.h"
|
#include "library.h"
|
||||||
|
#include "variable.h"
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <vector>
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "../testing/core.h"
|
#include "../testing/core.h"
|
||||||
#include "../testing/systems/melt.h"
|
#include "../testing/systems/melt.h"
|
||||||
@ -32,16 +32,17 @@
|
|||||||
#define XSTR(val) #val
|
#define XSTR(val) #val
|
||||||
std::string INPUT_FOLDER = STRINGIFY(TEST_INPUT_FOLDER);
|
std::string INPUT_FOLDER = STRINGIFY(TEST_INPUT_FOLDER);
|
||||||
|
|
||||||
const char * LOREM_IPSUM = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent metus.";
|
const char *LOREM_IPSUM =
|
||||||
|
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent metus.";
|
||||||
bool verbose = false;
|
bool verbose = false;
|
||||||
|
|
||||||
using LAMMPS_NS::utils::split_words;
|
using LAMMPS_NS::utils::split_words;
|
||||||
|
|
||||||
namespace LAMMPS_NS {
|
namespace LAMMPS_NS {
|
||||||
using ::testing::MatchesRegex;
|
|
||||||
using ::testing::StrEq;
|
|
||||||
using ::testing::Eq;
|
using ::testing::Eq;
|
||||||
using ::testing::HasSubstr;
|
using ::testing::HasSubstr;
|
||||||
|
using ::testing::MatchesRegex;
|
||||||
|
using ::testing::StrEq;
|
||||||
|
|
||||||
class PythonPackageTest : public LAMMPSTest {
|
class PythonPackageTest : public LAMMPSTest {
|
||||||
protected:
|
protected:
|
||||||
@ -115,7 +116,8 @@ TEST_F(PythonPackageTest, InvokeFunctionPassString)
|
|||||||
// execute python function, passing string as argument
|
// execute python function, passing string as argument
|
||||||
HIDE_OUTPUT([&] {
|
HIDE_OUTPUT([&] {
|
||||||
command("variable val python bool_to_val");
|
command("variable val python bool_to_val");
|
||||||
command("python bool_to_val input 1 \"true\" format sf return v_val file ${input_dir}/func.py");
|
command(
|
||||||
|
"python bool_to_val input 1 \"true\" format sf return v_val file ${input_dir}/func.py");
|
||||||
});
|
});
|
||||||
|
|
||||||
ASSERT_EQ(get_variable_value("val"), 1.0);
|
ASSERT_EQ(get_variable_value("val"), 1.0);
|
||||||
@ -126,7 +128,8 @@ TEST_F(PythonPackageTest, InvokeFunctionPassStringVariable)
|
|||||||
// execute python function, passing string variable as argument
|
// execute python function, passing string variable as argument
|
||||||
HIDE_OUTPUT([&] {
|
HIDE_OUTPUT([&] {
|
||||||
command("variable val python bool_to_val");
|
command("variable val python bool_to_val");
|
||||||
command("python bool_to_val input 1 v_str format sf return v_val file ${input_dir}/func.py");
|
command(
|
||||||
|
"python bool_to_val input 1 v_str format sf return v_val file ${input_dir}/func.py");
|
||||||
});
|
});
|
||||||
|
|
||||||
HIDE_OUTPUT([&] {
|
HIDE_OUTPUT([&] {
|
||||||
@ -147,7 +150,8 @@ TEST_F(PythonPackageTest, InvokeStringFunction)
|
|||||||
// execute python function, passing string variable as argument
|
// execute python function, passing string variable as argument
|
||||||
HIDE_OUTPUT([&] {
|
HIDE_OUTPUT([&] {
|
||||||
command("variable str python val_to_bool");
|
command("variable str python val_to_bool");
|
||||||
command("python val_to_bool input 1 v_val format is return v_str file ${input_dir}/func.py");
|
command(
|
||||||
|
"python val_to_bool input 1 v_val format is return v_str file ${input_dir}/func.py");
|
||||||
});
|
});
|
||||||
|
|
||||||
HIDE_OUTPUT([&] {
|
HIDE_OUTPUT([&] {
|
||||||
@ -264,8 +268,7 @@ TEST_F(PythonPackageTest, RunSourceInline)
|
|||||||
command("python xyz source \"\"\"\n"
|
command("python xyz source \"\"\"\n"
|
||||||
"from __future__ import print_function\n"
|
"from __future__ import print_function\n"
|
||||||
"print(2+2)\n"
|
"print(2+2)\n"
|
||||||
"\"\"\""
|
"\"\"\"");
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
ASSERT_THAT(output, HasSubstr("4"));
|
ASSERT_THAT(output, HasSubstr("4"));
|
||||||
@ -287,9 +290,9 @@ TEST_F(FixPythonInvokeTest, end_of_step)
|
|||||||
});
|
});
|
||||||
|
|
||||||
auto lines = utils::split_lines(output);
|
auto lines = utils::split_lines(output);
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
for(auto & line : lines) {
|
for (auto &line : lines) {
|
||||||
if (line == "PYTHON_END_OF_STEP") ++count;
|
if (line == "PYTHON_END_OF_STEP") ++count;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -312,9 +315,9 @@ TEST_F(FixPythonInvokeTest, post_force)
|
|||||||
});
|
});
|
||||||
|
|
||||||
auto lines = utils::split_lines(output);
|
auto lines = utils::split_lines(output);
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
for(auto & line : lines) {
|
for (auto &line : lines) {
|
||||||
if (line == "PYTHON_POST_FORCE") ++count;
|
if (line == "PYTHON_POST_FORCE") ++count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -13,38 +13,37 @@
|
|||||||
#ifndef TESTING_CORE__H
|
#ifndef TESTING_CORE__H
|
||||||
#define TESTING_CORE__H
|
#define TESTING_CORE__H
|
||||||
|
|
||||||
|
#include "exceptions.h"
|
||||||
#include "info.h"
|
#include "info.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "lammps.h"
|
#include "lammps.h"
|
||||||
#include "variable.h"
|
#include "variable.h"
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "exceptions.h"
|
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <vector>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
using ::testing::MatchesRegex;
|
using ::testing::MatchesRegex;
|
||||||
|
|
||||||
#define TEST_FAILURE(errmsg, ...) \
|
#define TEST_FAILURE(errmsg, ...) \
|
||||||
if (Info::has_exceptions()) { \
|
if (Info::has_exceptions()) { \
|
||||||
::testing::internal::CaptureStdout(); \
|
::testing::internal::CaptureStdout(); \
|
||||||
ASSERT_ANY_THROW({__VA_ARGS__}); \
|
ASSERT_ANY_THROW({__VA_ARGS__}); \
|
||||||
auto mesg = ::testing::internal::GetCapturedStdout(); \
|
auto mesg = ::testing::internal::GetCapturedStdout(); \
|
||||||
ASSERT_THAT(mesg, MatchesRegex(errmsg)); \
|
ASSERT_THAT(mesg, MatchesRegex(errmsg)); \
|
||||||
} else { \
|
} else { \
|
||||||
if (Info::get_mpi_vendor() != "Open MPI") { \
|
if (Info::get_mpi_vendor() != "Open MPI") { \
|
||||||
::testing::internal::CaptureStdout(); \
|
::testing::internal::CaptureStdout(); \
|
||||||
ASSERT_DEATH({__VA_ARGS__}, ""); \
|
ASSERT_DEATH({__VA_ARGS__}, ""); \
|
||||||
auto mesg = ::testing::internal::GetCapturedStdout(); \
|
auto mesg = ::testing::internal::GetCapturedStdout(); \
|
||||||
ASSERT_THAT(mesg, MatchesRegex(errmsg)); \
|
ASSERT_THAT(mesg, MatchesRegex(errmsg)); \
|
||||||
} \
|
} else { \
|
||||||
else { \
|
std::cerr << "[ ] [ INFO ] Skipping death test (no exception support) \n"; \
|
||||||
std::cerr << "[ ] [ INFO ] Skipping death test (no exception support) \n"; \
|
} \
|
||||||
} \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// whether to print verbose output (i.e. not capturing LAMMPS screen output).
|
// whether to print verbose output (i.e. not capturing LAMMPS screen output).
|
||||||
@ -54,40 +53,43 @@ class LAMMPSTest : public ::testing::Test {
|
|||||||
public:
|
public:
|
||||||
void command(const std::string &line) { lmp->input->one(line.c_str()); }
|
void command(const std::string &line) { lmp->input->one(line.c_str()); }
|
||||||
|
|
||||||
void BEGIN_HIDE_OUTPUT() {
|
void BEGIN_HIDE_OUTPUT()
|
||||||
|
{
|
||||||
if (!verbose) ::testing::internal::CaptureStdout();
|
if (!verbose) ::testing::internal::CaptureStdout();
|
||||||
}
|
}
|
||||||
|
|
||||||
void END_HIDE_OUTPUT() {
|
void END_HIDE_OUTPUT()
|
||||||
|
{
|
||||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BEGIN_CAPTURE_OUTPUT() {
|
void BEGIN_CAPTURE_OUTPUT() { ::testing::internal::CaptureStdout(); }
|
||||||
::testing::internal::CaptureStdout();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string END_CAPTURE_OUTPUT() {
|
std::string END_CAPTURE_OUTPUT()
|
||||||
|
{
|
||||||
auto output = ::testing::internal::GetCapturedStdout();
|
auto output = ::testing::internal::GetCapturedStdout();
|
||||||
if (verbose) std::cout << output;
|
if (verbose) std::cout << output;
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HIDE_OUTPUT(std::function<void()> f) {
|
void HIDE_OUTPUT(std::function<void()> f)
|
||||||
|
{
|
||||||
if (!verbose) ::testing::internal::CaptureStdout();
|
if (!verbose) ::testing::internal::CaptureStdout();
|
||||||
try {
|
try {
|
||||||
f();
|
f();
|
||||||
} catch(LAMMPSException & e) {
|
} catch (LAMMPSException &e) {
|
||||||
if (!verbose) std::cout << ::testing::internal::GetCapturedStdout();
|
if (!verbose) std::cout << ::testing::internal::GetCapturedStdout();
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CAPTURE_OUTPUT(std::function<void()> f) {
|
std::string CAPTURE_OUTPUT(std::function<void()> f)
|
||||||
|
{
|
||||||
::testing::internal::CaptureStdout();
|
::testing::internal::CaptureStdout();
|
||||||
try {
|
try {
|
||||||
f();
|
f();
|
||||||
} catch(LAMMPSException & e) {
|
} catch (LAMMPSException &e) {
|
||||||
if (verbose) std::cout << ::testing::internal::GetCapturedStdout();
|
if (verbose) std::cout << ::testing::internal::GetCapturedStdout();
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
@ -96,43 +98,45 @@ public:
|
|||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
double get_variable_value(const std::string & name) {
|
double get_variable_value(const std::string &name)
|
||||||
char * str = utils::strdup(fmt::format("v_{}", name));
|
{
|
||||||
|
char *str = utils::strdup(fmt::format("v_{}", name));
|
||||||
double value = lmp->input->variable->compute_equal(str);
|
double value = lmp->input->variable->compute_equal(str);
|
||||||
delete [] str;
|
delete[] str;
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string get_variable_string(const std::string & name) {
|
std::string get_variable_string(const std::string &name)
|
||||||
|
{
|
||||||
return lmp->input->variable->retrieve(name.c_str());
|
return lmp->input->variable->retrieve(name.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string testbinary = "LAMMPSTest";
|
std::string testbinary = "LAMMPSTest";
|
||||||
std::vector<std::string> args = {"-log", "none", "-echo", "screen", "-nocite"};
|
std::vector<std::string> args = {"-log", "none", "-echo", "screen", "-nocite"};
|
||||||
LAMMPS *lmp;
|
LAMMPS *lmp;
|
||||||
Info *info;
|
Info *info;
|
||||||
|
|
||||||
void SetUp() override
|
void SetUp() override
|
||||||
{
|
{
|
||||||
int argc = args.size() + 1;
|
int argc = args.size() + 1;
|
||||||
char ** argv = new char*[argc];
|
char **argv = new char *[argc];
|
||||||
argv[0] = utils::strdup(testbinary);
|
argv[0] = utils::strdup(testbinary);
|
||||||
for(int i = 1; i < argc; i++) {
|
for (int i = 1; i < argc; i++) {
|
||||||
argv[i] = utils::strdup(args[i-1]);
|
argv[i] = utils::strdup(args[i - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
HIDE_OUTPUT([&] {
|
HIDE_OUTPUT([&] {
|
||||||
lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD);
|
lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD);
|
||||||
info = new Info(lmp);
|
info = new Info(lmp);
|
||||||
});
|
});
|
||||||
InitSystem();
|
InitSystem();
|
||||||
|
|
||||||
for(int i = 0; i < argc; i++) {
|
for (int i = 0; i < argc; i++) {
|
||||||
delete [] argv[i];
|
delete[] argv[i];
|
||||||
argv[i] = nullptr;
|
argv[i] = nullptr;
|
||||||
}
|
}
|
||||||
delete [] argv;
|
delete[] argv;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void InitSystem() {}
|
virtual void InitSystem() {}
|
||||||
@ -143,7 +147,7 @@ protected:
|
|||||||
delete info;
|
delete info;
|
||||||
delete lmp;
|
delete lmp;
|
||||||
info = nullptr;
|
info = nullptr;
|
||||||
lmp = nullptr;
|
lmp = nullptr;
|
||||||
});
|
});
|
||||||
std::cout.flush();
|
std::cout.flush();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,78 +16,87 @@
|
|||||||
#include <deque>
|
#include <deque>
|
||||||
#include <mpi.h>
|
#include <mpi.h>
|
||||||
|
|
||||||
using ::testing::TestEventListener;
|
|
||||||
using ::testing::TestCase;
|
using ::testing::TestCase;
|
||||||
|
using ::testing::TestEventListener;
|
||||||
|
using ::testing::TestInfo;
|
||||||
|
using ::testing::TestPartResult;
|
||||||
using ::testing::TestSuite;
|
using ::testing::TestSuite;
|
||||||
using ::testing::UnitTest;
|
using ::testing::UnitTest;
|
||||||
using ::testing::TestPartResult;
|
|
||||||
using ::testing::TestInfo;
|
|
||||||
|
|
||||||
class MPIPrinter : public TestEventListener {
|
class MPIPrinter : public TestEventListener {
|
||||||
MPI_Comm comm;
|
MPI_Comm comm;
|
||||||
TestEventListener * default_listener;
|
TestEventListener *default_listener;
|
||||||
int me;
|
int me;
|
||||||
int nprocs;
|
int nprocs;
|
||||||
char * buffer;
|
char *buffer;
|
||||||
size_t buffer_size;
|
size_t buffer_size;
|
||||||
std::deque<TestPartResult> results;
|
std::deque<TestPartResult> results;
|
||||||
bool finalize_test;
|
bool finalize_test;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MPIPrinter(TestEventListener * default_listener) : default_listener(default_listener) {
|
MPIPrinter(TestEventListener *default_listener) : default_listener(default_listener)
|
||||||
|
{
|
||||||
comm = MPI_COMM_WORLD;
|
comm = MPI_COMM_WORLD;
|
||||||
MPI_Comm_rank(comm, &me);
|
MPI_Comm_rank(comm, &me);
|
||||||
MPI_Comm_size(comm, &nprocs);
|
MPI_Comm_size(comm, &nprocs);
|
||||||
buffer_size = 1024;
|
buffer_size = 1024;
|
||||||
buffer = new char[buffer_size];
|
buffer = new char[buffer_size];
|
||||||
finalize_test = false;
|
finalize_test = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
~MPIPrinter() override {
|
~MPIPrinter() override
|
||||||
|
{
|
||||||
delete default_listener;
|
delete default_listener;
|
||||||
default_listener = nullptr;
|
default_listener = nullptr;
|
||||||
|
|
||||||
delete [] buffer;
|
delete[] buffer;
|
||||||
buffer = nullptr;
|
buffer = nullptr;
|
||||||
buffer_size = 0;
|
buffer_size = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnTestProgramStart(const UnitTest& unit_test) override {
|
virtual void OnTestProgramStart(const UnitTest &unit_test) override
|
||||||
if(me == 0) default_listener->OnTestProgramStart(unit_test);
|
{
|
||||||
|
if (me == 0) default_listener->OnTestProgramStart(unit_test);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnTestIterationStart(const UnitTest& unit_test, int iteration) override {
|
virtual void OnTestIterationStart(const UnitTest &unit_test, int iteration) override
|
||||||
if(me == 0) default_listener->OnTestIterationStart(unit_test, iteration);
|
{
|
||||||
|
if (me == 0) default_listener->OnTestIterationStart(unit_test, iteration);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test) override {
|
virtual void OnEnvironmentsSetUpStart(const UnitTest &unit_test) override
|
||||||
if(me == 0) default_listener->OnEnvironmentsSetUpStart(unit_test);
|
{
|
||||||
|
if (me == 0) default_listener->OnEnvironmentsSetUpStart(unit_test);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnEnvironmentsSetUpEnd(const UnitTest& unit_test) override {
|
virtual void OnEnvironmentsSetUpEnd(const UnitTest &unit_test) override
|
||||||
if(me == 0) default_listener->OnEnvironmentsSetUpEnd(unit_test);
|
{
|
||||||
|
if (me == 0) default_listener->OnEnvironmentsSetUpEnd(unit_test);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnTestSuiteStart(const TestSuite& test_suite) override {
|
virtual void OnTestSuiteStart(const TestSuite &test_suite) override
|
||||||
if(me == 0) default_listener->OnTestSuiteStart(test_suite);
|
{
|
||||||
|
if (me == 0) default_listener->OnTestSuiteStart(test_suite);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Legacy API is deprecated but still available
|
// Legacy API is deprecated but still available
|
||||||
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
||||||
virtual void OnTestCaseStart(const TestCase& test_case) override {
|
virtual void OnTestCaseStart(const TestCase &test_case) override
|
||||||
if(me == 0) default_listener->OnTestSuiteStart(test_case);
|
{
|
||||||
|
if (me == 0) default_listener->OnTestSuiteStart(test_case);
|
||||||
}
|
}
|
||||||
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
||||||
|
|
||||||
|
virtual void OnTestStart(const TestInfo &test_info) override
|
||||||
virtual void OnTestStart(const TestInfo& test_info) override {
|
{
|
||||||
// Called before a test starts.
|
// Called before a test starts.
|
||||||
if(me == 0) default_listener->OnTestStart(test_info);
|
if (me == 0) default_listener->OnTestStart(test_info);
|
||||||
results.clear();
|
results.clear();
|
||||||
finalize_test = false;
|
finalize_test = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void OnTestPartResult(const TestPartResult &test_part_result) override
|
||||||
virtual void OnTestPartResult(const TestPartResult& test_part_result) override {
|
{
|
||||||
// Called after a failed assertion or a SUCCESS().
|
// Called after a failed assertion or a SUCCESS().
|
||||||
// test_part_result()
|
// test_part_result()
|
||||||
|
|
||||||
@ -98,52 +107,55 @@ public:
|
|||||||
std::istringstream msg(test_part_result.message());
|
std::istringstream msg(test_part_result.message());
|
||||||
std::string line;
|
std::string line;
|
||||||
|
|
||||||
while(std::getline(msg, line)) {
|
while (std::getline(msg, line)) {
|
||||||
proc_message << "[Rank " << me << "] " << line << std::endl;
|
proc_message << "[Rank " << me << "] " << line << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
results.push_back(TestPartResult(test_part_result.type(), test_part_result.file_name(), test_part_result.line_number(), proc_message.str().c_str()));
|
results.push_back(TestPartResult(test_part_result.type(), test_part_result.file_name(),
|
||||||
|
test_part_result.line_number(),
|
||||||
|
proc_message.str().c_str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnTestEnd(const TestInfo& test_info) override {
|
virtual void OnTestEnd(const TestInfo &test_info) override
|
||||||
|
{
|
||||||
// Called after a test ends.
|
// Called after a test ends.
|
||||||
MPI_Barrier(comm);
|
MPI_Barrier(comm);
|
||||||
|
|
||||||
// other procs send their test part results
|
// other procs send their test part results
|
||||||
if(me != 0) {
|
if (me != 0) {
|
||||||
int nresults = results.size();
|
int nresults = results.size();
|
||||||
MPI_Send(&nresults, 1, MPI_INT, 0, 0, comm);
|
MPI_Send(&nresults, 1, MPI_INT, 0, 0, comm);
|
||||||
|
|
||||||
for(auto& test_part_result : results) {
|
for (auto &test_part_result : results) {
|
||||||
|
|
||||||
int type = test_part_result.type();
|
int type = test_part_result.type();
|
||||||
MPI_Send(&type, 1, MPI_INT, 0, 0, comm);
|
MPI_Send(&type, 1, MPI_INT, 0, 0, comm);
|
||||||
|
|
||||||
const char * str = test_part_result.file_name();
|
const char *str = test_part_result.file_name();
|
||||||
int length = 0;
|
int length = 0;
|
||||||
if(str) length = strlen(str)+1;
|
if (str) length = strlen(str) + 1;
|
||||||
MPI_Send(&length, 1, MPI_INT, 0, 0, comm);
|
MPI_Send(&length, 1, MPI_INT, 0, 0, comm);
|
||||||
if(str) MPI_Send(str, length, MPI_CHAR, 0, 0, comm);
|
if (str) MPI_Send(str, length, MPI_CHAR, 0, 0, comm);
|
||||||
|
|
||||||
int lineno = test_part_result.line_number();
|
int lineno = test_part_result.line_number();
|
||||||
MPI_Send(&lineno, 1, MPI_INT, 0, 0, comm);
|
MPI_Send(&lineno, 1, MPI_INT, 0, 0, comm);
|
||||||
|
|
||||||
str = test_part_result.message();
|
str = test_part_result.message();
|
||||||
length = 0;
|
length = 0;
|
||||||
if(str) length = strlen(str)+1;
|
if (str) length = strlen(str) + 1;
|
||||||
MPI_Send(&length, 1, MPI_INT, 0, 0, comm);
|
MPI_Send(&length, 1, MPI_INT, 0, 0, comm);
|
||||||
if(str) MPI_Send(str, length, MPI_CHAR, 0, 0, comm);
|
if (str) MPI_Send(str, length, MPI_CHAR, 0, 0, comm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(me == 0) {
|
if (me == 0) {
|
||||||
// collect results from other procs
|
// collect results from other procs
|
||||||
for(int p = 1; p < nprocs; p++) {
|
for (int p = 1; p < nprocs; p++) {
|
||||||
int nresults = 0;
|
int nresults = 0;
|
||||||
MPI_Recv(&nresults, 1, MPI_INT, p, 0, comm, MPI_STATUS_IGNORE);
|
MPI_Recv(&nresults, 1, MPI_INT, p, 0, comm, MPI_STATUS_IGNORE);
|
||||||
|
|
||||||
for(int r = 0; r < nresults; r++) {
|
for (int r = 0; r < nresults; r++) {
|
||||||
|
|
||||||
int type;
|
int type;
|
||||||
MPI_Recv(&type, 1, MPI_INT, p, 0, comm, MPI_STATUS_IGNORE);
|
MPI_Recv(&type, 1, MPI_INT, p, 0, comm, MPI_STATUS_IGNORE);
|
||||||
@ -154,8 +166,8 @@ public:
|
|||||||
|
|
||||||
if (length > 0) {
|
if (length > 0) {
|
||||||
if (length > buffer_size) {
|
if (length > buffer_size) {
|
||||||
delete [] buffer;
|
delete[] buffer;
|
||||||
buffer = new char[length];
|
buffer = new char[length];
|
||||||
buffer_size = length;
|
buffer_size = length;
|
||||||
}
|
}
|
||||||
MPI_Recv(buffer, length, MPI_CHAR, p, 0, comm, MPI_STATUS_IGNORE);
|
MPI_Recv(buffer, length, MPI_CHAR, p, 0, comm, MPI_STATUS_IGNORE);
|
||||||
@ -170,15 +182,16 @@ public:
|
|||||||
|
|
||||||
if (length > 0) {
|
if (length > 0) {
|
||||||
if (length > buffer_size) {
|
if (length > buffer_size) {
|
||||||
delete [] buffer;
|
delete[] buffer;
|
||||||
buffer = new char[length];
|
buffer = new char[length];
|
||||||
buffer_size = length;
|
buffer_size = length;
|
||||||
}
|
}
|
||||||
MPI_Recv(buffer, length, MPI_CHAR, p, 0, comm, MPI_STATUS_IGNORE);
|
MPI_Recv(buffer, length, MPI_CHAR, p, 0, comm, MPI_STATUS_IGNORE);
|
||||||
message = std::string(buffer);
|
message = std::string(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
results.push_back(TestPartResult((TestPartResult::Type)type, file_name.c_str(), lineno, message.c_str()));
|
results.push_back(TestPartResult((TestPartResult::Type)type, file_name.c_str(),
|
||||||
|
lineno, message.c_str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,9 +199,9 @@ public:
|
|||||||
finalize_test = true;
|
finalize_test = true;
|
||||||
|
|
||||||
// add all failures
|
// add all failures
|
||||||
while(!results.empty()) {
|
while (!results.empty()) {
|
||||||
auto result = results.front();
|
auto result = results.front();
|
||||||
if(result.failed()) {
|
if (result.failed()) {
|
||||||
ADD_FAILURE_AT(result.file_name(), result.line_number()) << result.message();
|
ADD_FAILURE_AT(result.file_name(), result.line_number()) << result.message();
|
||||||
} else {
|
} else {
|
||||||
default_listener->OnTestPartResult(result);
|
default_listener->OnTestPartResult(result);
|
||||||
@ -200,29 +213,35 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnTestSuiteEnd(const TestSuite& test_suite) override {
|
virtual void OnTestSuiteEnd(const TestSuite &test_suite) override
|
||||||
if(me == 0) default_listener->OnTestSuiteEnd(test_suite);
|
{
|
||||||
|
if (me == 0) default_listener->OnTestSuiteEnd(test_suite);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
||||||
virtual void OnTestCaseEnd(const TestCase& test_case) override {
|
virtual void OnTestCaseEnd(const TestCase &test_case) override
|
||||||
if(me == 0) default_listener->OnTestCaseEnd(test_case);
|
{
|
||||||
|
if (me == 0) default_listener->OnTestCaseEnd(test_case);
|
||||||
}
|
}
|
||||||
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
||||||
|
|
||||||
virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test) override {
|
virtual void OnEnvironmentsTearDownStart(const UnitTest &unit_test) override
|
||||||
if(me == 0) default_listener->OnEnvironmentsTearDownStart(unit_test);
|
{
|
||||||
|
if (me == 0) default_listener->OnEnvironmentsTearDownStart(unit_test);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test) override {
|
virtual void OnEnvironmentsTearDownEnd(const UnitTest &unit_test) override
|
||||||
if(me == 0) default_listener->OnEnvironmentsTearDownEnd(unit_test);
|
{
|
||||||
|
if (me == 0) default_listener->OnEnvironmentsTearDownEnd(unit_test);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration) override {
|
virtual void OnTestIterationEnd(const UnitTest &unit_test, int iteration) override
|
||||||
if(me == 0) default_listener->OnTestIterationEnd(unit_test, iteration);
|
{
|
||||||
|
if (me == 0) default_listener->OnTestIterationEnd(unit_test, iteration);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnTestProgramEnd(const UnitTest& unit_test) override {
|
virtual void OnTestProgramEnd(const UnitTest &unit_test) override
|
||||||
if(me == 0) default_listener->OnTestProgramEnd(unit_test);
|
{
|
||||||
|
if (me == 0) default_listener->OnTestProgramEnd(unit_test);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -11,10 +11,10 @@
|
|||||||
See the README file in the top-level LAMMPS directory.
|
See the README file in the top-level LAMMPS directory.
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#include "mpitesting.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "mpitesting.h"
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <mpi.h>
|
#include <mpi.h>
|
||||||
@ -53,7 +53,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto & listeners = UnitTest::GetInstance()->listeners();
|
auto &listeners = UnitTest::GetInstance()->listeners();
|
||||||
|
|
||||||
// Remove default listener
|
// Remove default listener
|
||||||
auto default_listener = listeners.Release(listeners.default_result_printer());
|
auto default_listener = listeners.Release(listeners.default_result_printer());
|
||||||
|
|||||||
@ -71,6 +71,4 @@ static bool file_exists(const std::string &filename)
|
|||||||
#define ASSERT_FILE_NOT_EXISTS(NAME) ASSERT_FALSE(file_exists(NAME))
|
#define ASSERT_FILE_NOT_EXISTS(NAME) ASSERT_FALSE(file_exists(NAME))
|
||||||
#define ASSERT_FILE_EQUAL(FILE_A, FILE_B) ASSERT_TRUE(equal_lines(FILE_A, FILE_B))
|
#define ASSERT_FILE_EQUAL(FILE_A, FILE_B) ASSERT_TRUE(equal_lines(FILE_A, FILE_B))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -110,7 +110,7 @@ TEST(Tokenizer, copy_assignment)
|
|||||||
ASSERT_THAT(t.next(), Eq("word"));
|
ASSERT_THAT(t.next(), Eq("word"));
|
||||||
ASSERT_EQ(t.count(), 2);
|
ASSERT_EQ(t.count(), 2);
|
||||||
Tokenizer v = u;
|
Tokenizer v = u;
|
||||||
u = t;
|
u = t;
|
||||||
ASSERT_THAT(u.next(), Eq("test"));
|
ASSERT_THAT(u.next(), Eq("test"));
|
||||||
ASSERT_THAT(u.next(), Eq("word"));
|
ASSERT_THAT(u.next(), Eq("word"));
|
||||||
ASSERT_EQ(u.count(), 2);
|
ASSERT_EQ(u.count(), 2);
|
||||||
@ -265,7 +265,7 @@ TEST(ValueTokenizer, copy_assignment)
|
|||||||
ASSERT_THAT(t.next_string(), Eq("word"));
|
ASSERT_THAT(t.next_string(), Eq("word"));
|
||||||
ASSERT_EQ(t.count(), 2);
|
ASSERT_EQ(t.count(), 2);
|
||||||
ValueTokenizer v = u;
|
ValueTokenizer v = u;
|
||||||
u = t;
|
u = t;
|
||||||
ASSERT_THAT(u.next_string(), Eq("test"));
|
ASSERT_THAT(u.next_string(), Eq("test"));
|
||||||
ASSERT_THAT(u.next_string(), Eq("word"));
|
ASSERT_THAT(u.next_string(), Eq("word"));
|
||||||
ASSERT_EQ(u.count(), 2);
|
ASSERT_EQ(u.count(), 2);
|
||||||
|
|||||||
@ -478,17 +478,17 @@ TEST(Utils, strmatch_opt_char)
|
|||||||
{
|
{
|
||||||
ASSERT_TRUE(utils::strmatch("rigid", "^r?igid"));
|
ASSERT_TRUE(utils::strmatch("rigid", "^r?igid"));
|
||||||
ASSERT_TRUE(utils::strmatch("igid", "^r?igid"));
|
ASSERT_TRUE(utils::strmatch("igid", "^r?igid"));
|
||||||
ASSERT_TRUE(utils::strmatch("c_name","^[cfvid]2?_name"));
|
ASSERT_TRUE(utils::strmatch("c_name", "^[cfvid]2?_name"));
|
||||||
ASSERT_TRUE(utils::strmatch("f_name","^[cfvid]2?_name"));
|
ASSERT_TRUE(utils::strmatch("f_name", "^[cfvid]2?_name"));
|
||||||
ASSERT_TRUE(utils::strmatch("v_name","^[cfvid]2?_name"));
|
ASSERT_TRUE(utils::strmatch("v_name", "^[cfvid]2?_name"));
|
||||||
ASSERT_TRUE(utils::strmatch("i_name","^[cfvid]2?_name"));
|
ASSERT_TRUE(utils::strmatch("i_name", "^[cfvid]2?_name"));
|
||||||
ASSERT_TRUE(utils::strmatch("d_name","^[cfvid]2?_name"));
|
ASSERT_TRUE(utils::strmatch("d_name", "^[cfvid]2?_name"));
|
||||||
ASSERT_TRUE(utils::strmatch("i2_name","^[cfvid]2?_name"));
|
ASSERT_TRUE(utils::strmatch("i2_name", "^[cfvid]2?_name"));
|
||||||
ASSERT_TRUE(utils::strmatch("d2_name","^[cfvid]2?_name"));
|
ASSERT_TRUE(utils::strmatch("d2_name", "^[cfvid]2?_name"));
|
||||||
ASSERT_FALSE(utils::strmatch("d2name","^[cfvid]2?_name"));
|
ASSERT_FALSE(utils::strmatch("d2name", "^[cfvid]2?_name"));
|
||||||
ASSERT_FALSE(utils::strmatch("i1_name","^[cfvid]2?_name"));
|
ASSERT_FALSE(utils::strmatch("i1_name", "^[cfvid]2?_name"));
|
||||||
ASSERT_FALSE(utils::strmatch("V_name","^[cfvid]2?_name"));
|
ASSERT_FALSE(utils::strmatch("V_name", "^[cfvid]2?_name"));
|
||||||
ASSERT_FALSE(utils::strmatch("x_name","^[cfvid]2?_name"));
|
ASSERT_FALSE(utils::strmatch("x_name", "^[cfvid]2?_name"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Utils, strmatch_dot)
|
TEST(Utils, strmatch_dot)
|
||||||
|
|||||||
Reference in New Issue
Block a user