Skip to content

Commit

Permalink
Minimal test
Browse files Browse the repository at this point in the history
  • Loading branch information
EzraBrooks committed Aug 27, 2024
1 parent f207f22 commit 3a677cd
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
18 changes: 18 additions & 0 deletions rosbridge_library/test/internal/test_message_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,3 +316,21 @@ def test_float32_msg(rostype, data):
ints = list(map(int, range(0, 16)))
ret = test_float32_msg(rostype, ints)
np.testing.assert_array_equal(ret, np.array(ints))

# Test a float32 array with a length with non-numeric characters in it
def test_float32_complexboundedarray(self):
def test_nestedboundedarray_msg(rostype, data):
msg = {"data": {"data": data}}
inst = ros_loader.get_message_instance(rostype)
c.populate_instance(msg, inst)
self.validate_instance(inst)
return inst.data

for msgtype in ["TestNestedBoundedArray"]:
rostype = "rosbridge_test_msgs/" + msgtype

# From List[float]
floats = list(map(float, range(0, 16)))
ret = test_nestedboundedarray_msg(rostype, floats)

self.assertEqual(c._from_inst(ret, rostype), {"data": floats})
1 change: 1 addition & 0 deletions rosbridge_test_msgs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ rosidl_generate_interfaces(${PROJECT_NAME}
msg/TestUInt8FixedSizeArray16.msg
msg/TestFloat32Array.msg
msg/TestFloat32BoundedArray.msg
msg/TestNestedBoundedArray.msg
srv/AddTwoInts.srv
srv/SendBytes.srv
srv/TestArrayRequest.srv
Expand Down
1 change: 1 addition & 0 deletions rosbridge_test_msgs/msg/TestNestedBoundedArray.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TestFloat32BoundedArray data

0 comments on commit 3a677cd

Please sign in to comment.