update unit tests

This commit is contained in:
Axel Kohlmeyer
2025-06-20 08:38:09 -04:00
parent b909a782b6
commit bb0bd289b7

View File

@ -474,7 +474,7 @@ TEST_F(MoleculeFileTest, minimal)
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.*Comment.*\n.*1 molecules.*\n"
".*0 fragments.*\n.*1 atoms.*\n.*0 bonds.*"));
".*0 fragments.*\n.*0 bodies.*\n.*1 atoms.*\n.*0 bonds.*"));
}
TEST_F(MoleculeFileTest, minjson)
@ -487,7 +487,7 @@ TEST_F(MoleculeFileTest, minjson)
"\"coords\":{\"format\":[\"atom-id\",\"x\",\"y\",\"z\"],\"data\": [[1,0.0,0.0,0.0]]}}");
auto output = END_CAPTURE_OUTPUT();
ASSERT_THAT(output, ContainsRegex(".*Read molecule template minjson:\n.no title.*\n.*1 molecules.*\n"
".*0 fragments.*\n.*1 atoms.*\n.*0 bonds.*"));
".*0 fragments.*\n.*0 bodies.*\n.*1 atoms.*\n.*0 bonds.*"));
}
TEST_F(MoleculeFileTest, notype)
@ -499,7 +499,7 @@ TEST_F(MoleculeFileTest, notype)
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.*Comment.*\n.*1 molecules.*\n"
".*0 fragments.*\n.*1 atoms.*\n.*0 bonds.*"));
".*0 fragments.*\n.*0 bodies.*\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"););
}
@ -528,7 +528,7 @@ TEST_F(MoleculeFileTest, twomols)
" 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.*Comment.*\n.*2 molecules.*\n"
".*0 fragments.*\n.*2 atoms with max type 2.*\n.*0 bonds.*"));
".*0 fragments.*\n.*0 bodies.*\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);
ASSERT_EQ(mols.size(), 1);
@ -575,7 +575,7 @@ TEST_F(MoleculeFileTest, tenmols)
auto output = END_CAPTURE_OUTPUT();
ASSERT_THAT(output,
ContainsRegex(".*Read molecule template.*\n.*Comment.*\n.*10 molecules.*\n"
".*0 fragments.*\n.*10 atoms with max type 2.*\n.*0 bonds.*"));
".*0 fragments.*\n.*0 bodies.*\n.*10 atoms with max type 2.*\n.*0 bonds.*"));
ASSERT_EQ(lmp->atom->nmolecule, 1);
auto mols = lmp->atom->get_molecule_by_id(test_name);
ASSERT_EQ(mols.size(), 1);
@ -595,10 +595,10 @@ TEST_F(MoleculeFileTest, twofiles)
ASSERT_THAT(
output,
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"
".*0 fragments.*\n.*0 bodies.*\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.*CO2.*\n.*1 molecules.*\n"
".*0 fragments.*\n.*3 atoms with max type 4.*\n.*2 bonds with max type 2.*\n"
".*0 fragments.*\n.*0 bodies.*\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();
command("molecule h2o moltest.h2o.mol");
@ -628,7 +628,7 @@ TEST_F(MoleculeFileTest, labelmap)
ASSERT_THAT(
output,
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"
".*0 fragments.*\n.*0 bodies.*\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();
command("molecule co2label labelmap.co2.mol");
@ -636,7 +636,7 @@ TEST_F(MoleculeFileTest, labelmap)
ASSERT_THAT(
output,
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"
".*0 fragments.*\n.*0 bodies.*\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();
command("molecule h2onum moltest.h2o.mol");
@ -650,12 +650,12 @@ TEST_F(MoleculeFileTest, labelmap)
ASSERT_THAT(
first,
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"
".*0 fragments.*\n.*0 bodies.*\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.*CO2.*\n.*1 molecules.*\n"
".*0 fragments.*\n.*3 atoms with max type 4.*\n.*2 bonds with max type 2.*\n"
".*0 fragments.*\n.*0 bodies.*\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);
auto mols = lmp->atom->get_molecule_by_id("h2onum");
@ -701,7 +701,7 @@ TEST_F(MoleculeFileTest, bonds)
" 2 2 1 3\n\n");
auto output = END_CAPTURE_OUTPUT();
ASSERT_THAT(output, ContainsRegex(".*Read molecule template.*\n.*Comment.*\n.*1 molecules.*\n"
".*0 fragments.*\n.*4 atoms.*type.*2.*\n"
".*0 fragments.*\n.*0 bodies.*\n.*4 atoms.*type.*2.*\n"
".*2 bonds.*type.*2.*\n.*0 angles.*"));
BEGIN_CAPTURE_OUTPUT();
@ -740,7 +740,7 @@ TEST_F(MoleculeFileTest, dipoles)
"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.*Dumbbell.*\n.*1 molecules.*\n"
".*0 fragments.*\n.*2 atoms.*type.*2.*\n"));
".*0 fragments.*\n.*0 bodies.*\n.*2 atoms.*type.*2.*\n"));
BEGIN_CAPTURE_OUTPUT();
command("mass * 1.0");