Commit c7b09085 authored by Pierre Fernbach's avatar Pierre Fernbach
Browse files

[Tests] add unit tests for the ContactPhase constructor with ContactModel

parent 3e7d4eff
......@@ -289,6 +289,20 @@ class ContactPatchTest(unittest.TestCase):
self.assertTrue(cp.friction == 0.9)
self.assertTrue(cp.placement == p)
def test_constructor_with_contact_model(self):
cm = ContactModel(0.5, ContactType.CONTACT_PLANAR)
cm.num_contact_points = 4
p = SE3()
p.setRandom()
cp = ContactPatch(p, cm)
self.assertTrue(cp.friction == 0.5)
self.assertTrue(cp.placement == p)
self.assertTrue(cp.contact_model.num_contact_points == 4)
# check that the value have been copied and it's not the same pointer anymore :
cm.num_contact_points = 6
self.assertTrue(cp.contact_model.num_contact_points == 4)
def test_operator_equal(self):
cp1 = ContactPatch()
cp2 = ContactPatch()
......
......@@ -468,6 +468,15 @@ BOOST_AUTO_TEST_CASE(contact_patch) {
BOOST_CHECK(cp2.placement() == p);
BOOST_CHECK(cp2.friction() == 0.9);
// constructor with contact_model
ContactModel cm(0.5, ContactType::CONTACT_PLANAR);
cm.num_contact_points(4);
ContactPatch cp_with_model(p, cm);
BOOST_CHECK(cp_with_model.placement() == p);
BOOST_CHECK(cp_with_model.friction() == 0.5);
BOOST_CHECK(cp_with_model.m_contact_model.num_contact_points() == 4);
// check comparison operator
BOOST_CHECK(cp1 != cp2);
ContactPatch cp3(p, 0.9);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment