add minimal unit tests for reading binary dumps
This commit is contained in:
@ -521,6 +521,32 @@ TEST_F(DumpAtomTest, rerun)
|
|||||||
delete_file(dump_file);
|
delete_file(dump_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(DumpAtomTest, rerun_bin)
|
||||||
|
{
|
||||||
|
auto dump_file = binary_dump_filename("rerun");
|
||||||
|
HIDE_OUTPUT([&] {
|
||||||
|
command("fix 1 all nve");
|
||||||
|
});
|
||||||
|
generate_dump(dump_file, "", 1);
|
||||||
|
double pe_1, pe_2, pe_rerun;
|
||||||
|
lmp->output->thermo->evaluate_keyword("pe", &pe_1);
|
||||||
|
ASSERT_FILE_EXISTS(dump_file);
|
||||||
|
continue_dump(1);
|
||||||
|
lmp->output->thermo->evaluate_keyword("pe", &pe_2);
|
||||||
|
ASSERT_FILE_EXISTS(dump_file);
|
||||||
|
HIDE_OUTPUT([&] {
|
||||||
|
command(fmt::format("rerun {} first 1 last 1 every 1 post no dump x y z", dump_file));
|
||||||
|
});
|
||||||
|
lmp->output->thermo->evaluate_keyword("pe", &pe_rerun);
|
||||||
|
ASSERT_NEAR(pe_1, pe_rerun,1.0e-14);
|
||||||
|
HIDE_OUTPUT([&] {
|
||||||
|
command(fmt::format("rerun {} first 2 last 2 every 1 post yes dump x y z", dump_file));
|
||||||
|
});
|
||||||
|
lmp->output->thermo->evaluate_keyword("pe", &pe_rerun);
|
||||||
|
ASSERT_NEAR(pe_2, pe_rerun,1.0e-14);
|
||||||
|
delete_file(dump_file);
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(DumpAtomTest, multi_file_run1)
|
TEST_F(DumpAtomTest, multi_file_run1)
|
||||||
{
|
{
|
||||||
auto dump_file = dump_filename("run1_*");
|
auto dump_file = dump_filename("run1_*");
|
||||||
|
|||||||
@ -346,6 +346,34 @@ TEST_F(DumpCustomTest, rerun)
|
|||||||
delete_file(dump_file);
|
delete_file(dump_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(DumpCustomTest, rerun_bin)
|
||||||
|
{
|
||||||
|
auto dump_file = binary_dump_filename("rerun");
|
||||||
|
auto fields = "id type xs ys zs";
|
||||||
|
|
||||||
|
HIDE_OUTPUT([&] {
|
||||||
|
command("fix 1 all nve");
|
||||||
|
});
|
||||||
|
generate_dump(dump_file, fields, "", 1);
|
||||||
|
double pe_1, pe_2, pe_rerun;
|
||||||
|
lmp->output->thermo->evaluate_keyword("pe", &pe_1);
|
||||||
|
ASSERT_FILE_EXISTS(dump_file);
|
||||||
|
continue_dump(1);
|
||||||
|
lmp->output->thermo->evaluate_keyword("pe", &pe_2);
|
||||||
|
ASSERT_FILE_EXISTS(dump_file);
|
||||||
|
HIDE_OUTPUT([&] {
|
||||||
|
command(fmt::format("rerun {} first 1 last 1 every 1 post no dump x y z", dump_file));
|
||||||
|
});
|
||||||
|
lmp->output->thermo->evaluate_keyword("pe", &pe_rerun);
|
||||||
|
ASSERT_NEAR(pe_1, pe_rerun,1.0e-14);
|
||||||
|
HIDE_OUTPUT([&] {
|
||||||
|
command(fmt::format("rerun {} first 2 last 2 every 1 post yes dump x y z", dump_file));
|
||||||
|
});
|
||||||
|
lmp->output->thermo->evaluate_keyword("pe", &pe_rerun);
|
||||||
|
ASSERT_NEAR(pe_2, pe_rerun,1.0e-14);
|
||||||
|
delete_file(dump_file);
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
MPI_Init(&argc, &argv);
|
MPI_Init(&argc, &argv);
|
||||||
|
|||||||
Reference in New Issue
Block a user