reformat unittest sources with clang-format

This commit is contained in:
Axel Kohlmeyer
2020-11-18 18:27:20 -05:00
committed by Richard Berger
parent a8b60848c3
commit 569a000e6b
32 changed files with 2022 additions and 2071 deletions

View File

@ -41,31 +41,26 @@ using ::testing::MatchesRegex;
// whether to print verbose output (i.e. not capturing LAMMPS screen output).
bool verbose = false;
class LAMMPSTest : public ::testing::Test {
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()); }
protected:
const char * testbinary = "LAMMPSTest";
const char *testbinary = "LAMMPSTest";
LAMMPS *lmp;
void SetUp() override
{
const char *args[] = { testbinary, "-log", "none", "-echo", "screen", "-nocite"};
char **argv = (char **)args;
int argc = sizeof(args) / sizeof(char *);
const char *args[] = {testbinary, "-log", "none", "-echo", "screen", "-nocite"};
char **argv = (char **)args;
int argc = sizeof(args) / sizeof(char *);
if (!verbose) ::testing::internal::CaptureStdout();
lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD);
InitSystem();
if (!verbose) ::testing::internal::GetCapturedStdout();
}
virtual void InitSystem() {
}
virtual void InitSystem() {}
void TearDown() override
{
@ -76,5 +71,4 @@ protected:
}
};
#endif

View File

@ -17,7 +17,8 @@
class MeltTest : public LAMMPSTest {
protected:
virtual void InitSystem() override {
virtual void InitSystem() override
{
command("units lj");
command("atom_style atomic");
command("atom_modify map yes");
@ -34,7 +35,7 @@ protected:
command("pair_coeff 1 1 1.0 1.0 2.5");
command("neighbor 0.3 bin");
command("neigh_modify every 20 delay 0 check no");
command("neigh_modify every 20 delay 0 check no");
}
};

View File

@ -13,12 +13,12 @@
#ifndef TEST_EXTENSIONS__H
#define TEST_EXTENSIONS__H
#include <string>
#include <vector>
#include <iostream>
#include <fstream>
#include <sys/types.h>
#include <iostream>
#include <string>
#include <sys/stat.h>
#include <sys/types.h>
#include <vector>
static void delete_file(const std::string &filename)
{
@ -44,14 +44,15 @@ static bool equal_lines(const std::string &fileA, const std::string &fileB)
std::string lineA, lineB;
while (std::getline(afile, lineA)) {
if(!std::getline(bfile, lineB)) return false;
if(lineA != lineB) return false;
if (!std::getline(bfile, lineB)) return false;
if (lineA != lineB) return false;
}
return true;
}
static std::vector<std::string> read_lines(const std::string &filename) {
static std::vector<std::string> read_lines(const std::string &filename)
{
std::vector<std::string> lines;
std::ifstream infile(filename);
std::string line;
@ -62,7 +63,8 @@ static std::vector<std::string> read_lines(const std::string &filename) {
return lines;
}
static bool file_exists(const std::string &filename) {
static bool file_exists(const std::string &filename)
{
struct stat result;
return stat(filename.c_str(), &result) == 0;
}