Use platform::path_join in unittest tree and remove redundant code
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
#include "lammps.h"
|
||||
#include "library.h"
|
||||
#include "lmptype.h"
|
||||
#include "platform.h"
|
||||
#include <string>
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
@ -13,6 +14,7 @@
|
||||
#define STRINGIFY(val) XSTR(val)
|
||||
#define XSTR(val) #val
|
||||
|
||||
using ::LAMMPS_NS::platform::path_join;
|
||||
using ::LAMMPS_NS::tagint;
|
||||
using ::testing::HasSubstr;
|
||||
using ::testing::StartsWith;
|
||||
@ -82,7 +84,7 @@ TEST_F(LibraryProperties, get_mpi_comm)
|
||||
TEST_F(LibraryProperties, natoms)
|
||||
{
|
||||
if (!lammps_has_style(lmp, "atom", "full")) GTEST_SKIP();
|
||||
std::string input = INPUT_DIR + PATH_SEP + "in.fourmol";
|
||||
std::string input = path_join(INPUT_DIR, "in.fourmol");
|
||||
if (!verbose) ::testing::internal::CaptureStdout();
|
||||
lammps_file(lmp, input.c_str());
|
||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||
@ -92,7 +94,7 @@ TEST_F(LibraryProperties, natoms)
|
||||
TEST_F(LibraryProperties, thermo)
|
||||
{
|
||||
if (!lammps_has_style(lmp, "atom", "full")) GTEST_SKIP();
|
||||
std::string input = INPUT_DIR + PATH_SEP + "in.fourmol";
|
||||
std::string input = path_join(INPUT_DIR, "in.fourmol");
|
||||
::testing::internal::CaptureStdout();
|
||||
lammps_file(lmp, input.c_str());
|
||||
lammps_command(lmp, "run 2 post no");
|
||||
@ -108,7 +110,7 @@ TEST_F(LibraryProperties, thermo)
|
||||
TEST_F(LibraryProperties, box)
|
||||
{
|
||||
if (!lammps_has_style(lmp, "atom", "full")) GTEST_SKIP();
|
||||
std::string input = INPUT_DIR + PATH_SEP + "in.fourmol";
|
||||
std::string input = path_join(INPUT_DIR, "in.fourmol");
|
||||
::testing::internal::CaptureStdout();
|
||||
lammps_file(lmp, input.c_str());
|
||||
lammps_command(lmp, "run 2 post no");
|
||||
@ -248,7 +250,7 @@ TEST_F(LibraryProperties, setting)
|
||||
EXPECT_EQ(lammps_extract_setting(lmp, "UNKNOWN"), -1);
|
||||
|
||||
if (lammps_has_style(lmp, "atom", "full")) {
|
||||
std::string input = INPUT_DIR + PATH_SEP + "in.fourmol";
|
||||
std::string input = path_join(INPUT_DIR, "in.fourmol");
|
||||
if (!verbose) ::testing::internal::CaptureStdout();
|
||||
lammps_file(lmp, input.c_str());
|
||||
lammps_command(lmp, "run 2 post no");
|
||||
@ -289,7 +291,7 @@ TEST_F(LibraryProperties, global)
|
||||
{
|
||||
if (!lammps_has_style(lmp, "atom", "full")) GTEST_SKIP();
|
||||
|
||||
std::string input = INPUT_DIR + PATH_SEP + "in.fourmol";
|
||||
std::string input = path_join(INPUT_DIR, "in.fourmol");
|
||||
if (!verbose) ::testing::internal::CaptureStdout();
|
||||
lammps_file(lmp, input.c_str());
|
||||
lammps_command(lmp, "run 2 post no");
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
#include "lammps.h"
|
||||
#include "library.h"
|
||||
#include "lmptype.h"
|
||||
#include "platform.h"
|
||||
#include <string>
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
@ -13,6 +14,7 @@
|
||||
#define STRINGIFY(val) XSTR(val)
|
||||
#define XSTR(val) #val
|
||||
|
||||
using ::LAMMPS_NS::platform::path_join;
|
||||
using ::LAMMPS_NS::bigint;
|
||||
using ::LAMMPS_NS::tagint;
|
||||
using ::testing::HasSubstr;
|
||||
@ -55,7 +57,7 @@ protected:
|
||||
TEST_F(GatherProperties, gather_bonds_newton_on)
|
||||
{
|
||||
if (!lammps_has_style(lmp, "atom", "full")) GTEST_SKIP();
|
||||
std::string input = INPUT_DIR + PATH_SEP + "in.fourmol";
|
||||
std::string input = path_join(INPUT_DIR, "in.fourmol");
|
||||
if (!verbose) ::testing::internal::CaptureStdout();
|
||||
lammps_command(lmp, "newton on on");
|
||||
lammps_file(lmp, input.c_str());
|
||||
@ -95,7 +97,7 @@ TEST_F(GatherProperties, gather_bonds_newton_on)
|
||||
TEST_F(GatherProperties, gather_bonds_newton_off)
|
||||
{
|
||||
if (!lammps_has_style(lmp, "atom", "full")) GTEST_SKIP();
|
||||
std::string input = INPUT_DIR + PATH_SEP + "in.fourmol";
|
||||
std::string input = path_join(INPUT_DIR, "in.fourmol");
|
||||
if (!verbose) ::testing::internal::CaptureStdout();
|
||||
lammps_command(lmp, "newton off off");
|
||||
lammps_file(lmp, input.c_str());
|
||||
|
||||
@ -25,9 +25,3 @@ extern bool verbose;
|
||||
} while (0);
|
||||
|
||||
#endif
|
||||
|
||||
#if defined _WIN32
|
||||
static const char PATH_SEP = '\\';
|
||||
#else
|
||||
static const char PATH_SEP = '/';
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user