On Windows the Regex matcher for '.' does not match '\n'
Thus we have to use ContainsRegex instead of MatchesRegex
This commit is contained in:
@ -34,7 +34,6 @@ using LAMMPS_NS::utils::split_words;
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
using ::testing::ExitedWithCode;
|
||||
using ::testing::MatchesRegex;
|
||||
using ::testing::StrEq;
|
||||
|
||||
class GroupTest : public LAMMPSTest {
|
||||
|
||||
@ -33,7 +33,6 @@ bool verbose = false;
|
||||
using LAMMPS_NS::utils::split_words;
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
using ::testing::MatchesRegex;
|
||||
using ::testing::StrEq;
|
||||
|
||||
class KimCommandsTest : public LAMMPSTest {
|
||||
|
||||
@ -36,7 +36,7 @@ using LAMMPS_NS::utils::split_words;
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
using ::testing::ExitedWithCode;
|
||||
using ::testing::MatchesRegex;
|
||||
using ::testing::ContainsRegex;
|
||||
using ::testing::StrEq;
|
||||
|
||||
class LatticeRegionTest : public LAMMPSTest {
|
||||
@ -82,7 +82,7 @@ TEST_F(LatticeRegionTest, lattice_sc)
|
||||
BEGIN_CAPTURE_OUTPUT();
|
||||
command("lattice sc 1.0 spacing 1.5 2.0 3.0");
|
||||
auto output = END_CAPTURE_OUTPUT();
|
||||
ASSERT_THAT(output, MatchesRegex(".*Lattice spacing in x,y,z = 1.5.* 2.* 3.*"));
|
||||
ASSERT_THAT(output, ContainsRegex(".*Lattice spacing in x,y,z = 1.5.* 2.* 3.*"));
|
||||
|
||||
auto lattice = lmp->domain->lattice;
|
||||
ASSERT_EQ(lattice->xlattice, 1.5);
|
||||
@ -92,7 +92,7 @@ TEST_F(LatticeRegionTest, lattice_sc)
|
||||
BEGIN_CAPTURE_OUTPUT();
|
||||
command("lattice sc 2.0");
|
||||
output = END_CAPTURE_OUTPUT();
|
||||
ASSERT_THAT(output, MatchesRegex(".*Lattice spacing in x,y,z = 2.* 2.* 2.*"));
|
||||
ASSERT_THAT(output, ContainsRegex(".*Lattice spacing in x,y,z = 2.* 2.* 2.*"));
|
||||
|
||||
lattice = lmp->domain->lattice;
|
||||
ASSERT_EQ(lattice->style, Lattice::SC);
|
||||
|
||||
@ -32,7 +32,6 @@ bool verbose = false;
|
||||
using LAMMPS_NS::utils::split_words;
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
using ::testing::MatchesRegex;
|
||||
|
||||
#define GETIDX(i) lmp->atom->map(i)
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ using LAMMPS_NS::utils::split_words;
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
using ::testing::ExitedWithCode;
|
||||
using ::testing::MatchesRegex;
|
||||
using ::testing::ContainsRegex;
|
||||
using ::testing::StrEq;
|
||||
|
||||
class SimpleCommandsTest : public LAMMPSTest {
|
||||
@ -394,62 +394,62 @@ TEST_F(SimpleCommandsTest, Plugin)
|
||||
lmp->input->one(fmt::format(loadfmt, "hello"));
|
||||
auto text = ::testing::internal::GetCapturedStdout();
|
||||
if (verbose) std::cout << text;
|
||||
ASSERT_THAT(text, MatchesRegex(".*Loading plugin: Hello world command.*"));
|
||||
ASSERT_THAT(text, ContainsRegex(".*Loading plugin: Hello world command.*"));
|
||||
|
||||
::testing::internal::CaptureStdout();
|
||||
lmp->input->one(fmt::format(loadfmt, "xxx"));
|
||||
text = ::testing::internal::GetCapturedStdout();
|
||||
if (verbose) std::cout << text;
|
||||
ASSERT_THAT(text, MatchesRegex(".*Open of file .*xxx.* failed.*"));
|
||||
ASSERT_THAT(text, ContainsRegex(".*Open of file .*xxx.* failed.*"));
|
||||
|
||||
::testing::internal::CaptureStdout();
|
||||
lmp->input->one(fmt::format(loadfmt, "nve2"));
|
||||
text = ::testing::internal::GetCapturedStdout();
|
||||
if (verbose) std::cout << text;
|
||||
ASSERT_THAT(text, MatchesRegex(".*Loading plugin: NVE2 variant fix style.*"));
|
||||
ASSERT_THAT(text, ContainsRegex(".*Loading plugin: NVE2 variant fix style.*"));
|
||||
::testing::internal::CaptureStdout();
|
||||
lmp->input->one("plugin list");
|
||||
text = ::testing::internal::GetCapturedStdout();
|
||||
if (verbose) std::cout << text;
|
||||
ASSERT_THAT(text, MatchesRegex(".*1: command style plugin hello"
|
||||
ASSERT_THAT(text, ContainsRegex(".*1: command style plugin hello"
|
||||
".*2: fix style plugin nve2.*"));
|
||||
|
||||
::testing::internal::CaptureStdout();
|
||||
lmp->input->one(fmt::format(loadfmt, "hello"));
|
||||
text = ::testing::internal::GetCapturedStdout();
|
||||
if (verbose) std::cout << text;
|
||||
ASSERT_THAT(text, MatchesRegex(".*Ignoring load of command style hello: "
|
||||
ASSERT_THAT(text, ContainsRegex(".*Ignoring load of command style hello: "
|
||||
"must unload existing hello plugin.*"));
|
||||
|
||||
::testing::internal::CaptureStdout();
|
||||
lmp->input->one("plugin unload command hello");
|
||||
text = ::testing::internal::GetCapturedStdout();
|
||||
if (verbose) std::cout << text;
|
||||
ASSERT_THAT(text, MatchesRegex(".*Unloading command style hello.*"));
|
||||
ASSERT_THAT(text, ContainsRegex(".*Unloading command style hello.*"));
|
||||
|
||||
::testing::internal::CaptureStdout();
|
||||
lmp->input->one("plugin unload pair nve2");
|
||||
text = ::testing::internal::GetCapturedStdout();
|
||||
if (verbose) std::cout << text;
|
||||
ASSERT_THAT(text, MatchesRegex(".*Ignoring unload of pair style nve2: not from a plugin.*"));
|
||||
ASSERT_THAT(text, ContainsRegex(".*Ignoring unload of pair style nve2: not from a plugin.*"));
|
||||
|
||||
::testing::internal::CaptureStdout();
|
||||
lmp->input->one("plugin unload fix nve2");
|
||||
text = ::testing::internal::GetCapturedStdout();
|
||||
if (verbose) std::cout << text;
|
||||
ASSERT_THAT(text, MatchesRegex(".*Unloading fix style nve2.*"));
|
||||
ASSERT_THAT(text, ContainsRegex(".*Unloading fix style nve2.*"));
|
||||
|
||||
::testing::internal::CaptureStdout();
|
||||
lmp->input->one("plugin unload fix nve");
|
||||
text = ::testing::internal::GetCapturedStdout();
|
||||
if (verbose) std::cout << text;
|
||||
ASSERT_THAT(text, MatchesRegex(".*Ignoring unload of fix style nve: not from a plugin.*"));
|
||||
ASSERT_THAT(text, ContainsRegex(".*Ignoring unload of fix style nve: not from a plugin.*"));
|
||||
|
||||
::testing::internal::CaptureStdout();
|
||||
lmp->input->one("plugin list");
|
||||
text = ::testing::internal::GetCapturedStdout();
|
||||
if (verbose) std::cout << text;
|
||||
ASSERT_THAT(text, MatchesRegex(".*Currently loaded plugins.*"));
|
||||
ASSERT_THAT(text, ContainsRegex(".*Currently loaded plugins.*"));
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -495,8 +495,8 @@ TEST_F(SimpleCommandsTest, CiteMe)
|
||||
std::string text = END_CAPTURE_OUTPUT();
|
||||
|
||||
// find the two unique citations, but not the third
|
||||
ASSERT_THAT(text, MatchesRegex(".*one.*two.*"));
|
||||
ASSERT_THAT(text, Not(MatchesRegex(".*one.*two.*one.*")));
|
||||
ASSERT_THAT(text, ContainsRegex(".*one.*two.*"));
|
||||
ASSERT_THAT(text, Not(ContainsRegex(".*one.*two.*one.*")));
|
||||
|
||||
BEGIN_CAPTURE_OUTPUT();
|
||||
lmp->citeme->add("test citation one:\n 0\n");
|
||||
@ -507,8 +507,8 @@ TEST_F(SimpleCommandsTest, CiteMe)
|
||||
text = END_CAPTURE_OUTPUT();
|
||||
|
||||
// find the forth (only differs in long citation) and sixth added citation
|
||||
ASSERT_THAT(text, MatchesRegex(".*one.*three.*"));
|
||||
ASSERT_THAT(text, Not(MatchesRegex(".*two.*")));
|
||||
ASSERT_THAT(text, ContainsRegex(".*one.*three.*"));
|
||||
ASSERT_THAT(text, Not(ContainsRegex(".*two.*")));
|
||||
|
||||
BEGIN_CAPTURE_OUTPUT();
|
||||
lmp->citeme->add("test citation one:\n 1\n");
|
||||
@ -521,7 +521,7 @@ TEST_F(SimpleCommandsTest, CiteMe)
|
||||
text = END_CAPTURE_OUTPUT();
|
||||
|
||||
// no new citation. no CITE-CITE-CITE- lines
|
||||
ASSERT_THAT(text, Not(MatchesRegex(".*CITE-CITE-CITE-CITE.*")));
|
||||
ASSERT_THAT(text, Not(ContainsRegex(".*CITE-CITE-CITE-CITE.*")));
|
||||
}
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ using LAMMPS_NS::utils::split_words;
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
using ::testing::ExitedWithCode;
|
||||
using ::testing::MatchesRegex;
|
||||
using ::testing::ContainsRegex;
|
||||
using ::testing::StrEq;
|
||||
|
||||
class VariableTest : public LAMMPSTest {
|
||||
@ -394,58 +394,58 @@ TEST_F(VariableTest, IfCommand)
|
||||
BEGIN_CAPTURE_OUTPUT();
|
||||
command("if 1>0 then 'print \"bingo!\"'");
|
||||
auto text = END_CAPTURE_OUTPUT();
|
||||
ASSERT_THAT(text, MatchesRegex(".*bingo!.*"));
|
||||
ASSERT_THAT(text, ContainsRegex(".*bingo!.*"));
|
||||
|
||||
BEGIN_CAPTURE_OUTPUT();
|
||||
command("if 1>2 then 'print \"bingo!\"' else 'print \"nope?\"'");
|
||||
text = END_CAPTURE_OUTPUT();
|
||||
ASSERT_THAT(text, MatchesRegex(".*nope\?.*"));
|
||||
ASSERT_THAT(text, ContainsRegex(".*nope\?.*"));
|
||||
|
||||
BEGIN_CAPTURE_OUTPUT();
|
||||
command("if (1<=0) then 'print \"bingo!\"' else 'print \"nope?\"'");
|
||||
text = END_CAPTURE_OUTPUT();
|
||||
ASSERT_THAT(text, MatchesRegex(".*nope\?.*"));
|
||||
ASSERT_THAT(text, ContainsRegex(".*nope\?.*"));
|
||||
|
||||
BEGIN_CAPTURE_OUTPUT();
|
||||
command("if (-1.0e-1<0.0E+0)|^(1<0) then 'print \"bingo!\"'");
|
||||
text = END_CAPTURE_OUTPUT();
|
||||
ASSERT_THAT(text, MatchesRegex(".*bingo!.*"));
|
||||
ASSERT_THAT(text, ContainsRegex(".*bingo!.*"));
|
||||
|
||||
BEGIN_CAPTURE_OUTPUT();
|
||||
command("if (${one}==1.0)&&(2>=1) then 'print \"bingo!\"'");
|
||||
text = END_CAPTURE_OUTPUT();
|
||||
ASSERT_THAT(text, MatchesRegex(".*bingo!.*"));
|
||||
ASSERT_THAT(text, ContainsRegex(".*bingo!.*"));
|
||||
|
||||
BEGIN_CAPTURE_OUTPUT();
|
||||
command("if !((${one}!=1.0)||(2|^1)) then 'print \"missed\"' else 'print \"bingo!\"'");
|
||||
text = END_CAPTURE_OUTPUT();
|
||||
ASSERT_THAT(text, MatchesRegex(".*bingo!.*"));
|
||||
ASSERT_THAT(text, ContainsRegex(".*bingo!.*"));
|
||||
|
||||
BEGIN_CAPTURE_OUTPUT();
|
||||
command("if (1>=2)&&(0&&1) then 'print \"missed\"' else 'print \"bingo!\"'");
|
||||
text = END_CAPTURE_OUTPUT();
|
||||
ASSERT_THAT(text, MatchesRegex(".*bingo!.*"));
|
||||
ASSERT_THAT(text, ContainsRegex(".*bingo!.*"));
|
||||
|
||||
BEGIN_CAPTURE_OUTPUT();
|
||||
command("if !1 then 'print \"missed\"' else 'print \"bingo!\"'");
|
||||
text = END_CAPTURE_OUTPUT();
|
||||
ASSERT_THAT(text, MatchesRegex(".*bingo!.*"));
|
||||
ASSERT_THAT(text, ContainsRegex(".*bingo!.*"));
|
||||
|
||||
BEGIN_CAPTURE_OUTPUT();
|
||||
command("if !(a==b) then 'print \"bingo!\"'");
|
||||
text = END_CAPTURE_OUTPUT();
|
||||
ASSERT_THAT(text, MatchesRegex(".*bingo!.*"));
|
||||
ASSERT_THAT(text, ContainsRegex(".*bingo!.*"));
|
||||
|
||||
BEGIN_CAPTURE_OUTPUT();
|
||||
command("if x==x|^1==0 then 'print \"bingo!\"'");
|
||||
text = END_CAPTURE_OUTPUT();
|
||||
ASSERT_THAT(text, MatchesRegex(".*bingo!.*"));
|
||||
ASSERT_THAT(text, ContainsRegex(".*bingo!.*"));
|
||||
|
||||
BEGIN_CAPTURE_OUTPUT();
|
||||
command("if x!=x|^a!=b then 'print \"bingo!\"'");
|
||||
text = END_CAPTURE_OUTPUT();
|
||||
|
||||
ASSERT_THAT(text, MatchesRegex(".*bingo!.*"));
|
||||
ASSERT_THAT(text, ContainsRegex(".*bingo!.*"));
|
||||
|
||||
TEST_FAILURE(".*ERROR: Invalid Boolean syntax in if command.*",
|
||||
command("if () then 'print \"bingo!\"'"););
|
||||
|
||||
@ -17,7 +17,7 @@ bool verbose = false;
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
using ::testing::MatchesRegex;
|
||||
using ::testing::ContainsRegex;
|
||||
using utils::split_words;
|
||||
|
||||
class Error_class : public LAMMPSTest {
|
||||
@ -39,7 +39,7 @@ TEST_F(Error_class, message)
|
||||
auto output = CAPTURE_OUTPUT([&] {
|
||||
error->message(FLERR, "one message");
|
||||
});
|
||||
ASSERT_THAT(output, MatchesRegex("one message .*test_error_class.cpp:.*"));
|
||||
ASSERT_THAT(output, ContainsRegex("one message .*test_error_class.cpp:.*"));
|
||||
};
|
||||
|
||||
TEST_F(Error_class, warning)
|
||||
@ -48,7 +48,7 @@ TEST_F(Error_class, warning)
|
||||
auto output = CAPTURE_OUTPUT([&] {
|
||||
error->warning(FLERR, "one warning");
|
||||
});
|
||||
ASSERT_THAT(output, MatchesRegex("WARNING: one warning .*test_error_class.cpp:.*"));
|
||||
ASSERT_THAT(output, ContainsRegex("WARNING: one warning .*test_error_class.cpp:.*"));
|
||||
ASSERT_THAT(error->get_maxwarn(), 100);
|
||||
|
||||
// warnings disabled
|
||||
@ -72,7 +72,7 @@ TEST_F(Error_class, warning)
|
||||
output = CAPTURE_OUTPUT([&] {
|
||||
thermo->lost_check();
|
||||
});
|
||||
ASSERT_THAT(output, MatchesRegex("WARNING: Too many warnings: 5 vs 2. All future.*"));
|
||||
ASSERT_THAT(output, ContainsRegex("WARNING: Too many warnings: 5 vs 2. All future.*"));
|
||||
|
||||
output = CAPTURE_OUTPUT([&] {
|
||||
error->warning(FLERR, "one warning");
|
||||
@ -91,7 +91,7 @@ TEST_F(Error_class, warning)
|
||||
output = CAPTURE_OUTPUT([&] {
|
||||
error->warning(FLERR, "one warning");
|
||||
});
|
||||
ASSERT_THAT(output, MatchesRegex("WARNING: one warning.*"));
|
||||
ASSERT_THAT(output, ContainsRegex("WARNING: one warning.*"));
|
||||
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("thermo_modify warn default");
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using ::testing::MatchesRegex;
|
||||
using ::testing::ContainsRegex;
|
||||
using ::testing::StartsWith;
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
@ -339,7 +339,7 @@ TEST(LAMMPS_init, OpenMP)
|
||||
::testing::internal::CaptureStdout();
|
||||
LAMMPS *lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD);
|
||||
std::string output = ::testing::internal::GetCapturedStdout();
|
||||
EXPECT_THAT(output, MatchesRegex(".*using 2 OpenMP thread.*per MPI task.*"));
|
||||
EXPECT_THAT(output, ContainsRegex(".*using 2 OpenMP thread.*per MPI task.*"));
|
||||
|
||||
if (LAMMPS_NS::Info::has_accelerator_feature("OPENMP", "api", "openmp"))
|
||||
EXPECT_EQ(lmp->comm->nthreads, 2);
|
||||
@ -373,7 +373,7 @@ TEST(LAMMPS_init, NoOpenMP)
|
||||
LAMMPS *lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD);
|
||||
std::string output = ::testing::internal::GetCapturedStdout();
|
||||
EXPECT_THAT(output,
|
||||
MatchesRegex(".*OMP_NUM_THREADS environment is not set.*Defaulting to 1 thread.*"));
|
||||
ContainsRegex(".*OMP_NUM_THREADS environment is not set.*Defaulting to 1 thread.*"));
|
||||
EXPECT_EQ(lmp->comm->nthreads, 1);
|
||||
::testing::internal::CaptureStdout();
|
||||
delete lmp;
|
||||
|
||||
@ -29,7 +29,6 @@
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
using testing::MatchesRegex;
|
||||
using testing::StrEq;
|
||||
|
||||
using utils::read_lines_from_file;
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
using testing::MatchesRegex;
|
||||
using testing::ContainsRegex;
|
||||
using testing::StrEq;
|
||||
|
||||
using utils::split_words;
|
||||
@ -173,7 +173,7 @@ TEST_F(MoleculeFileTest, minimal)
|
||||
BEGIN_CAPTURE_OUTPUT();
|
||||
run_mol_cmd(test_name, "", "Comment\n1 atoms\n\n Coords\n\n 1 0.0 0.0 0.0\n");
|
||||
auto output = END_CAPTURE_OUTPUT();
|
||||
ASSERT_THAT(output, MatchesRegex(".*Read molecule template.*1 molecules.*1 atoms.*0 bonds.*"));
|
||||
ASSERT_THAT(output, ContainsRegex(".*Read molecule template.*1 molecules.*1 atoms.*0 bonds.*"));
|
||||
}
|
||||
|
||||
TEST_F(MoleculeFileTest, notype)
|
||||
@ -184,7 +184,7 @@ TEST_F(MoleculeFileTest, notype)
|
||||
command("create_box 1 box");
|
||||
run_mol_cmd(test_name, "", "Comment\n1 atoms\n\n Coords\n\n 1 0.0 0.0 0.0\n");
|
||||
auto output = END_CAPTURE_OUTPUT();
|
||||
ASSERT_THAT(output, MatchesRegex(".*Read molecule template.*1 molecules.*1 atoms.*0 bonds.*"));
|
||||
ASSERT_THAT(output, ContainsRegex(".*Read molecule template.*1 molecules.*1 atoms.*0 bonds.*"));
|
||||
TEST_FAILURE(".*ERROR: Create_atoms molecule must have atom types.*",
|
||||
command("create_atoms 0 single 0.0 0.0 0.0 mol notype 542465"););
|
||||
}
|
||||
@ -199,7 +199,7 @@ TEST_F(MoleculeFileTest, extramass)
|
||||
" Types\n\n 1 1\n Masses\n\n 1 1.0\n");
|
||||
command("create_atoms 0 single 0.0 0.0 0.0 mol extramass 73546");
|
||||
auto output = END_CAPTURE_OUTPUT();
|
||||
ASSERT_THAT(output, MatchesRegex(".*WARNING: Molecule attributes do not match "
|
||||
ASSERT_THAT(output, ContainsRegex(".*WARNING: Molecule attributes do not match "
|
||||
"system attributes.*"));
|
||||
}
|
||||
|
||||
@ -211,7 +211,7 @@ TEST_F(MoleculeFileTest, twomols)
|
||||
" Coords\n\n 1 0.0 0.0 0.0\n 2 0.0 0.0 1.0\n"
|
||||
" Molecules\n\n 1 1\n 2 2\n\n Types\n\n 1 1\n 2 2\n\n");
|
||||
auto output = END_CAPTURE_OUTPUT();
|
||||
ASSERT_THAT(output, MatchesRegex(".*Read molecule template.*2 molecules.*2 atoms "
|
||||
ASSERT_THAT(output, ContainsRegex(".*Read molecule template.*2 molecules.*2 atoms "
|
||||
"with max type 2.*0 bonds.*"));
|
||||
}
|
||||
|
||||
@ -220,7 +220,7 @@ TEST_F(MoleculeFileTest, twofiles)
|
||||
BEGIN_CAPTURE_OUTPUT();
|
||||
command("molecule twomols moltest.h2o.mol moltest.co2.mol offset 2 1 1 0 0");
|
||||
auto output = END_CAPTURE_OUTPUT();
|
||||
ASSERT_THAT(output, MatchesRegex(".*Read molecule template twomols:.*1 molecules.*3 atoms "
|
||||
ASSERT_THAT(output, ContainsRegex(".*Read molecule template twomols:.*1 molecules.*3 atoms "
|
||||
"with max type 2.*2 bonds with max type 1.*"
|
||||
"1 angles with max type 1.*0 dihedrals.*"
|
||||
".*Read molecule template twomols:.*1 molecules.*3 atoms "
|
||||
@ -254,14 +254,14 @@ TEST_F(MoleculeFileTest, bonds)
|
||||
" 1 1 1 2\n"
|
||||
" 2 2 1 3\n\n");
|
||||
auto output = END_CAPTURE_OUTPUT();
|
||||
ASSERT_THAT(output, MatchesRegex(".*Read molecule template.*1 molecules.*4 atoms.*type.*2.*"
|
||||
ASSERT_THAT(output, ContainsRegex(".*Read molecule template.*1 molecules.*4 atoms.*type.*2.*"
|
||||
"2 bonds.*type.*2.*0 angles.*"));
|
||||
|
||||
BEGIN_CAPTURE_OUTPUT();
|
||||
command("mass * 2.0");
|
||||
command("create_atoms 0 single 0.5 0.5 0.5 mol bonds 67235");
|
||||
output = END_CAPTURE_OUTPUT();
|
||||
ASSERT_THAT(output, MatchesRegex(".*Created 4 atoms.*"));
|
||||
ASSERT_THAT(output, ContainsRegex(".*Created 4 atoms.*"));
|
||||
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
Molecule *mol = lmp->atom->molecules[0];
|
||||
|
||||
@ -37,7 +37,6 @@
|
||||
#include <vector>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using ::testing::MatchesRegex;
|
||||
using utils::split_words;
|
||||
|
||||
// whether to print verbose output (i.e. not capturing LAMMPS screen output).
|
||||
|
||||
@ -45,7 +45,7 @@ using LAMMPS_NS::utils::split_words;
|
||||
namespace LAMMPS_NS {
|
||||
using ::testing::Eq;
|
||||
using ::testing::HasSubstr;
|
||||
using ::testing::MatchesRegex;
|
||||
using ::testing::ContainsRegex;
|
||||
using ::testing::StrEq;
|
||||
|
||||
class PythonPackageTest : public LAMMPSTest {
|
||||
@ -238,7 +238,7 @@ TEST_F(PythonPackageTest, python_variable)
|
||||
std::string output = CAPTURE_OUTPUT([&] {
|
||||
command("print \"${sq}\"");
|
||||
});
|
||||
ASSERT_THAT(output, MatchesRegex("print.*2.25.*"));
|
||||
ASSERT_THAT(output, ContainsRegex("print.*2.25.*"));
|
||||
}
|
||||
|
||||
TEST_F(PythonPackageTest, InlineFunction)
|
||||
|
||||
@ -28,20 +28,20 @@
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
using ::testing::MatchesRegex;
|
||||
using ::testing::ContainsRegex;
|
||||
|
||||
#define TEST_FAILURE(errmsg, ...) \
|
||||
if (Info::has_exceptions()) { \
|
||||
::testing::internal::CaptureStdout(); \
|
||||
ASSERT_ANY_THROW({__VA_ARGS__}); \
|
||||
auto mesg = ::testing::internal::GetCapturedStdout(); \
|
||||
ASSERT_THAT(mesg, MatchesRegex(errmsg)); \
|
||||
ASSERT_THAT(mesg, ContainsRegex(errmsg)); \
|
||||
} else { \
|
||||
if (platform::mpi_vendor() != "Open MPI") { \
|
||||
::testing::internal::CaptureStdout(); \
|
||||
ASSERT_DEATH({__VA_ARGS__}, ""); \
|
||||
auto mesg = ::testing::internal::GetCapturedStdout(); \
|
||||
ASSERT_THAT(mesg, MatchesRegex(errmsg)); \
|
||||
ASSERT_THAT(mesg, ContainsRegex(errmsg)); \
|
||||
} else { \
|
||||
std::cerr << "[ ] [ INFO ] Skipping death test (no exception support) \n"; \
|
||||
} \
|
||||
|
||||
Reference in New Issue
Block a user