On Windows the Regex matcher for '.' does not match '\n'

Thus we have to use ContainsRegex instead of MatchesRegex
This commit is contained in:
Axel Kohlmeyer
2022-01-29 16:35:30 -05:00
parent d62e25decc
commit 845ab2dd71
13 changed files with 52 additions and 57 deletions

View File

@ -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;