def test_serializer(self):
     dut = mut.PySerializer(lcmt_quaternion)
     model_message = self._model_message()
     value = dut.CreateDefaultValue()
     self.assert_lcm_not_equal(value.get_value(), model_message)
     # Check deserialization.
     dut.Deserialize(model_message.encode(), value)
     self.assert_lcm_equal(value.get_value(), model_message)
     # Check serialization.
     raw = dut.Serialize(value)
     reconstruct = lcmt_quaternion.decode(raw)
     self.assert_lcm_equal(reconstruct, model_message)
Exemple #2
0
 def _cpp_value_to_py_message(self, value):
     serializer = mut._Serializer_[lcmt_quaternion]()
     raw = serializer.Serialize(value)
     return lcmt_quaternion.decode(raw)
Exemple #3
0
 def _handler(self, raw):
     quat = lcmt_quaternion.decode(raw)
     self.assertTupleEqual((quat.w, quat.x, quat.y, quat.z), self.wxyz)
     self.count += 1