diff --git a/unittest/python/test_std_vector.py b/unittest/python/test_std_vector.py index 532b7df80fa499ae0df794d6e2338bfebcb20fbe..b34a32cb9f3132439e40a77425f6c1ba72749061 100644 --- a/unittest/python/test_std_vector.py +++ b/unittest/python/test_std_vector.py @@ -85,11 +85,15 @@ print("-----------------") # pprint.pprint(list(l4)) # checkZero(l4) -# TODO fail -l5_copy = std_vector.StdVec_Mat2d(l5) +# Test StdVec_Mat2d that had been registered +# before calling exposeStdVectorEigenSpecificType -# test l5 == l5_copy == l5_py +# Test conversion and tolistl5 == l5_copy == l5_py +l5_copy = std_vector.StdVec_Mat2d(l5) l5_py = l5_copy.tolist() -# Test l5[0] is zero -l5[0].setZero() -# TODO test +checkAllValues(l5, l5_copy) +checkAllValues(l5, l5_py) + +# Test mutable __getitem__ +l5[0][:] = 0.0 +assert np.allclose(l5[0], 0.0) diff --git a/unittest/std_vector.cpp b/unittest/std_vector.cpp index 225eae1eb5d4905ea17ea32a35cf24d785d3bb2a..942d4ae4e3520875e4b3376b91f94c714be63f6b 100644 --- a/unittest/std_vector.cpp +++ b/unittest/std_vector.cpp @@ -52,9 +52,10 @@ BOOST_PYTHON_MODULE(std_vector) { // Test matrix modification // Mat2d don't have tolist, reserve, mutable __getitem__ and from list - // conversion exposeStdVectorEigenSpecificType must add those methods to Mat2d + // conversion + // exposeStdVectorEigenSpecificType must add those methods to StdVec_Mat2d bp::class_<std::vector<Eigen::Matrix2d> >("StdVec_Mat2d") .def(boost::python::vector_indexing_suite< std::vector<Eigen::Matrix2d> >()); - exposeStdVectorEigenSpecificType<Eigen::Matrix3d>("Mat2d"); + exposeStdVectorEigenSpecificType<Eigen::Matrix2d>("Mat2d"); }