38 #include <boost/python.hpp>
40 #include <geometry_msgs/Vector3.h>
50 bool doCompare(
const std::vector<unsigned char>& data, PyObject* obj)
52 const char* py_data = PyBytes_AsString(obj);
55 Py_ssize_t size = PyBytes_GET_SIZE(obj);
56 if (size < 0 || std::vector<unsigned char>::size_type(size) != data.size())
58 return std::memcmp(py_data, &data[0], size) == 0;
64 const std::vector<unsigned char> testdata{ 0xff, 0xef, 0x00, 0x10 };
65 return doCompare(testdata, s.ptr());
70 const std::vector<unsigned char> testdata{
'm',
'n',
'o' };
71 return doCompare(testdata, s.ptr());
98 geometry_msgs::Vector3 v;
106 geometry_msgs::Vector3 v;
108 return v.x == 1.0 && v.y == -2.0 && v.z == 0.25;
118 bp::class_<ByteStringTestHelper> cls(
"ByteStringTestHelper");
bool compareVector(const ByteString &s)
bool compareVectorTuple(const bp::tuple &t)
ByteString getBytesStdString()
bool compareTuple(const bp::tuple &t)
ByteString getDefaultBytes()
bool compareEmbeddedZeros(const ByteString &s)
ByteString getBytesPChar()
BOOST_PYTHON_MODULE(_moveit_planning_interface_test_serialize_msg_cpp_helper)