update tests for echoing the title line of molecule files

This commit is contained in:
Axel Kohlmeyer
2024-01-16 13:53:07 -05:00
parent b6d27dfb96
commit deb8416630

View File

@ -220,7 +220,7 @@ TEST_F(MoleculeFileTest, minimal)
BEGIN_CAPTURE_OUTPUT();
run_mol_cmd(test_name, "", "Comment\n1 atoms\n\n Coords\n\n 1 0.0 0.0 0.0\n");
auto output = END_CAPTURE_OUTPUT();
ASSERT_THAT(output, ContainsRegex(".*Read molecule template.*\n.*1 molecules.*\n"
ASSERT_THAT(output, ContainsRegex(".*Read molecule template.*\n.*Comment.*\n.*1 molecules.*\n"
".*0 fragments.*\n.*1 atoms.*\n.*0 bonds.*"));
}
@ -232,7 +232,7 @@ TEST_F(MoleculeFileTest, notype)
command("create_box 1 box");
run_mol_cmd(test_name, "", "Comment\n1 atoms\n\n Coords\n\n 1 0.0 0.0 0.0\n");
auto output = END_CAPTURE_OUTPUT();
ASSERT_THAT(output, ContainsRegex(".*Read molecule template.*\n.*1 molecules.*\n"
ASSERT_THAT(output, ContainsRegex(".*Read molecule template.*\n.*Comment.*\n.*1 molecules.*\n"
".*0 fragments.*\n.*1 atoms.*\n.*0 bonds.*"));
TEST_FAILURE(".*ERROR: Create_atoms molecule must have atom types.*",
command("create_atoms 0 single 0.0 0.0 0.0 mol notype 542465"););
@ -261,7 +261,7 @@ TEST_F(MoleculeFileTest, twomols)
" Coords\n\n 1 0.0 0.0 0.0\n 2 0.0 0.0 1.0\n"
" Molecules\n\n 1 1\n 2 2\n\n Types\n\n 1 1\n 2 2\n\n");
auto output = END_CAPTURE_OUTPUT();
ASSERT_THAT(output, ContainsRegex(".*Read molecule template.*\n.*2 molecules.*\n"
ASSERT_THAT(output, ContainsRegex(".*Read molecule template.*\n.*Comment.*\n.*2 molecules.*\n"
".*0 fragments.*\n.*2 atoms with max type 2.*\n.*0 bonds.*"));
ASSERT_EQ(lmp->atom->nmolecule, 1);
auto mols = lmp->atom->get_molecule_by_id(test_name);
@ -275,7 +275,7 @@ TEST_F(MoleculeFileTest, twofiles)
auto output = END_CAPTURE_OUTPUT();
ASSERT_THAT(
output,
ContainsRegex(".*Read molecule template twomols:.*\n.*1 molecules.*\n"
ContainsRegex(".*Read molecule template twomols:.*\n.*Water.*\n.*1 molecules.*\n"
".*0 fragments.*\n.*3 atoms with max type 2.*\n.*2 bonds with max type 1.*\n"
".*1 angles with max type 1.*\n.*0 dihedrals.*\n.*0 impropers.*\n"
".*Read molecule template twomols:.*\n.*1 molecules.*\n"
@ -308,7 +308,7 @@ TEST_F(MoleculeFileTest, labelmap)
auto output = END_CAPTURE_OUTPUT();
ASSERT_THAT(
output,
ContainsRegex(".*Read molecule template h2olabel:.*\n.*1 molecules.*\n"
ContainsRegex(".*Read molecule template h2olabel:.*\n.*Water.*\n.*1 molecules.*\n"
".*0 fragments.*\n.*3 atoms with max type 2.*\n.*2 bonds with max type 1.*\n"
".*1 angles with max type 1.*\n.*0 dihedrals.*\n.*0 impropers.*"));
BEGIN_CAPTURE_OUTPUT();
@ -316,7 +316,7 @@ TEST_F(MoleculeFileTest, labelmap)
output = END_CAPTURE_OUTPUT();
ASSERT_THAT(
output,
ContainsRegex(".*Read molecule template co2label:.*\n.*1 molecules.*\n"
ContainsRegex(".*Read molecule template co2label:.*\n.*CO2.*\n.*1 molecules.*\n"
".*0 fragments.*\n.*3 atoms with max type 4.*\n.*2 bonds with max type 2.*\n"
".*1 angles with max type 2.*\n.*0 dihedrals.*"));
BEGIN_CAPTURE_OUTPUT();
@ -330,12 +330,12 @@ TEST_F(MoleculeFileTest, labelmap)
auto second = output.substr(mark);
ASSERT_THAT(
first,
ContainsRegex(".*Read molecule template h2onum:.*\n.*1 molecules.*\n"
ContainsRegex(".*Read molecule template h2onum:.*\n.*Water.*\n.*1 molecules.*\n"
".*0 fragments.*\n.*3 atoms with max type 2.*\n.*2 bonds with max type 1.*\n"
".*1 angles with max type 1.*\n.*0 dihedrals.*\n.*0 impropers.*\n"));
ASSERT_THAT(
second,
ContainsRegex(".*Read molecule template co2num:.*\n.*1 molecules.*\n"
ContainsRegex(".*Read molecule template co2num:.*\n.*CO2.*\n.*1 molecules.*\n"
".*0 fragments.*\n.*3 atoms with max type 4.*\n.*2 bonds with max type 2.*\n"
".*1 angles with max type 2.*\n.*0 dihedrals.*"));
ASSERT_EQ(lmp->atom->nmolecule, 4);
@ -381,7 +381,7 @@ TEST_F(MoleculeFileTest, bonds)
" 1 1 1 2\n"
" 2 2 1 3\n\n");
auto output = END_CAPTURE_OUTPUT();
ASSERT_THAT(output, ContainsRegex(".*Read molecule template.*\n.*1 molecules.*\n"
ASSERT_THAT(output, ContainsRegex(".*Read molecule template.*\n.*Comment.*\n.*1 molecules.*\n"
".*0 fragments.*\n.*4 atoms.*type.*2.*\n"
".*2 bonds.*type.*2.*\n.*0 angles.*"));
@ -420,7 +420,7 @@ TEST_F(MoleculeFileTest, dipoles)
"Types\n\n1 1\n2 2\n\n"
"Dipoles\n\n1 1.0 0.0 0.0\n2 1.0 1.0 0.0\n\n");
auto output = END_CAPTURE_OUTPUT();
ASSERT_THAT(output, ContainsRegex(".*Read molecule template.*\n.*1 molecules.*\n"
ASSERT_THAT(output, ContainsRegex(".*Read molecule template.*\n.*Dumbbell.*\n.*1 molecules.*\n"
".*0 fragments.*\n.*2 atoms.*type.*2.*\n"));
BEGIN_CAPTURE_OUTPUT();