Skip to content

Commit

Permalink
test(core): add test for bond length update on bond addition
Browse files Browse the repository at this point in the history
  • Loading branch information
jnooree committed Nov 17, 2023
1 parent 56147bf commit a7b3e4b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/core/molecule_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include <absl/algorithm/container.h>
#include <absl/container/flat_hash_set.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>

#include "nuri/eigen_config.h"
Expand Down Expand Up @@ -185,6 +186,23 @@ TEST_F(MoleculeTest, AddAtomsTest) {
EXPECT_EQ(mol_.atom(mol_.size() - 1).data().atomic_number(), 1);
}

TEST_F(MoleculeTest, AddBonds) {
{
auto mutator = mol_.mutator();
BondData d;
d.length() = 0;
mutator.add_bond(4, 11, d);
}

EXPECT_EQ(mol_.num_bonds(), 12);

auto bit = mol_.find_bond(4, 11);
ASSERT_NE(bit, mol_.bond_end());
EXPECT_THAT(bit->data().length(), testing::Not(testing::DoubleEq(0)));
EXPECT_DOUBLE_EQ(bit->data().length(),
(mol_.conf().row(4) - mol_.conf().row(11)).norm());
}

TEST_F(MoleculeTest, TransformTest) {
nuri::Affine3d trs = nuri::Affine3d::Identity();

Expand Down

0 comments on commit a7b3e4b

Please sign in to comment.