From 114d39c3602483b34a447ff8a2fc578099d4d743 Mon Sep 17 00:00:00 2001 From: Jasmeet Singh Date: Wed, 28 Jun 2023 03:32:46 +0530 Subject: [PATCH] Added python tests for new MassMatrix() function for Box, sphere & Cylinder Signed-off-by: Jasmeet Singh --- src/python_pybind11/test/Box_TEST.py | 5 +++++ src/python_pybind11/test/Cylinder_TEST.py | 5 +++++ src/python_pybind11/test/Sphere_TEST.py | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/src/python_pybind11/test/Box_TEST.py b/src/python_pybind11/test/Box_TEST.py index 058507fb4..9e1a2f81f 100644 --- a/src/python_pybind11/test/Box_TEST.py +++ b/src/python_pybind11/test/Box_TEST.py @@ -401,6 +401,11 @@ def test_mass(self): self.assertEqual(expectedMassMat, massMat) self.assertEqual(expectedMassMat.mass(), massMat.mass()) + massMat2 = box.mass_matrix() + self.assertEqual(expectedMassMat, massMat2) + self.assertEqual(expectedMassMat.diagonal_moments(), massMat2.diagonal_moments()) + self.assertEqual(expectedMassMat.mass(), massMat2.mass()) + if __name__ == '__main__': unittest.main() diff --git a/src/python_pybind11/test/Cylinder_TEST.py b/src/python_pybind11/test/Cylinder_TEST.py index de4f7780d..8d64635ef 100644 --- a/src/python_pybind11/test/Cylinder_TEST.py +++ b/src/python_pybind11/test/Cylinder_TEST.py @@ -114,6 +114,11 @@ def test_mass(self): self.assertEqual(expectedMassMat, massMat) self.assertEqual(expectedMassMat.mass(), massMat.mass()) + massMat2 = cylinder.mass_matrix() + self.assertEqual(expectedMassMat, massMat2) + self.assertEqual(expectedMassMat.diagonal_moments(), massMat2.diagonal_moments()) + self.assertEqual(expectedMassMat.mass(), massMat2.mass()) + if __name__ == '__main__': unittest.main() diff --git a/src/python_pybind11/test/Sphere_TEST.py b/src/python_pybind11/test/Sphere_TEST.py index afd75ab46..6e213bc98 100644 --- a/src/python_pybind11/test/Sphere_TEST.py +++ b/src/python_pybind11/test/Sphere_TEST.py @@ -108,6 +108,11 @@ def test_mass(self): self.assertEqual(expectedMassMat, massMat) self.assertEqual(expectedMassMat.mass(), massMat.mass()) + massMat2 = sphere.mass_matrix() + self.assertEqual(expectedMassMat, massMat2) + self.assertEqual(expectedMassMat.diagonal_moments(), massMat2.diagonal_moments()) + self.assertEqual(expectedMassMat.mass(), massMat2.mass()) + def test_volume_below(self): r = 2