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

@ -11,20 +11,23 @@
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#include "gtest/gtest.h"
#include "gmock/gmock.h"
#include "fmt/format.h"
#include "utils.h"
#include "../testing/core.h"
#include "../testing/systems/melt.h"
#include "../testing/utils.h"
#include "fmt/format.h"
#include "utils.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
using ::testing::Eq;
class DumpCfgTest : public MeltTest {
std::string dump_style = "cfg";
public:
void generate_dump(std::string dump_file, std::string fields, std::string dump_modify_options, int ntimesteps) {
void generate_dump(std::string dump_file, std::string fields, std::string dump_modify_options,
int ntimesteps)
{
if (!verbose) ::testing::internal::CaptureStdout();
command(fmt::format("dump id all {} 1 {} {}", dump_style, dump_file, fields));
@ -40,28 +43,26 @@ public:
TEST_F(DumpCfgTest, invalid_options)
{
TEST_FAILURE(".*Dump cfg arguments must start with 'mass type xs ys zs'.*",
command("dump id all cfg 1 dump.cfg id type proc procp1 mass x y z");
);
command("dump id all cfg 1 dump.cfg id type proc procp1 mass x y z"););
}
TEST_F(DumpCfgTest, require_multifile)
{
auto dump_file = "dump.melt.cfg_run.cfg";
auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz xu yu zu xsu ysu zsu vx vy vz fx fy fz";
auto fields =
"mass type xs ys zs id proc procp1 x y z ix iy iz xu yu zu xsu ysu zsu vx vy vz fx fy fz";
if (!verbose) ::testing::internal::CaptureStdout();
command(fmt::format("dump id all cfg 1 {} {}", dump_file, fields));
if (!verbose) ::testing::internal::GetCapturedStdout();
TEST_FAILURE(".*Dump cfg requires one snapshot per file.*",
command("run 0");
);
TEST_FAILURE(".*Dump cfg requires one snapshot per file.*", command("run 0"););
}
TEST_F(DumpCfgTest, run0)
{
auto dump_file = "dump_cfg_run*.melt.cfg";
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_dump(dump_file, fields, "", 0);
@ -75,7 +76,7 @@ TEST_F(DumpCfgTest, run0)
TEST_F(DumpCfgTest, unwrap_run0)
{
auto dump_file = "dump_cfg_unwrap_run*.melt.cfg";
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_dump(dump_file, fields, "", 0);
@ -89,7 +90,7 @@ TEST_F(DumpCfgTest, unwrap_run0)
TEST_F(DumpCfgTest, no_buffer_run0)
{
auto dump_file = "dump_cfg_no_buffer_run*.melt.cfg";
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_dump(dump_file, fields, "buffer no", 0);
@ -103,7 +104,7 @@ TEST_F(DumpCfgTest, no_buffer_run0)
TEST_F(DumpCfgTest, no_unwrap_no_buffer_run0)
{
auto dump_file = "dump_cfg_no_unwrap_no_buffer_run*.melt.cfg";
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_dump(dump_file, fields, "buffer no", 0);
@ -114,7 +115,6 @@ TEST_F(DumpCfgTest, no_unwrap_no_buffer_run0)
delete_file("dump_cfg_no_unwrap_no_buffer_run0.melt.cfg");
}
int main(int argc, char **argv)
{
MPI_Init(&argc, &argv);