v01
This commit is contained in:
151
thirdparty/ros/ros_comm/test/test_roscpp/test/CMakeLists.txt
vendored
Normal file
151
thirdparty/ros/ros_comm/test/test_roscpp/test/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,151 @@
|
||||
catkin_add_gtest(${PROJECT_NAME}-test_version test_version.cpp)
|
||||
if(TARGET ${PROJECT_NAME}-test_version)
|
||||
target_link_libraries(${PROJECT_NAME}-test_version ${catkin_LIBRARIES})
|
||||
endif()
|
||||
|
||||
catkin_add_gtest(${PROJECT_NAME}-test_header test_header.cpp)
|
||||
if(TARGET ${PROJECT_NAME}-test_header)
|
||||
target_link_libraries(${PROJECT_NAME}-test_header ${catkin_LIBRARIES})
|
||||
endif()
|
||||
|
||||
catkin_add_gtest(${PROJECT_NAME}-test_poll_set test_poll_set.cpp)
|
||||
if(TARGET ${PROJECT_NAME}-test_poll_set)
|
||||
target_link_libraries(${PROJECT_NAME}-test_poll_set ${catkin_LIBRARIES})
|
||||
endif()
|
||||
|
||||
catkin_add_gtest(${PROJECT_NAME}-test_transport_tcp test_transport_tcp.cpp)
|
||||
if(TARGET ${PROJECT_NAME}-test_transport_tcp)
|
||||
target_link_libraries(${PROJECT_NAME}-test_transport_tcp ${catkin_LIBRARIES})
|
||||
endif()
|
||||
|
||||
catkin_add_gtest(${PROJECT_NAME}-test_subscription_queue test_subscription_queue.cpp)
|
||||
if(TARGET ${PROJECT_NAME}-test_subscription_queue)
|
||||
target_link_libraries(${PROJECT_NAME}-test_subscription_queue ${catkin_LIBRARIES})
|
||||
endif()
|
||||
|
||||
catkin_add_gtest(${PROJECT_NAME}-test_callback_queue test_callback_queue.cpp)
|
||||
if(TARGET ${PROJECT_NAME}-test_callback_queue)
|
||||
target_link_libraries(${PROJECT_NAME}-test_callback_queue ${catkin_LIBRARIES})
|
||||
endif()
|
||||
|
||||
catkin_add_gtest(${PROJECT_NAME}-test_names test_names.cpp)
|
||||
if(TARGET ${PROJECT_NAME}-test_names)
|
||||
target_link_libraries(${PROJECT_NAME}-test_names ${catkin_LIBRARIES})
|
||||
endif()
|
||||
|
||||
catkin_add_gtest(${PROJECT_NAME}-test_args test_args.cpp)
|
||||
if(TARGET ${PROJECT_NAME}-test_args)
|
||||
target_link_libraries(${PROJECT_NAME}-test_args ${catkin_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(GTEST_FOUND)
|
||||
add_subdirectory(src)
|
||||
endif()
|
||||
|
||||
add_rostest(launch/real_time_test.xml)
|
||||
add_rostest(launch/sim_time_test.xml)
|
||||
|
||||
# Publish one message
|
||||
add_rostest(launch/pubsub_once.xml)
|
||||
|
||||
# Publish a bunch of messages back to back
|
||||
add_rostest(launch/pubsub_n_fast.xml)
|
||||
add_rostest(launch/pubsub_n_fast_udp.xml)
|
||||
|
||||
# Publish a bunch of empty messages
|
||||
add_rostest(launch/pubsub_empty.xml)
|
||||
|
||||
# Publish only to the subscriber from the subscriber callback
|
||||
add_rostest(launch/pub_onsub.xml)
|
||||
|
||||
# Publish a bunch of large messages back to back
|
||||
add_rostest(launch/pubsub_n_fast_large_message.xml)
|
||||
|
||||
# Subscribe, listen, unsubscribe, re-subscribe to a different topic, listen
|
||||
# again
|
||||
add_rostest(launch/pubsub_resub_once.xml)
|
||||
|
||||
# Subscribe and unsubscribe repeatedly, ensuring that callbacks don't get
|
||||
# called when not subscribed.
|
||||
add_rostest(launch/pubsub_unsub.xml)
|
||||
|
||||
# Advertise, then unadvertise, and ensure that subscriber callback doesn't
|
||||
# get invoked afterward, while a subscriber is constantly subscribing and
|
||||
# unsubscribing
|
||||
add_rostest(launch/pubsub_unadv.xml)
|
||||
|
||||
# Call a service
|
||||
add_rostest(launch/service_call.xml)
|
||||
|
||||
# disabling the test again since it does not work realiable
|
||||
#add_rostest(launch/service_deadlock.xml)
|
||||
|
||||
add_rostest(launch/service_exception.xml)
|
||||
|
||||
add_rostest(launch/service_call_unadv.xml)
|
||||
|
||||
add_rostest(launch/service_call_zombie.xml)
|
||||
|
||||
# Repeatedly call ros::init() and ros::fini()
|
||||
add_rostest(launch/multiple_init_fini.xml)
|
||||
|
||||
# Test node inspection functionality
|
||||
add_rostest(launch/inspection.xml)
|
||||
|
||||
# Test that advertising a service multiple times fails
|
||||
add_rostest(launch/service_adv_multiple.xml)
|
||||
|
||||
# Test that the second node to advertise a service "wins"
|
||||
add_rostest(launch/service_multiple_providers.xml)
|
||||
|
||||
# Test namespaces
|
||||
add_rostest(launch/namespaces.xml)
|
||||
|
||||
# Test command-line name remapping
|
||||
add_rostest(launch/name_remapping.xml)
|
||||
|
||||
add_rostest(launch/name_not_remappable.xml)
|
||||
|
||||
# Test command-line name remapping
|
||||
add_rostest(launch/name_remapping_ROS_NAMESPACE.xml)
|
||||
|
||||
# Test params
|
||||
add_rostest(launch/params.xml)
|
||||
|
||||
# Test getting information from the master
|
||||
add_rostest(launch/get_master_information.xml)
|
||||
|
||||
# Test multiple subscriptions
|
||||
add_rostest(launch/multiple_subscriptions.xml)
|
||||
|
||||
add_rostest(launch/pingpong.xml)
|
||||
add_rostest(launch/pingpong_large.xml)
|
||||
|
||||
add_rostest(launch/subscribe_self.xml)
|
||||
|
||||
add_rostest(launch/check_master.xml)
|
||||
#add_rostest(launch/check_master_false.xml)
|
||||
|
||||
add_rostest(launch/handles.xml)
|
||||
add_rostest(launch/timer_callbacks.xml)
|
||||
add_rostest(launch/latching_publisher.xml)
|
||||
add_rostest(launch/loads_of_publishers.xml)
|
||||
add_rostest(launch/incrementing_sequence.xml)
|
||||
add_rostest(launch/subscription_callback_types.xml)
|
||||
add_rostest(launch/service_callback_types.xml)
|
||||
add_rostest(launch/intraprocess_subscriptions.xml)
|
||||
add_rostest(launch/nonconst_subscriptions.xml)
|
||||
add_rostest(launch/subscribe_retry_tcp.xml)
|
||||
add_rostest(launch/subscribe_star.xml)
|
||||
add_rostest(launch/parameter_validation.xml)
|
||||
|
||||
add_rostest(launch/no_remappings.xml)
|
||||
add_rostest(launch/local_remappings.xml)
|
||||
add_rostest(launch/global_remappings.xml)
|
||||
add_rostest(launch/ns_node_remapping.xml)
|
||||
add_rostest(launch/search_param.xml)
|
||||
|
||||
add_rostest(launch/stamped_topic_statistics_with_empty_timestamp.xml)
|
||||
|
||||
# Test spinners
|
||||
add_rostest(launch/spinners.xml)
|
||||
4
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/check_master.xml
vendored
Normal file
4
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/check_master.xml
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<launch>
|
||||
<test test-name="check_master_true" pkg="test_roscpp" type="test_roscpp-check_master" args="yes"/>
|
||||
</launch>
|
||||
|
||||
4
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/check_master_false.xml
vendored
Normal file
4
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/check_master_false.xml
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<launch>
|
||||
<test test-name="check_master_false" pkg="test_roscpp" type="test_roscpp-check_master" args="no"/>
|
||||
</launch>
|
||||
|
||||
4
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/fragmented_udp_data.launch
vendored
Normal file
4
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/fragmented_udp_data.launch
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<launch>
|
||||
<node name="publisher" pkg="test_roscpp" type="test_roscpp-publisher" output="screen" />
|
||||
<node name="subscriber" pkg="test_roscpp" type="test_roscpp-subscriber" output="screen" />
|
||||
</launch>
|
||||
3
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/get_master_information.xml
vendored
Normal file
3
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/get_master_information.xml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
<launch>
|
||||
<test test-name="get_master_information" pkg="test_roscpp" type="test_roscpp-get_master_information"/>
|
||||
</launch>
|
||||
8
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/global_remappings.xml
vendored
Normal file
8
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/global_remappings.xml
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<launch>
|
||||
|
||||
<param name="use_local_remap" type="bool" value="false" />
|
||||
<remap from="base_namespace" to="remapped_base_namespace" />
|
||||
<remap from="remapped_base_namespace/sub_namespace" to="remapped_base_namespace/remapped_sub_namespace" />
|
||||
<test test-name="global_remappings" pkg="test_roscpp" type="test_roscpp-test_remapping"
|
||||
args="/remapped_base_namespace /remapped_base_namespace/remapped_sub_namespace"/>
|
||||
</launch>
|
||||
3
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/handles.xml
vendored
Normal file
3
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/handles.xml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
<launch>
|
||||
<test test-name="handles" pkg="test_roscpp" type="test_roscpp-handles"/>
|
||||
</launch>
|
||||
4
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/incrementing_sequence.xml
vendored
Normal file
4
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/incrementing_sequence.xml
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<launch>
|
||||
<test test-name="incrementing_sequence" pkg="test_roscpp" type="test_roscpp-incrementing_sequence"/>
|
||||
</launch>
|
||||
|
||||
3
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/inspection.xml
vendored
Normal file
3
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/inspection.xml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
<launch>
|
||||
<test test-name="inspection" pkg="test_roscpp" type="test_roscpp-inspection"/>
|
||||
</launch>
|
||||
3
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/intraprocess_subscriptions.xml
vendored
Normal file
3
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/intraprocess_subscriptions.xml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
<launch>
|
||||
<test test-name="intraprocess_subscriptions" pkg="test_roscpp" type="test_roscpp-intraprocess_subscriptions"/>
|
||||
</launch>
|
||||
3
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/latching_publisher.xml
vendored
Normal file
3
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/latching_publisher.xml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
<launch>
|
||||
<test test-name="latching_publisher" pkg="test_roscpp" type="test_roscpp-latching_publisher"/>
|
||||
</launch>
|
||||
14
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/left_right.xml
vendored
Normal file
14
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/left_right.xml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<!-- This file is not part of automated testing. -->
|
||||
<launch>
|
||||
<node pkg="test_roscpp" type="test_roscpp-left_right" name="left_right_swapped">
|
||||
<remap from="right" to="left"/>
|
||||
<remap from="left" to="right"/>
|
||||
</node>
|
||||
|
||||
<test test-name="left_right_swappy" pkg="test_roscpp" type="test_roscpp-string_msg_expect"
|
||||
args="left /right"/>
|
||||
|
||||
<test test-name="left_right_swappy_2" pkg="test_roscpp" type="test_roscpp-string_msg_expect"
|
||||
args="right /left"/>
|
||||
|
||||
</launch>
|
||||
107
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/loads_of_publishers.xml
vendored
Normal file
107
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/loads_of_publishers.xml
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
<launch>
|
||||
<node pkg="test_roscpp" type="test_roscpp-publish_constantly" name="publish_constantly1" />
|
||||
<node pkg="test_roscpp" type="test_roscpp-publish_constantly" name="publish_constantly2" />
|
||||
<node pkg="test_roscpp" type="test_roscpp-publish_constantly" name="publish_constantly3" />
|
||||
<node pkg="test_roscpp" type="test_roscpp-publish_constantly" name="publish_constantly4" />
|
||||
<node pkg="test_roscpp" type="test_roscpp-publish_constantly" name="publish_constantly5" />
|
||||
<node pkg="test_roscpp" type="test_roscpp-publish_constantly" name="publish_constantly6" />
|
||||
<node pkg="test_roscpp" type="test_roscpp-publish_constantly" name="publish_constantly7" />
|
||||
<node pkg="test_roscpp" type="test_roscpp-publish_constantly" name="publish_constantly8" />
|
||||
<node pkg="test_roscpp" type="test_roscpp-publish_constantly" name="publish_constantly9" />
|
||||
<node pkg="test_roscpp" type="test_roscpp-publish_constantly" name="publish_constantly10" />
|
||||
<node pkg="test_roscpp" type="test_roscpp-publish_constantly" name="publish_constantly11" />
|
||||
<node pkg="test_roscpp" type="test_roscpp-publish_constantly" name="publish_constantly12" />
|
||||
<node pkg="test_roscpp" type="test_roscpp-publish_constantly" name="publish_constantly13" />
|
||||
<node pkg="test_roscpp" type="test_roscpp-publish_constantly" name="publish_constantly14" />
|
||||
<node pkg="test_roscpp" type="test_roscpp-publish_constantly" name="publish_constantly15" />
|
||||
<node pkg="test_roscpp" type="test_roscpp-publish_constantly" name="publish_constantly16" />
|
||||
<node pkg="test_roscpp" type="test_roscpp-publish_constantly" name="publish_constantly17" />
|
||||
<node pkg="test_roscpp" type="test_roscpp-publish_constantly" name="publish_constantly18" />
|
||||
<node pkg="test_roscpp" type="test_roscpp-publish_constantly" name="publish_constantly19" />
|
||||
<node pkg="test_roscpp" type="test_roscpp-publish_constantly" name="publish_constantly20" />
|
||||
|
||||
<!--
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly21" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly22" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly23" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly24" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly25" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly26" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly27" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly28" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly29" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly30" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly31" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly32" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly33" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly34" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly35" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly36" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly37" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly38" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly39" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly40" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly41" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly42" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly43" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly44" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly45" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly46" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly47" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly48" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly49" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly50" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly51" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly52" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly53" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly54" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly55" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly56" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly57" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly58" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly59" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly60" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly61" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly62" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly63" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly64" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly65" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly66" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly67" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly68" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly69" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly70" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly71" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly72" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly73" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly74" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly75" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly76" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly77" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly78" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly79" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly80" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly81" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly82" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly83" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly84" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly85" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly86" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly87" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly88" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly89" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly90" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly91" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly92" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly93" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly94" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly95" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly96" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly97" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly98" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly99" />
|
||||
<node pkg="test_roscpp" type="publish_constantly" name="publish_constantly100" />
|
||||
-->
|
||||
|
||||
<test test-name="loads_of_publishers" pkg="test_roscpp" type="test_roscpp-loads_of_publishers" args="20" time-limit="200" />
|
||||
</launch>
|
||||
9
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/local_remappings.xml
vendored
Normal file
9
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/local_remappings.xml
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<launch>
|
||||
|
||||
<param name="use_local_remap" type="bool" value="true" />
|
||||
<param name="remap_from" value="sub_namespace"/>
|
||||
<param name="remap_to" value="different_sub_namespace" />
|
||||
<test test-name="local_remappings" pkg="test_roscpp" type="test_roscpp-test_remapping"
|
||||
args="/base_namespace /base_namespace/different_sub_namespace" />
|
||||
|
||||
</launch>
|
||||
3
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/multiple_init_fini.xml
vendored
Normal file
3
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/multiple_init_fini.xml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
<launch>
|
||||
<test test-name="multiple_init_fini" pkg="test_roscpp" type="test_roscpp-multiple_init_fini" args="15"/>
|
||||
</launch>
|
||||
4
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/multiple_subscriptions.xml
vendored
Normal file
4
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/multiple_subscriptions.xml
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<launch>
|
||||
<node pkg="test_roscpp" type="test_roscpp-publish_constantly" name="publish_constantly" />
|
||||
<test test-name="multiple_subscriptions" pkg="test_roscpp" type="test_roscpp-multiple_subscriptions" />
|
||||
</launch>
|
||||
8
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/name_not_remappable.xml
vendored
Normal file
8
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/name_not_remappable.xml
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<launch>
|
||||
<param name="use_local_remap" type="bool" value="false" />
|
||||
|
||||
<remap from="NAME" to="something_else_entirely"/>
|
||||
|
||||
<test test-name="name_not_remappable" pkg="test_roscpp" type="test_roscpp-name_not_remappable"
|
||||
name="NAME"/>
|
||||
</launch>
|
||||
15
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/name_remapping.xml
vendored
Normal file
15
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/name_remapping.xml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
<launch>
|
||||
<param name="mapto" value="mapto_value" type="str"/>
|
||||
<test test-name="name_remapped" pkg="test_roscpp"
|
||||
type="test_roscpp-name_remapping"
|
||||
args="mapfrom:=mapto"/>
|
||||
|
||||
<param name="/b/test_full" value="asdf" type="str"/>
|
||||
<param name="/a/test_local2" value="asdf" type="str"/>
|
||||
<param name="/b/test_relative" value="asdf" type="str"/>
|
||||
<test test-name="name_remapped_with_ns"
|
||||
pkg="test_roscpp"
|
||||
type="test_roscpp-name_remapping_with_ns"
|
||||
ns="a"
|
||||
args="/a/test_full:=/b/test_full /a/test_local:=test_local2 test_relative:=/b/test_relative"/>
|
||||
</launch>
|
||||
17
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/name_remapping_ROS_NAMESPACE.xml
vendored
Normal file
17
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/name_remapping_ROS_NAMESPACE.xml
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
<launch>
|
||||
<param name="mapto" value="mapto_value" type="str"/>
|
||||
<test test-name="name_remapped" pkg="test_roscpp"
|
||||
type="test_roscpp-name_remapping"
|
||||
args="mapfrom:=mapto"/>
|
||||
|
||||
<param name="/b/test_full" value="asdf" type="str"/>
|
||||
<param name="/a/test_local2" value="asdf" type="str"/>
|
||||
<param name="/b/test_relative" value="asdf" type="str"/>
|
||||
<test test-name="name_remapped_with_ns"
|
||||
pkg="test_roscpp"
|
||||
type="test_roscpp-name_remapping_with_ns"
|
||||
ns="a"
|
||||
args="/a/test_full:=/b/test_full /a/test_local:=test_local2 test_relative:=/b/test_relative"/>
|
||||
<!-- ignored, overridden by ns above -->
|
||||
<env name="ROS_NAMESPACE" value="ROS_NAMESPACE"/>
|
||||
</launch>
|
||||
11
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/namespaces.xml
vendored
Normal file
11
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/namespaces.xml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<launch>
|
||||
<param name="/ROS_NAMESPACE/parent" value=":ROS_NAMESPACE:parent"/>
|
||||
<param name="/ROS_NAMESPACE/NODE_NAME/local"
|
||||
value=":ROS_NAMESPACE:NODE_NAME:local"/>
|
||||
<param name="/global" value=":global"/>
|
||||
<param name="/other_namespace/param" value=":other_namespace:param"/>
|
||||
<test test-name="namespaces" pkg="test_roscpp"
|
||||
type="test_roscpp-namespaces" name="NODE_NAME">
|
||||
<env name="ROS_NAMESPACE" value="ROS_NAMESPACE"/>
|
||||
</test>
|
||||
</launch>
|
||||
6
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/no_remappings.xml
vendored
Normal file
6
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/no_remappings.xml
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<launch>
|
||||
|
||||
<param name="use_local_remap" type="bool" value="false" />
|
||||
<test test-name="no_remappings" pkg="test_roscpp" type="test_roscpp-test_remapping"
|
||||
args="/base_namespace /base_namespace/sub_namespace"/>
|
||||
</launch>
|
||||
3
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/nonconst_subscriptions.xml
vendored
Normal file
3
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/nonconst_subscriptions.xml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
<launch>
|
||||
<test test-name="nonconst_subscriptions" pkg="test_roscpp" type="test_roscpp-nonconst_subscriptions"/>
|
||||
</launch>
|
||||
3
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/ns_node_remapping.xml
vendored
Normal file
3
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/ns_node_remapping.xml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
<launch>
|
||||
<test test-name="ns_node_remapping" pkg="test_roscpp" type="test_roscpp-test_ns_node_remapping"/>
|
||||
</launch>
|
||||
4
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/parameter_validation.xml
vendored
Normal file
4
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/parameter_validation.xml
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<launch>
|
||||
<test test-name="parameter_validation" pkg="test_roscpp" type="test_roscpp-parameter_validation"/>
|
||||
</launch>
|
||||
|
||||
8
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/params.xml
vendored
Normal file
8
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/params.xml
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<launch>
|
||||
<param name="string" value="test" type="str"/>
|
||||
<param name="int" value="10" type="int"/>
|
||||
<param name="double" value="10.5" type="double"/>
|
||||
<param name="bool" value="0" type="bool"/>
|
||||
<test test-name="params" pkg="test_roscpp" type="test_roscpp-params" time-limit="1000000">
|
||||
</test>
|
||||
</launch>
|
||||
5
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/pingpong.xml
vendored
Normal file
5
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/pingpong.xml
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<launch>
|
||||
<node name="pub_sub" pkg="test_roscpp" type="test_roscpp-pub_sub" args="1"/>
|
||||
<test test-name="pingpong" pkg="test_roscpp" type="test_roscpp-sub_pub" args="5000 10.0"/>
|
||||
</launch>
|
||||
|
||||
6
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/pingpong_large.xml
vendored
Normal file
6
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/pingpong_large.xml
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<launch>
|
||||
<node pkg="test_roscpp" type="test_roscpp-pub_sub" name="pub_sub" args="1000"/>
|
||||
<test test-name="pingpong_large" pkg="test_roscpp"
|
||||
type="test_roscpp-sub_pub" args="100 5.0"/>
|
||||
</launch>
|
||||
|
||||
5
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/pub_onsub.xml
vendored
Normal file
5
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/pub_onsub.xml
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<launch>
|
||||
<node name="publish_onsub" pkg="test_roscpp" type="test_roscpp-publish_onsub" args="10"/>
|
||||
<test test-name="pub_onsub" pkg="test_roscpp" type="test_roscpp-subscribe_empty" args="10 1.5"/>
|
||||
</launch>
|
||||
|
||||
5
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/pubsub_empty.xml
vendored
Normal file
5
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/pubsub_empty.xml
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<launch>
|
||||
<node name="publish_empty" pkg="test_roscpp" type="test_roscpp-publish_empty" args="1000"/>
|
||||
<test test-name="pubsub_empty" pkg="test_roscpp" type="test_roscpp-subscribe_empty" args="1000 1.5"/>
|
||||
</launch>
|
||||
|
||||
6
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/pubsub_n_fast.xml
vendored
Normal file
6
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/pubsub_n_fast.xml
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<launch>
|
||||
<node pkg="test_roscpp" type="test_roscpp-publish_n_fast" name="publish_n_fast" args="10000 1 1"/>
|
||||
<test test-name="pubsub_n_fast" pkg="test_roscpp"
|
||||
type="test_roscpp-subscribe_n_fast" args="tcp 10000 10.0"/>
|
||||
</launch>
|
||||
|
||||
6
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/pubsub_n_fast_large_message.xml
vendored
Normal file
6
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/pubsub_n_fast_large_message.xml
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<launch>
|
||||
<node pkg="test_roscpp" type="test_roscpp-publish_n_fast" name="publish_n_fast" args="50 100000 1000000"/>
|
||||
<test test-name="pubsub_n_fast_large_message" pkg="test_roscpp"
|
||||
type="test_roscpp-subscribe_n_fast" args="tcp 50 10.0"/>
|
||||
</launch>
|
||||
|
||||
6
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/pubsub_n_fast_udp.xml
vendored
Normal file
6
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/pubsub_n_fast_udp.xml
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<launch>
|
||||
<node pkg="test_roscpp" type="test_roscpp-publish_n_fast" name="publish_n_fast" args="10000 1 1"/>
|
||||
<test test-name="pubsub_n_fast_udp" pkg="test_roscpp"
|
||||
type="test_roscpp-subscribe_n_fast" args="udp 10000 5.0"/>
|
||||
</launch>
|
||||
|
||||
4
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/pubsub_once.xml
vendored
Normal file
4
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/pubsub_once.xml
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<launch>
|
||||
<node name="publish_n_fast" pkg="test_roscpp" type="test_roscpp-publish_n_fast" args="1 1 1"/>
|
||||
<test test-name="pubsub_once" pkg="test_roscpp" type="test_roscpp-subscribe_n_fast" args="tcp 1 1.0"/>
|
||||
</launch>
|
||||
7
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/pubsub_resub_once.xml
vendored
Normal file
7
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/pubsub_resub_once.xml
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<launch>
|
||||
<node pkg="test_roscpp" type="test_roscpp-publish_n_fast" name="publish_n_fast" args="1 1 1"/>
|
||||
<node pkg="test_roscpp" type="test_roscpp-publish_n_fast" name="publish_n_fast2" args="1 1 1 roscpp/pubsub_test:=roscpp/pubsub_test2">
|
||||
<remap from="roscpp/pubsub_test" to="roscpp/pubsub_test2"/>
|
||||
</node>
|
||||
<test test-name="pubsub_resub_once" pkg="test_roscpp" type="test_roscpp-subscribe_resubscribe" args="1 1.0"/>
|
||||
</launch>
|
||||
4
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/pubsub_unadv.xml
vendored
Normal file
4
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/pubsub_unadv.xml
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<launch>
|
||||
<node pkg="test_roscpp" type="test_roscpp-subscribe_unsubscribe_repeatedly" name="subscribe_unsubscribe_repeatedly" />
|
||||
<test test-name="pubsub_unadv" pkg="test_roscpp" type="test_roscpp-publish_unadvertise" args=""/>
|
||||
</launch>
|
||||
4
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/pubsub_unsub.xml
vendored
Normal file
4
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/pubsub_unsub.xml
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<launch>
|
||||
<node pkg="test_roscpp" type="test_roscpp-publish_constantly" name="publish_constantly" />
|
||||
<test test-name="pubsub_unsub" pkg="test_roscpp" type="test_roscpp-subscribe_unsubscribe" args="" />
|
||||
</launch>
|
||||
4
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/real_time_test.xml
vendored
Normal file
4
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/real_time_test.xml
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<launch>
|
||||
<test test-name="timetest_real" pkg="test_roscpp" type="test_roscpp-real_time_test" args=""/>
|
||||
</launch>
|
||||
|
||||
3
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/search_param.xml
vendored
Normal file
3
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/search_param.xml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
<launch>
|
||||
<test test-name="test_search_param" pkg="test_roscpp" type="test_roscpp-test_search_param"/>
|
||||
</launch>
|
||||
5
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/service_adv_multiple.xml
vendored
Normal file
5
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/service_adv_multiple.xml
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<launch>
|
||||
<test test-name="service_adv_multiple" pkg="test_roscpp" type="test_roscpp-service_adv_multiple"/>
|
||||
</launch>
|
||||
|
||||
|
||||
6
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/service_call.xml
vendored
Normal file
6
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/service_call.xml
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<launch>
|
||||
<node name="service_adv" pkg="test_roscpp" type="test_roscpp-service_adv"/>
|
||||
<test test-name="service_call" pkg="test_roscpp" type="test_roscpp-service_call"/>
|
||||
</launch>
|
||||
|
||||
|
||||
5
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/service_call_unadv.xml
vendored
Normal file
5
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/service_call_unadv.xml
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<launch>
|
||||
<node name="service_call_repeatedly" pkg="test_roscpp" type="test_roscpp-service_call_repeatedly"/>
|
||||
<test test-name="service_call_unadv" pkg="test_roscpp" type="test_roscpp-service_adv_unadv" args=""/>
|
||||
</launch>
|
||||
|
||||
6
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/service_call_zombie.xml
vendored
Normal file
6
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/service_call_zombie.xml
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<launch>
|
||||
<node name="dying_service" pkg="test_roscpp" type="test_roscpp-service_adv_zombie"/>
|
||||
<test test-name="service_call_zombie" pkg="test_roscpp" type="test_roscpp-service_call_zombie" time-limit="30"/>
|
||||
</launch>
|
||||
|
||||
|
||||
4
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/service_callback_types.xml
vendored
Normal file
4
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/service_callback_types.xml
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<launch>
|
||||
<test test-name="service_callback_types" pkg="test_roscpp" type="test_roscpp-service_callback_types"/>
|
||||
</launch>
|
||||
|
||||
5
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/service_deadlock.xml
vendored
Normal file
5
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/service_deadlock.xml
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<launch>
|
||||
<test test-name="service_deadlock" pkg="test_roscpp" type="test_roscpp-service_deadlock"/>
|
||||
</launch>
|
||||
|
||||
|
||||
5
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/service_exception.xml
vendored
Normal file
5
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/service_exception.xml
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<launch>
|
||||
<test test-name="service_exception" pkg="test_roscpp" type="test_roscpp-service_exception"/>
|
||||
</launch>
|
||||
|
||||
|
||||
7
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/service_multiple_providers.xml
vendored
Normal file
7
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/service_multiple_providers.xml
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<launch>
|
||||
<node name="service_adv_a" pkg="test_roscpp" type="test_roscpp-service_adv_a"/>
|
||||
<node name="service_adv_b" pkg="test_roscpp" type="test_roscpp-service_wait_a_adv_b"/>
|
||||
<test test-name="service_multiple_providers" pkg="test_roscpp" type="test_roscpp-service_call_expect_b"/>
|
||||
</launch>
|
||||
|
||||
|
||||
5
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/sim_time_test.xml
vendored
Normal file
5
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/sim_time_test.xml
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<launch>
|
||||
<param name="/use_sim_time" type="bool" value="true"/>
|
||||
<test test-name="timetest_sim" pkg="test_roscpp" type="test_roscpp-sim_time_test" args=""/>
|
||||
</launch>
|
||||
|
||||
4
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/spinners.xml
vendored
Normal file
4
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/spinners.xml
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<launch>
|
||||
<test pkg="test_roscpp" type="test_roscpp-spinners" test-name="Spinners_spin" args="--gtest_filter=Spinners.spin"/>
|
||||
<test pkg="test_roscpp" type="test_roscpp-spinners" test-name="Spinners_multi" args="--gtest_filter=Spinners.multi"/>
|
||||
</launch>
|
||||
@@ -0,0 +1,5 @@
|
||||
<launch>
|
||||
<param name="enable_statistics" value="true" />
|
||||
<test test-name="stamped_topic_statistics_with_empty_timestamp" pkg="test_roscpp" type="test_roscpp-stamped_topic_statistics_empty_timestamp"/>
|
||||
</launch>
|
||||
|
||||
8
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/subscribe_retry_tcp.xml
vendored
Normal file
8
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/subscribe_retry_tcp.xml
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<launch>
|
||||
<node name="publish_constantly" pkg="test_roscpp" type="test_roscpp-publish_constantly">
|
||||
<env name="ROSCPP_ENABLE_DEBUG" value="1"/>
|
||||
</node>
|
||||
<test test-name="subscribe_retry_tcp" pkg="test_roscpp" type="test_roscpp-subscribe_retry_tcp"/>
|
||||
</launch>
|
||||
|
||||
|
||||
3
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/subscribe_self.xml
vendored
Normal file
3
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/subscribe_self.xml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
<launch>
|
||||
<test test-name="subscribe_self" pkg="test_roscpp" type="test_roscpp-subscribe_self" args="100 1.0"/>
|
||||
</launch>
|
||||
5
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/subscribe_star.xml
vendored
Normal file
5
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/subscribe_star.xml
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<launch>
|
||||
<node pkg="test_roscpp" type="test_roscpp-publisher_for_star_subscriber" name="publisher_for_star_subscriber"/>
|
||||
<test test-name="subscribe_star" pkg="test_roscpp" type="test_roscpp-subscribe_star" />
|
||||
</launch>
|
||||
|
||||
4
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/subscription_callback_types.xml
vendored
Normal file
4
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/subscription_callback_types.xml
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<launch>
|
||||
<test test-name="subscription_callback_types" pkg="test_roscpp" type="test_roscpp-subscription_callback_types"/>
|
||||
</launch>
|
||||
|
||||
25
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/test-node.xml
vendored
Normal file
25
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/test-node.xml
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<!-- This file is not part of automated testing. -->
|
||||
<launch>
|
||||
<node name="test_node" pkg="test_roscpp" type="test_roscpp-test_node" />
|
||||
<test test-name="test_roscpp__global" pkg="test_ros" type="test_node_api.py" />
|
||||
|
||||
<group>
|
||||
<!-- test within same namespace with test_node renamed to 'test_node2' -->
|
||||
<node pkg="test_roscpp" type="test_roscpp-test_node" name="test_node2" />
|
||||
<test test-name="test_roscpp__global_test_node2" pkg="test_ros" type="test_node_api.py" args="--node=test_node2"/>
|
||||
</group>
|
||||
|
||||
<!-- test with nodes within namespaces -->
|
||||
|
||||
<group ns="child_namespace">
|
||||
<node pkg="test_roscpp" type="test_roscpp-test_node" />
|
||||
<test test-name="test_roscpp__child_namespace" pkg="test_ros" type="test_node_api.py" />
|
||||
|
||||
<group ns="grandchild_namespace">
|
||||
<node pkg="test_roscpp" type="test_roscpp-test_node" />
|
||||
<test test-name="test_roscpp__grandchild_namespace" pkg="test_ros" type="test_node_api.py" />
|
||||
</group>
|
||||
|
||||
</group>
|
||||
|
||||
</launch>
|
||||
3
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/timer_callbacks.xml
vendored
Normal file
3
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/timer_callbacks.xml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
<launch>
|
||||
<test test-name="timer_callbacks" pkg="test_roscpp" type="test_roscpp-timer_callbacks" time-limit="120"/>
|
||||
</launch>
|
||||
4
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/wait_for_message.xml
vendored
Normal file
4
thirdparty/ros/ros_comm/test/test_roscpp/test/launch/wait_for_message.xml
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<!-- This file is not part of automated testing. -->
|
||||
<launch>
|
||||
<test test-name="wait_for_message" pkg="test_roscpp" type="test_roscpp-wait_for_message"/>
|
||||
</launch>
|
||||
2
thirdparty/ros/ros_comm/test/test_roscpp/test/msg/TestArray.msg
vendored
Normal file
2
thirdparty/ros/ros_comm/test/test_roscpp/test/msg/TestArray.msg
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
int32 counter
|
||||
float64[] float_arr
|
||||
0
thirdparty/ros/ros_comm/test/test_roscpp/test/msg/TestEmpty.msg
vendored
Normal file
0
thirdparty/ros/ros_comm/test/test_roscpp/test/msg/TestEmpty.msg
vendored
Normal file
2
thirdparty/ros/ros_comm/test/test_roscpp/test/msg/TestStringInt.msg
vendored
Normal file
2
thirdparty/ros/ros_comm/test/test_roscpp/test/msg/TestStringInt.msg
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
string str
|
||||
int32 counter
|
||||
1
thirdparty/ros/ros_comm/test/test_roscpp/test/msg/TestWithHeader.msg
vendored
Normal file
1
thirdparty/ros/ros_comm/test/test_roscpp/test/msg/TestWithHeader.msg
vendored
Normal file
@@ -0,0 +1 @@
|
||||
Header header
|
||||
21
thirdparty/ros/ros_comm/test/test_roscpp/test/scripts/test_udp_with_dropped_packets.sh
vendored
Executable file
21
thirdparty/ros/ros_comm/test/test_roscpp/test/scripts/test_udp_with_dropped_packets.sh
vendored
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
DROP_PROBABILITY=0.01
|
||||
IP=192.168.99.99
|
||||
|
||||
RULE="-i lo -d $IP -m statistic --mode random --probability $DROP_PROBABILITY -j DROP"
|
||||
|
||||
echo "Creating an additional loopback IP for testing..."
|
||||
sudo ifconfig lo:1 $IP
|
||||
|
||||
echo "Using iptables to drop packets at a set probability..."
|
||||
sudo iptables -A INPUT $RULE
|
||||
|
||||
echo "Running the test..."
|
||||
export ROS_HOSTNAME=$IP
|
||||
export ROS_MASTER_URI=http://$ROS_HOSTNAME:11311
|
||||
roslaunch test_roscpp fragmented_udp_data.launch
|
||||
|
||||
echo "Cleaning up..."
|
||||
sudo iptables -D INPUT $RULE
|
||||
sudo ifconfig lo:1 down
|
||||
348
thirdparty/ros/ros_comm/test/test_roscpp/test/src/CMakeLists.txt
vendored
Normal file
348
thirdparty/ros/ros_comm/test/test_roscpp/test/src/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,348 @@
|
||||
include_directories(${GTEST_INCLUDE_DIRS})
|
||||
|
||||
link_directories(${GTEST_LIBRARY_DIRS})
|
||||
|
||||
add_executable(${PROJECT_NAME}-handles EXCLUDE_FROM_ALL handles.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-handles ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-timer_callbacks EXCLUDE_FROM_ALL timer_callbacks.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-timer_callbacks ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-latching_publisher EXCLUDE_FROM_ALL latching_publisher.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-latching_publisher ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-publish_n_fast EXCLUDE_FROM_ALL publish_n_fast.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-publish_n_fast ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-subscribe_self EXCLUDE_FROM_ALL subscribe_self.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-subscribe_self ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-pub_sub EXCLUDE_FROM_ALL pub_sub.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-pub_sub ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-sub_pub EXCLUDE_FROM_ALL sub_pub.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-sub_pub ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-publish_empty EXCLUDE_FROM_ALL publish_empty.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-publish_empty ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-publish_onsub EXCLUDE_FROM_ALL publish_onsub.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-publish_onsub ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-subscribe_n_fast EXCLUDE_FROM_ALL subscribe_n_fast.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-subscribe_n_fast ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-subscribe_empty EXCLUDE_FROM_ALL subscribe_empty.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-subscribe_empty ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-subscribe_resubscribe EXCLUDE_FROM_ALL subscribe_resubscribe.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-subscribe_resubscribe ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-subscribe_unsubscribe EXCLUDE_FROM_ALL subscribe_unsubscribe.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-subscribe_unsubscribe ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-publish_unadvertise EXCLUDE_FROM_ALL publish_unadvertise.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-publish_unadvertise ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-subscribe_unsubscribe_repeatedly EXCLUDE_FROM_ALL subscribe_unsubscribe_repeatedly.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-subscribe_unsubscribe_repeatedly ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-publish_constantly EXCLUDE_FROM_ALL publish_constantly.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-publish_constantly ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-param_update_test EXCLUDE_FROM_ALL param_update_test.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-param_update_test ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-real_time_test EXCLUDE_FROM_ALL real_time_test.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-real_time_test ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
add_dependencies(${PROJECT_NAME}-real_time_test ${rosgraph_msgs_EXPORTED_TARGETS})
|
||||
|
||||
add_executable(${PROJECT_NAME}-sim_time_test EXCLUDE_FROM_ALL sim_time_test.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-sim_time_test ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
add_dependencies(${PROJECT_NAME}-sim_time_test ${rosgraph_msgs_EXPORTED_TARGETS})
|
||||
|
||||
# Call a service
|
||||
add_executable(${PROJECT_NAME}-service_adv EXCLUDE_FROM_ALL service_adv.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-service_adv ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-service_adv_unadv EXCLUDE_FROM_ALL service_adv_unadv.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-service_adv_unadv ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-service_call EXCLUDE_FROM_ALL service_call.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-service_call ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-service_call_zombie EXCLUDE_FROM_ALL service_call_zombie.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-service_call_zombie ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-service_deadlock EXCLUDE_FROM_ALL service_deadlock.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-service_deadlock ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
add_dependencies(${PROJECT_NAME}-service_deadlock ${std_srvs_EXPORTED_TARGETS})
|
||||
|
||||
add_executable(${PROJECT_NAME}-service_call_repeatedly EXCLUDE_FROM_ALL service_call_repeatedly.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-service_call_repeatedly ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-service_exception EXCLUDE_FROM_ALL service_exception.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-service_exception ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
add_dependencies(${PROJECT_NAME}-service_exception ${std_srvs_EXPORTED_TARGETS})
|
||||
|
||||
# Repeatedly call ros::init()
|
||||
add_executable(${PROJECT_NAME}-multiple_init_fini EXCLUDE_FROM_ALL multiple_init_fini.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-multiple_init_fini ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
# Test node inspection functionality
|
||||
add_executable(${PROJECT_NAME}-inspection EXCLUDE_FROM_ALL inspection.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-inspection ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
# Test that advertising a service multiple times fails
|
||||
add_executable(${PROJECT_NAME}-service_adv_multiple EXCLUDE_FROM_ALL service_adv_multiple.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-service_adv_multiple ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
# Test that the second node to advertise a service "wins"
|
||||
add_executable(${PROJECT_NAME}-service_adv_a EXCLUDE_FROM_ALL service_adv_a.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-service_adv_a ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-service_wait_a_adv_b EXCLUDE_FROM_ALL service_wait_a_adv_b.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-service_wait_a_adv_b ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
# Zombie (node crashed) service
|
||||
add_executable(${PROJECT_NAME}-service_adv_zombie EXCLUDE_FROM_ALL service_adv_zombie.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-service_adv_zombie ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-service_call_expect_b EXCLUDE_FROM_ALL service_call_expect_b.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-service_call_expect_b ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
# Test command-line name remapping
|
||||
add_executable(${PROJECT_NAME}-name_remapping EXCLUDE_FROM_ALL name_remapping.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-name_remapping ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
add_executable(${PROJECT_NAME}-name_remapping_with_ns EXCLUDE_FROM_ALL name_remapping_with_ns.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-name_remapping_with_ns ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
# Test namespaces
|
||||
add_executable(${PROJECT_NAME}-namespaces EXCLUDE_FROM_ALL namespaces.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-namespaces ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
# Test params
|
||||
add_executable(${PROJECT_NAME}-params EXCLUDE_FROM_ALL params.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-params ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
# Test spinners
|
||||
add_executable(${PROJECT_NAME}-spinners EXCLUDE_FROM_ALL spinners.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-spinners ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
# Test getting information from the master
|
||||
add_executable(${PROJECT_NAME}-get_master_information EXCLUDE_FROM_ALL get_master_information.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-get_master_information ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
# Test multiple subscriptions
|
||||
add_executable(${PROJECT_NAME}-multiple_subscriptions EXCLUDE_FROM_ALL multiple_subscriptions.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-multiple_subscriptions ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-check_master EXCLUDE_FROM_ALL check_master.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-check_master ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-wait_for_message EXCLUDE_FROM_ALL wait_for_message.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-wait_for_message ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-loads_of_publishers EXCLUDE_FROM_ALL loads_of_publishers.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-loads_of_publishers ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-incrementing_sequence EXCLUDE_FROM_ALL incrementing_sequence.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-incrementing_sequence ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-subscription_callback_types EXCLUDE_FROM_ALL subscription_callback_types.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-subscription_callback_types ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
add_dependencies(${PROJECT_NAME}-subscription_callback_types ${std_msgs_EXPORTED_TARGETS})
|
||||
|
||||
add_executable(${PROJECT_NAME}-service_callback_types EXCLUDE_FROM_ALL service_callback_types.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-service_callback_types ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-intraprocess_subscriptions EXCLUDE_FROM_ALL intraprocess_subscriptions.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-intraprocess_subscriptions ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-nonconst_subscriptions EXCLUDE_FROM_ALL nonconst_subscriptions.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-nonconst_subscriptions ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-subscribe_retry_tcp EXCLUDE_FROM_ALL subscribe_retry_tcp.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-subscribe_retry_tcp ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-subscribe_star EXCLUDE_FROM_ALL subscribe_star.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-subscribe_star ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
add_dependencies(${PROJECT_NAME}-subscribe_star ${std_srvs_EXPORTED_TARGETS})
|
||||
|
||||
add_executable(${PROJECT_NAME}-publisher_for_star_subscriber EXCLUDE_FROM_ALL publisher_for_star_subscriber.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-publisher_for_star_subscriber ${catkin_LIBRARIES})
|
||||
add_dependencies(${PROJECT_NAME}-publisher_for_star_subscriber ${std_srvs_EXPORTED_TARGETS})
|
||||
|
||||
add_executable(${PROJECT_NAME}-parameter_validation EXCLUDE_FROM_ALL parameter_validation.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-parameter_validation ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-param_locale_avoidance_test EXCLUDE_FROM_ALL param_locale_avoidance_test.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-param_locale_avoidance_test ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-crashes_under_gprof EXCLUDE_FROM_ALL crashes_under_gprof.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-crashes_under_gprof ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-test_remapping EXCLUDE_FROM_ALL test_remapping.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-test_remapping ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-name_not_remappable EXCLUDE_FROM_ALL name_not_remappable.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-name_not_remappable ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-test_ns_node_remapping EXCLUDE_FROM_ALL test_ns_node_remapping.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-test_ns_node_remapping ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-test_search_param EXCLUDE_FROM_ALL test_search_param.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-test_search_param ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
add_executable(${PROJECT_NAME}-left_right EXCLUDE_FROM_ALL left_right.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-left_right ${catkin_LIBRARIES})
|
||||
add_dependencies(${PROJECT_NAME}-left_right ${std_msgs_EXPORTED_TARGETS})
|
||||
|
||||
add_executable(${PROJECT_NAME}-string_msg_expect EXCLUDE_FROM_ALL string_msg_expect.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-string_msg_expect ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
add_dependencies(${PROJECT_NAME}-string_msg_expect ${std_msgs_EXPORTED_TARGETS})
|
||||
|
||||
add_executable(${PROJECT_NAME}-stamped_topic_statistics_empty_timestamp EXCLUDE_FROM_ALL stamped_topic_statistics_empty_timestamp.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-stamped_topic_statistics_empty_timestamp ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
|
||||
|
||||
# The publisher and subscriber are compiled but not registered as a unit test
|
||||
# since the test execution requires a network connection which drops packages.
|
||||
# Call scripts/test_udp_with_dropped_packets.sh to run the test.
|
||||
add_executable(${PROJECT_NAME}-publisher EXCLUDE_FROM_ALL publisher.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-publisher ${catkin_LIBRARIES})
|
||||
add_dependencies(${PROJECT_NAME}-publisher ${std_msgs_EXPORTED_TARGETS})
|
||||
|
||||
add_executable(${PROJECT_NAME}-subscriber EXCLUDE_FROM_ALL subscriber.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}-subscriber ${catkin_LIBRARIES})
|
||||
add_dependencies(${PROJECT_NAME}-subscriber ${std_msgs_EXPORTED_TARGETS})
|
||||
|
||||
if(TARGET tests)
|
||||
add_dependencies(tests
|
||||
${PROJECT_NAME}-handles
|
||||
${PROJECT_NAME}-timer_callbacks
|
||||
${PROJECT_NAME}-latching_publisher
|
||||
${PROJECT_NAME}-publish_n_fast
|
||||
${PROJECT_NAME}-subscribe_self
|
||||
${PROJECT_NAME}-pub_sub
|
||||
${PROJECT_NAME}-sub_pub
|
||||
${PROJECT_NAME}-publish_empty
|
||||
${PROJECT_NAME}-publish_onsub
|
||||
${PROJECT_NAME}-subscribe_n_fast
|
||||
${PROJECT_NAME}-subscribe_empty
|
||||
${PROJECT_NAME}-subscribe_resubscribe
|
||||
${PROJECT_NAME}-subscribe_unsubscribe
|
||||
${PROJECT_NAME}-publish_unadvertise
|
||||
${PROJECT_NAME}-subscribe_unsubscribe_repeatedly
|
||||
${PROJECT_NAME}-publish_constantly
|
||||
${PROJECT_NAME}-param_update_test
|
||||
${PROJECT_NAME}-real_time_test
|
||||
${PROJECT_NAME}-sim_time_test
|
||||
${PROJECT_NAME}-service_adv
|
||||
${PROJECT_NAME}-service_adv_unadv
|
||||
${PROJECT_NAME}-service_call
|
||||
${PROJECT_NAME}-service_call_zombie
|
||||
${PROJECT_NAME}-service_deadlock
|
||||
${PROJECT_NAME}-service_exception
|
||||
${PROJECT_NAME}-service_call_repeatedly
|
||||
${PROJECT_NAME}-multiple_init_fini
|
||||
${PROJECT_NAME}-inspection
|
||||
${PROJECT_NAME}-service_adv_multiple
|
||||
${PROJECT_NAME}-service_adv_a
|
||||
${PROJECT_NAME}-service_adv_zombie
|
||||
${PROJECT_NAME}-service_wait_a_adv_b
|
||||
${PROJECT_NAME}-service_call_expect_b
|
||||
${PROJECT_NAME}-name_remapping
|
||||
${PROJECT_NAME}-name_remapping_with_ns
|
||||
${PROJECT_NAME}-namespaces
|
||||
${PROJECT_NAME}-params
|
||||
${PROJECT_NAME}-spinners
|
||||
${PROJECT_NAME}-get_master_information
|
||||
${PROJECT_NAME}-multiple_subscriptions
|
||||
${PROJECT_NAME}-check_master
|
||||
${PROJECT_NAME}-wait_for_message
|
||||
${PROJECT_NAME}-loads_of_publishers
|
||||
${PROJECT_NAME}-incrementing_sequence
|
||||
${PROJECT_NAME}-subscription_callback_types
|
||||
${PROJECT_NAME}-service_callback_types
|
||||
${PROJECT_NAME}-intraprocess_subscriptions
|
||||
${PROJECT_NAME}-nonconst_subscriptions
|
||||
${PROJECT_NAME}-subscribe_retry_tcp
|
||||
${PROJECT_NAME}-subscribe_star
|
||||
${PROJECT_NAME}-publisher_for_star_subscriber
|
||||
${PROJECT_NAME}-parameter_validation
|
||||
${PROJECT_NAME}-param_locale_avoidance_test
|
||||
${PROJECT_NAME}-crashes_under_gprof
|
||||
${PROJECT_NAME}-test_remapping
|
||||
${PROJECT_NAME}-name_not_remappable
|
||||
${PROJECT_NAME}-test_ns_node_remapping
|
||||
${PROJECT_NAME}-test_search_param
|
||||
${PROJECT_NAME}-left_right
|
||||
${PROJECT_NAME}-string_msg_expect
|
||||
${PROJECT_NAME}-publisher
|
||||
${PROJECT_NAME}-subscriber
|
||||
${PROJECT_NAME}-stamped_topic_statistics_empty_timestamp
|
||||
)
|
||||
endif()
|
||||
|
||||
add_dependencies(${PROJECT_NAME}-handles ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-timer_callbacks ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-latching_publisher ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-publish_n_fast ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-subscribe_self ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-pub_sub ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-sub_pub ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-publish_empty ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-publish_onsub ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-subscribe_n_fast ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-subscribe_empty ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-subscribe_resubscribe ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-subscribe_unsubscribe ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-publish_unadvertise ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-subscribe_unsubscribe_repeatedly ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-publish_constantly ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-param_update_test ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-real_time_test ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-sim_time_test ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-service_adv ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-service_adv_unadv ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-service_call ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-service_call_zombie ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-service_deadlock ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-service_exception ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-service_call_repeatedly ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-multiple_init_fini ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-inspection ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-service_adv_multiple ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-service_adv_a ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-service_wait_a_adv_b ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-service_call_expect_b ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-service_adv_zombie ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-name_remapping ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-name_remapping_with_ns ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-namespaces ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-params ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-spinners ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-get_master_information ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-multiple_subscriptions ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-check_master ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-wait_for_message ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-loads_of_publishers ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-incrementing_sequence ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-subscription_callback_types ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-service_callback_types ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-intraprocess_subscriptions ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-nonconst_subscriptions ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-subscribe_retry_tcp ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-subscribe_star ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-publisher_for_star_subscriber ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-parameter_validation ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-param_locale_avoidance_test ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-crashes_under_gprof ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-test_remapping ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-name_not_remappable ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-test_ns_node_remapping ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-test_search_param ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-left_right ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-string_msg_expect ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
add_dependencies(${PROJECT_NAME}-stamped_topic_statistics_empty_timestamp
|
||||
${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
77
thirdparty/ros/ros_comm/test/test_roscpp/test/src/check_master.cpp
vendored
Normal file
77
thirdparty/ros/ros_comm/test/test_roscpp/test/src/check_master.cpp
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Author: Brian Gerkey */
|
||||
|
||||
/*
|
||||
* Check that the master is running
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "ros/ros.h"
|
||||
|
||||
#include "xmlrpcpp/XmlRpc.h"
|
||||
|
||||
using namespace XmlRpc;
|
||||
|
||||
bool g_should_exist = true;
|
||||
|
||||
TEST(CheckMaster, checkMaster)
|
||||
{
|
||||
ASSERT_EQ(ros::master::check(), g_should_exist);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
|
||||
ros::V_string args;
|
||||
ros::removeROSArgs(argc, argv, args);
|
||||
|
||||
if (args.size() != 2)
|
||||
{
|
||||
ROS_ERROR("Usage: check_master [yes|no]");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (args[1] == "no")
|
||||
{
|
||||
g_should_exist = false;
|
||||
setenv("ROS_MASTER_URI", "http://invalid_host_name_blahahahahahahahahahahaha:11311", 1);
|
||||
std::cout << getenv("ROS_MASTER_URI") << std::endl;
|
||||
}
|
||||
|
||||
ros::init(argc, argv, "check_master");
|
||||
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
18
thirdparty/ros/ros_comm/test/test_roscpp/test/src/crashes_under_gprof.cpp
vendored
Normal file
18
thirdparty/ros/ros_comm/test/test_roscpp/test/src/crashes_under_gprof.cpp
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
#include <ros/ros.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
ros::init(argc, argv, "test_get_param");
|
||||
|
||||
ros::NodeHandle nh;
|
||||
nh.setParam(std::string("monkey"), false);
|
||||
bool test_bool;
|
||||
while(ros::ok()) {
|
||||
if(!nh.getParam("monkey", test_bool)) {
|
||||
ROS_INFO_STREAM("Failed, bailing");
|
||||
ros::shutdown();
|
||||
}
|
||||
std::cout << ".";
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
109
thirdparty/ros/ros_comm/test/test_roscpp/test/src/get_master_information.cpp
vendored
Normal file
109
thirdparty/ros/ros_comm/test/test_roscpp/test/src/get_master_information.cpp
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Author: Josh Faust */
|
||||
|
||||
/*
|
||||
* Test getting various information from the master, like the published topics
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
#include <set>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "ros/ros.h"
|
||||
#include "test_roscpp/TestEmpty.h"
|
||||
|
||||
TEST(masterInfo, getPublishedTopics)
|
||||
{
|
||||
ros::NodeHandle nh;
|
||||
|
||||
typedef std::set<std::string> S_string;
|
||||
S_string advertised_topics;
|
||||
advertised_topics.insert( "/test_topic_1" );
|
||||
advertised_topics.insert( "/test_topic_2" );
|
||||
advertised_topics.insert( "/test_topic_3" );
|
||||
advertised_topics.insert( "/test_topic_4" );
|
||||
advertised_topics.insert( "/test_topic_5" );
|
||||
advertised_topics.insert( "/test_topic_6" );
|
||||
advertised_topics.insert( "/test_topic_7" );
|
||||
advertised_topics.insert( "/test_topic_8" );
|
||||
|
||||
std::vector<ros::Publisher> pubs;
|
||||
|
||||
S_string::iterator adv_it = advertised_topics.begin();
|
||||
S_string::iterator adv_end = advertised_topics.end();
|
||||
for ( ; adv_it != adv_end; ++adv_it )
|
||||
{
|
||||
const std::string& topic = *adv_it;
|
||||
pubs.push_back(nh.advertise<test_roscpp::TestEmpty>( topic, 0 ));
|
||||
}
|
||||
|
||||
ros::master::V_TopicInfo master_topics;
|
||||
ros::master::getTopics(master_topics);
|
||||
|
||||
adv_it = advertised_topics.begin();
|
||||
adv_end = advertised_topics.end();
|
||||
for ( ; adv_it != adv_end; ++adv_it )
|
||||
{
|
||||
const std::string& topic = *adv_it;
|
||||
bool found = false;
|
||||
|
||||
ros::master::V_TopicInfo::iterator master_it = master_topics.begin();
|
||||
ros::master::V_TopicInfo::iterator master_end = master_topics.end();
|
||||
for ( ; master_it != master_end; ++master_it )
|
||||
{
|
||||
const ros::master::TopicInfo& info = *master_it;
|
||||
if ( topic == info.name )
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ASSERT_TRUE( found );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
ros::init( argc, argv, "get_master_information" );
|
||||
ros::NodeHandle nh;
|
||||
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
634
thirdparty/ros/ros_comm/test/test_roscpp/test/src/handles.cpp
vendored
Normal file
634
thirdparty/ros/ros_comm/test/test_roscpp/test/src/handles.cpp
vendored
Normal file
@@ -0,0 +1,634 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Author: Josh Faust */
|
||||
|
||||
/*
|
||||
* Test handles
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "ros/ros.h"
|
||||
#include "ros/callback_queue.h"
|
||||
#include <test_roscpp/TestArray.h>
|
||||
#include <test_roscpp/TestStringString.h>
|
||||
|
||||
#include <boost/thread.hpp>
|
||||
|
||||
using namespace ros;
|
||||
using namespace test_roscpp;
|
||||
|
||||
TEST(RoscppHandles, nodeHandleConstructionDestruction)
|
||||
{
|
||||
{
|
||||
ASSERT_FALSE(ros::isStarted());
|
||||
|
||||
ros::NodeHandle n1;
|
||||
ASSERT_TRUE(ros::isStarted());
|
||||
|
||||
{
|
||||
ros::NodeHandle n2;
|
||||
ASSERT_TRUE(ros::isStarted());
|
||||
|
||||
{
|
||||
ros::NodeHandle n3(n2);
|
||||
ASSERT_TRUE(ros::isStarted());
|
||||
|
||||
{
|
||||
ros::NodeHandle n4 = n3;
|
||||
ASSERT_TRUE(ros::isStarted());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ASSERT_TRUE(ros::isStarted());
|
||||
}
|
||||
|
||||
ASSERT_FALSE(ros::isStarted());
|
||||
|
||||
{
|
||||
ros::NodeHandle n;
|
||||
ASSERT_TRUE(ros::isStarted());
|
||||
}
|
||||
|
||||
ASSERT_FALSE(ros::isStarted());
|
||||
}
|
||||
|
||||
TEST(RoscppHandles, nodeHandleParentWithRemappings)
|
||||
{
|
||||
ros::M_string remappings;
|
||||
remappings["a"] = "b";
|
||||
remappings["c"] = "d";
|
||||
ros::NodeHandle n1("", remappings);
|
||||
|
||||
// sanity checks
|
||||
EXPECT_STREQ(n1.resolveName("a").c_str(), "/b");
|
||||
EXPECT_STREQ(n1.resolveName("/a").c_str(), "/b");
|
||||
EXPECT_STREQ(n1.resolveName("c").c_str(), "/d");
|
||||
EXPECT_STREQ(n1.resolveName("/c").c_str(), "/d");
|
||||
|
||||
ros::NodeHandle n2(n1, "my_ns");
|
||||
EXPECT_STREQ(n2.resolveName("a").c_str(), "/my_ns/a");
|
||||
EXPECT_STREQ(n2.resolveName("/a").c_str(), "/b");
|
||||
EXPECT_STREQ(n2.resolveName("c").c_str(), "/my_ns/c");
|
||||
EXPECT_STREQ(n2.resolveName("/c").c_str(), "/d");
|
||||
|
||||
ros::NodeHandle n3(n2);
|
||||
EXPECT_STREQ(n3.resolveName("a").c_str(), "/my_ns/a");
|
||||
EXPECT_STREQ(n3.resolveName("/a").c_str(), "/b");
|
||||
EXPECT_STREQ(n3.resolveName("c").c_str(), "/my_ns/c");
|
||||
EXPECT_STREQ(n3.resolveName("/c").c_str(), "/d");
|
||||
|
||||
ros::NodeHandle n4;
|
||||
n4 = n3;
|
||||
EXPECT_STREQ(n4.resolveName("a").c_str(), "/my_ns/a");
|
||||
EXPECT_STREQ(n4.resolveName("/a").c_str(), "/b");
|
||||
EXPECT_STREQ(n4.resolveName("c").c_str(), "/my_ns/c");
|
||||
EXPECT_STREQ(n4.resolveName("/c").c_str(), "/d");
|
||||
}
|
||||
|
||||
int32_t g_recv_count = 0;
|
||||
void subscriberCallback(const test_roscpp::TestArray::ConstPtr&)
|
||||
{
|
||||
++g_recv_count;
|
||||
}
|
||||
|
||||
class SubscribeHelper
|
||||
{
|
||||
public:
|
||||
SubscribeHelper()
|
||||
: recv_count_(0)
|
||||
{}
|
||||
|
||||
void callback(const test_roscpp::TestArray::ConstPtr&)
|
||||
{
|
||||
++recv_count_;
|
||||
}
|
||||
|
||||
int32_t recv_count_;
|
||||
};
|
||||
|
||||
TEST(RoscppHandles, subscriberValidity)
|
||||
{
|
||||
ros::NodeHandle n;
|
||||
|
||||
ros::Subscriber sub;
|
||||
ASSERT_FALSE(sub);
|
||||
|
||||
sub = n.subscribe("test", 0, subscriberCallback);
|
||||
ASSERT_TRUE(sub);
|
||||
}
|
||||
|
||||
TEST(RoscppHandles, subscriberDestructionMultipleCallbacks)
|
||||
{
|
||||
ros::NodeHandle n;
|
||||
ros::Publisher pub = n.advertise<test_roscpp::TestArray>("test", 0);
|
||||
test_roscpp::TestArray msg;
|
||||
|
||||
{
|
||||
SubscribeHelper helper;
|
||||
ros::Subscriber sub_class = n.subscribe("test", 0, &SubscribeHelper::callback, &helper);
|
||||
|
||||
ros::Duration d(0.05);
|
||||
int32_t last_class_count = helper.recv_count_;
|
||||
while (last_class_count == helper.recv_count_)
|
||||
{
|
||||
pub.publish(msg);
|
||||
ros::spinOnce();
|
||||
d.sleep();
|
||||
}
|
||||
|
||||
int32_t last_fn_count = g_recv_count;
|
||||
{
|
||||
ros::Subscriber sub_fn = n.subscribe("test", 0, subscriberCallback);
|
||||
|
||||
ASSERT_TRUE(sub_fn != sub_class);
|
||||
|
||||
last_fn_count = g_recv_count;
|
||||
while (last_fn_count == g_recv_count)
|
||||
{
|
||||
pub.publish(msg);
|
||||
ros::spinOnce();
|
||||
d.sleep();
|
||||
}
|
||||
}
|
||||
|
||||
last_fn_count = g_recv_count;
|
||||
last_class_count = helper.recv_count_;
|
||||
while (last_class_count == helper.recv_count_)
|
||||
{
|
||||
pub.publish(msg);
|
||||
ros::spinOnce();
|
||||
d.sleep();
|
||||
}
|
||||
d.sleep();
|
||||
|
||||
ASSERT_EQ(last_fn_count, g_recv_count);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(RoscppHandles, subscriberSpinAfterSubscriberShutdown)
|
||||
{
|
||||
ros::NodeHandle n;
|
||||
ros::Publisher pub = n.advertise<test_roscpp::TestArray>("test", 0);
|
||||
test_roscpp::TestArray msg;
|
||||
|
||||
int32_t last_fn_count = g_recv_count;
|
||||
|
||||
{
|
||||
ros::Subscriber sub_fn = n.subscribe("test", 0, subscriberCallback);
|
||||
|
||||
last_fn_count = g_recv_count;
|
||||
for (int i = 0; i < 10; ++i)
|
||||
{
|
||||
pub.publish(msg);
|
||||
}
|
||||
|
||||
ros::WallDuration(0.1).sleep();
|
||||
}
|
||||
|
||||
ros::spinOnce();
|
||||
|
||||
ASSERT_EQ(last_fn_count, g_recv_count);
|
||||
}
|
||||
|
||||
TEST(RoscppHandles, subscriberGetNumPublishers)
|
||||
{
|
||||
ros::NodeHandle n;
|
||||
ros::Publisher pub = n.advertise<test_roscpp::TestArray>("test", 0);
|
||||
|
||||
ros::Subscriber sub = n.subscribe("test", 0, subscriberCallback);
|
||||
|
||||
ros::WallTime begin = ros::WallTime::now();
|
||||
while (sub.getNumPublishers() < 1 && (ros::WallTime::now() - begin < ros::WallDuration(1)))
|
||||
{
|
||||
ros::spinOnce();
|
||||
ros::WallDuration(0.1).sleep();
|
||||
}
|
||||
|
||||
ASSERT_EQ(sub.getNumPublishers(), 1ULL);
|
||||
}
|
||||
|
||||
TEST(RoscppHandles, subscriberCopy)
|
||||
{
|
||||
ros::NodeHandle n;
|
||||
|
||||
g_recv_count = 0;
|
||||
|
||||
{
|
||||
ros::Subscriber sub1 = n.subscribe("/test", 0, subscriberCallback);
|
||||
|
||||
{
|
||||
ros::Subscriber sub2 = sub1;
|
||||
|
||||
{
|
||||
ros::Subscriber sub3(sub2);
|
||||
|
||||
ASSERT_TRUE(sub3 == sub2);
|
||||
|
||||
V_string topics;
|
||||
this_node::getSubscribedTopics(topics);
|
||||
ASSERT_TRUE(std::find(topics.begin(), topics.end(), "/test") != topics.end());
|
||||
}
|
||||
|
||||
ASSERT_TRUE(sub2 == sub1);
|
||||
|
||||
V_string topics;
|
||||
this_node::getSubscribedTopics(topics);
|
||||
ASSERT_TRUE(std::find(topics.begin(), topics.end(), "/test") != topics.end());
|
||||
}
|
||||
|
||||
V_string topics;
|
||||
this_node::getSubscribedTopics(topics);
|
||||
ASSERT_TRUE(std::find(topics.begin(), topics.end(), "/test") != topics.end());
|
||||
}
|
||||
|
||||
V_string topics;
|
||||
this_node::getSubscribedTopics(topics);
|
||||
ASSERT_TRUE(std::find(topics.begin(), topics.end(), "/test") == topics.end());
|
||||
}
|
||||
|
||||
TEST(RoscppHandles, publisherCopy)
|
||||
{
|
||||
ros::NodeHandle n;
|
||||
|
||||
g_recv_count = 0;
|
||||
|
||||
{
|
||||
ros::Publisher pub1 = n.advertise<test_roscpp::TestArray>("/test", 0);
|
||||
|
||||
{
|
||||
ros::Publisher pub2 = pub1;
|
||||
|
||||
{
|
||||
ros::Publisher pub3(pub2);
|
||||
|
||||
ASSERT_TRUE(pub3 == pub2);
|
||||
|
||||
V_string topics;
|
||||
this_node::getAdvertisedTopics(topics);
|
||||
ASSERT_TRUE(std::find(topics.begin(), topics.end(), "/test") != topics.end());
|
||||
}
|
||||
|
||||
ASSERT_TRUE(pub2 == pub1);
|
||||
|
||||
V_string topics;
|
||||
this_node::getAdvertisedTopics(topics);
|
||||
ASSERT_TRUE(std::find(topics.begin(), topics.end(), "/test") != topics.end());
|
||||
}
|
||||
|
||||
V_string topics;
|
||||
this_node::getAdvertisedTopics(topics);
|
||||
ASSERT_TRUE(std::find(topics.begin(), topics.end(), "/test") != topics.end());
|
||||
}
|
||||
|
||||
V_string topics;
|
||||
this_node::getAdvertisedTopics(topics);
|
||||
ASSERT_TRUE(std::find(topics.begin(), topics.end(), "/test") == topics.end());
|
||||
}
|
||||
|
||||
TEST(RoscppHandles, publisherMultiple)
|
||||
{
|
||||
ros::NodeHandle n;
|
||||
|
||||
g_recv_count = 0;
|
||||
|
||||
{
|
||||
ros::Publisher pub1 = n.advertise<test_roscpp::TestArray>("/test", 0);
|
||||
|
||||
{
|
||||
ros::Publisher pub2 = n.advertise<test_roscpp::TestArray>("/test", 0);
|
||||
|
||||
ASSERT_TRUE(pub1 != pub2);
|
||||
|
||||
V_string topics;
|
||||
this_node::getAdvertisedTopics(topics);
|
||||
ASSERT_TRUE(std::find(topics.begin(), topics.end(), "/test") != topics.end());
|
||||
}
|
||||
|
||||
V_string topics;
|
||||
this_node::getAdvertisedTopics(topics);
|
||||
ASSERT_TRUE(std::find(topics.begin(), topics.end(), "/test") != topics.end());
|
||||
}
|
||||
|
||||
V_string topics;
|
||||
this_node::getAdvertisedTopics(topics);
|
||||
ASSERT_TRUE(std::find(topics.begin(), topics.end(), "/test") == topics.end());
|
||||
}
|
||||
|
||||
bool serviceCallback(TestStringString::Request&, TestStringString::Response&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void pump(ros::CallbackQueue* queue)
|
||||
{
|
||||
while (queue->isEnabled())
|
||||
{
|
||||
queue->callAvailable(ros::WallDuration(0.1));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(RoscppHandles, serviceAdv)
|
||||
{
|
||||
ros::NodeHandle n;
|
||||
TestStringString t;
|
||||
|
||||
ros::CallbackQueue queue;
|
||||
n.setCallbackQueue(&queue);
|
||||
boost::thread th(boost::bind(pump, &queue));
|
||||
{
|
||||
ros::ServiceServer srv = n.advertiseService("/test_srv", serviceCallback);
|
||||
|
||||
EXPECT_TRUE(ros::service::call("/test_srv", t));
|
||||
}
|
||||
|
||||
queue.disable();
|
||||
th.join();
|
||||
|
||||
ASSERT_FALSE(ros::service::call("/test_srv", t));
|
||||
}
|
||||
|
||||
TEST(RoscppHandles, serviceAdvCopy)
|
||||
{
|
||||
ros::NodeHandle n;
|
||||
TestStringString t;
|
||||
|
||||
ros::CallbackQueue queue;
|
||||
n.setCallbackQueue(&queue);
|
||||
boost::thread th(boost::bind(pump, &queue));
|
||||
|
||||
{
|
||||
ros::ServiceServer srv1 = n.advertiseService("/test_srv", serviceCallback);
|
||||
|
||||
{
|
||||
ros::ServiceServer srv2 = srv1;
|
||||
|
||||
{
|
||||
ros::ServiceServer srv3(srv2);
|
||||
|
||||
ASSERT_TRUE(srv3 == srv2);
|
||||
|
||||
EXPECT_TRUE(ros::service::call("/test_srv", t));
|
||||
}
|
||||
|
||||
ASSERT_TRUE(srv2 == srv1);
|
||||
|
||||
EXPECT_TRUE(ros::service::call("/test_srv", t));
|
||||
}
|
||||
|
||||
EXPECT_TRUE(ros::service::call("/test_srv", t));
|
||||
}
|
||||
|
||||
ASSERT_FALSE(ros::service::call("/test_srv", t));
|
||||
|
||||
queue.disable();
|
||||
th.join();
|
||||
}
|
||||
|
||||
TEST(RoscppHandles, serviceAdvMultiple)
|
||||
{
|
||||
ros::NodeHandle n;
|
||||
|
||||
ros::ServiceServer srv = n.advertiseService("/test_srv", serviceCallback);
|
||||
ros::ServiceServer srv2 = n.advertiseService("/test_srv", serviceCallback);
|
||||
ASSERT_TRUE(srv);
|
||||
ASSERT_FALSE(srv2);
|
||||
|
||||
ASSERT_TRUE(srv != srv2);
|
||||
}
|
||||
|
||||
int32_t g_sub_count = 0;
|
||||
void connectedCallback(const ros::SingleSubscriberPublisher&)
|
||||
{
|
||||
++g_sub_count;
|
||||
}
|
||||
|
||||
TEST(RoscppHandles, trackedObjectWithAdvertiseSubscriberCallback)
|
||||
{
|
||||
ros::NodeHandle n;
|
||||
|
||||
boost::shared_ptr<char> tracked(boost::make_shared<char>());
|
||||
|
||||
ros::Publisher pub = n.advertise<test_roscpp::TestArray>("/test", 0, connectedCallback, SubscriberStatusCallback(), tracked);
|
||||
|
||||
g_recv_count = 0;
|
||||
g_sub_count = 0;
|
||||
ros::Subscriber sub = n.subscribe("/test", 0, subscriberCallback);
|
||||
|
||||
Duration d(0.01);
|
||||
while (g_sub_count == 0)
|
||||
{
|
||||
d.sleep();
|
||||
ros::spinOnce();
|
||||
}
|
||||
ASSERT_EQ(g_sub_count, 1);
|
||||
|
||||
sub.shutdown();
|
||||
|
||||
tracked.reset();
|
||||
sub = n.subscribe("/test", 0, subscriberCallback);
|
||||
|
||||
Duration d2(0.01);
|
||||
for (int i = 0; i < 10; ++i)
|
||||
{
|
||||
d2.sleep();
|
||||
ros::spinOnce();
|
||||
}
|
||||
|
||||
ASSERT_EQ(g_sub_count, 1);
|
||||
}
|
||||
|
||||
TEST(RoscppHandles, spinAfterHandleShutdownWithAdvertiseSubscriberCallback)
|
||||
{
|
||||
ros::NodeHandle n;
|
||||
ros::Publisher pub = n.advertise<test_roscpp::TestArray>("/test", 0, connectedCallback, SubscriberStatusCallback());
|
||||
|
||||
g_sub_count = 0;
|
||||
ros::Subscriber sub = n.subscribe("/test", 0, subscriberCallback);
|
||||
|
||||
while (pub.getNumSubscribers() == 0)
|
||||
{
|
||||
ros::WallDuration(0.01).sleep();
|
||||
}
|
||||
|
||||
pub.shutdown();
|
||||
|
||||
ros::spinOnce();
|
||||
|
||||
ASSERT_EQ(g_sub_count, 0);
|
||||
}
|
||||
|
||||
TEST(RoscppHandles, multiplePublishersWithSubscriberConnectCallback)
|
||||
{
|
||||
ros::NodeHandle n;
|
||||
ros::Publisher pub = n.advertise<test_roscpp::TestArray>("/test", 0, connectedCallback, SubscriberStatusCallback());
|
||||
|
||||
g_sub_count = 0;
|
||||
ros::Subscriber sub = n.subscribe("/test", 0, subscriberCallback);
|
||||
|
||||
while (g_sub_count == 0)
|
||||
{
|
||||
ros::WallDuration(0.01).sleep();
|
||||
ros::spinOnce();
|
||||
}
|
||||
|
||||
ASSERT_EQ(g_sub_count, 1);
|
||||
g_sub_count = 0;
|
||||
|
||||
ros::Publisher pub2 = n.advertise<test_roscpp::TestArray>("/test", 0, connectedCallback, SubscriberStatusCallback());
|
||||
ros::spinOnce();
|
||||
|
||||
ASSERT_EQ(g_sub_count, 1);
|
||||
}
|
||||
|
||||
class ServiceClass
|
||||
{
|
||||
public:
|
||||
bool serviceCallback(TestStringString::Request&, TestStringString::Response&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
TEST(RoscppHandles, trackedObjectWithServiceCallback)
|
||||
{
|
||||
ros::NodeHandle n;
|
||||
|
||||
ros::CallbackQueue queue;
|
||||
n.setCallbackQueue(&queue);
|
||||
boost::thread th(boost::bind(pump, &queue));
|
||||
|
||||
boost::shared_ptr<ServiceClass> tracked(boost::make_shared<ServiceClass>());
|
||||
ros::ServiceServer srv = n.advertiseService("/test_srv", &ServiceClass::serviceCallback, tracked);
|
||||
|
||||
TestStringString t;
|
||||
EXPECT_TRUE(ros::service::call("/test_srv", t));
|
||||
|
||||
tracked.reset();
|
||||
|
||||
ASSERT_FALSE(ros::service::call("/test_srv", t));
|
||||
|
||||
queue.disable();
|
||||
th.join();
|
||||
}
|
||||
|
||||
TEST(RoscppHandles, trackedObjectWithSubscriptionCallback)
|
||||
{
|
||||
ros::NodeHandle n;
|
||||
|
||||
boost::shared_ptr<SubscribeHelper> tracked(boost::make_shared<SubscribeHelper>());
|
||||
|
||||
g_recv_count = 0;
|
||||
ros::Subscriber sub = n.subscribe("/test", 0, &SubscribeHelper::callback, tracked);
|
||||
|
||||
ros::Publisher pub = n.advertise<test_roscpp::TestArray>("/test", 0);
|
||||
|
||||
test_roscpp::TestArray msg;
|
||||
Duration d(0.01);
|
||||
while (tracked->recv_count_ == 0)
|
||||
{
|
||||
pub.publish(msg);
|
||||
d.sleep();
|
||||
ros::spinOnce();
|
||||
}
|
||||
ASSERT_GE(tracked->recv_count_, 1);
|
||||
|
||||
tracked.reset();
|
||||
|
||||
pub.publish(msg);
|
||||
Duration d2(0.01);
|
||||
for (int i = 0; i < 10; ++i)
|
||||
{
|
||||
d2.sleep();
|
||||
ros::spinOnce();
|
||||
}
|
||||
}
|
||||
|
||||
TEST(RoscppHandles, nodeHandleNames)
|
||||
{
|
||||
ros::NodeHandle n1;
|
||||
EXPECT_STREQ(n1.resolveName("blah").c_str(), "/blah");
|
||||
|
||||
try
|
||||
{
|
||||
n1.resolveName("~blah");
|
||||
FAIL();
|
||||
}
|
||||
catch (ros::InvalidNameException&)
|
||||
{
|
||||
}
|
||||
|
||||
ros::NodeHandle n2("internal_ns");
|
||||
EXPECT_STREQ(n2.resolveName("blah").c_str(), "/internal_ns/blah");
|
||||
|
||||
ros::NodeHandle n3(n2, "2");
|
||||
EXPECT_STREQ(n3.resolveName("blah").c_str(), "/internal_ns/2/blah");
|
||||
|
||||
ros::NodeHandle n4("~");
|
||||
EXPECT_STREQ(n4.resolveName("blah").c_str(), (ros::this_node::getName() + "/blah").c_str());
|
||||
|
||||
try {
|
||||
ros::NodeHandle n5(n2, "illegal_name!!!");
|
||||
FAIL();
|
||||
} catch (ros::InvalidNameException&) { }
|
||||
|
||||
}
|
||||
|
||||
TEST(RoscppHandles, nodeHandleShutdown)
|
||||
{
|
||||
ros::NodeHandle n;
|
||||
|
||||
ros::Subscriber sub = n.subscribe("/test", 0, subscriberCallback);
|
||||
ros::Publisher pub = n.advertise<test_roscpp::TestArray>("/test", 0);
|
||||
ros::ServiceServer srv = n.advertiseService("/test_srv", serviceCallback);
|
||||
|
||||
n.shutdown();
|
||||
|
||||
ASSERT_FALSE(pub);
|
||||
ASSERT_FALSE(sub);
|
||||
ASSERT_FALSE(srv);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
ros::init(argc, argv, "test_handles");
|
||||
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
||||
86
thirdparty/ros/ros_comm/test/test_roscpp/test/src/incrementing_sequence.cpp
vendored
Normal file
86
thirdparty/ros/ros_comm/test/test_roscpp/test/src/incrementing_sequence.cpp
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Author: Josh Faust */
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "ros/ros.h"
|
||||
#include <test_roscpp/TestWithHeader.h>
|
||||
|
||||
using namespace ros;
|
||||
using namespace test_roscpp;
|
||||
|
||||
uint32_t g_recv_count = 0;
|
||||
uint32_t g_sequence = 0;
|
||||
|
||||
void callback(const TestWithHeaderConstPtr& msg)
|
||||
{
|
||||
++g_recv_count;
|
||||
g_sequence = msg->header.seq;
|
||||
}
|
||||
|
||||
TEST(IncrementingSequence, incrementing)
|
||||
{
|
||||
ros::NodeHandle nh;
|
||||
ros::Publisher pub = nh.advertise<TestWithHeader>("test_with_header", 0);
|
||||
ros::Subscriber sub = nh.subscribe("test_with_header", 0, callback);
|
||||
|
||||
while (g_recv_count < 50)
|
||||
{
|
||||
TestWithHeader msg;
|
||||
msg.header.frame_id = "blah";
|
||||
msg.header.stamp = ros::Time::now();
|
||||
pub.publish(msg);
|
||||
|
||||
ros::spinOnce();
|
||||
ros::WallDuration(0.01).sleep();
|
||||
}
|
||||
|
||||
ASSERT_GT(g_sequence, 0UL);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
ros::init(argc, argv, "incrementing_sequence");
|
||||
|
||||
ros::NodeHandle nh;
|
||||
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
||||
|
||||
120
thirdparty/ros/ros_comm/test/test_roscpp/test/src/inspection.cpp
vendored
Normal file
120
thirdparty/ros/ros_comm/test/test_roscpp/test/src/inspection.cpp
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Author: Brian Gerkey */
|
||||
|
||||
/*
|
||||
* Test inspection functionality
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <ros/ros.h>
|
||||
#include <ros/names.h>
|
||||
#include <test_roscpp/TestArray.h>
|
||||
#include <test_roscpp/TestStringInt.h>
|
||||
#include <test_roscpp/TestEmpty.h>
|
||||
|
||||
const char* g_node_name = "inspection_test";
|
||||
|
||||
int g_argc;
|
||||
char* g_argv[8];
|
||||
|
||||
TEST(Inspection, getAdvertisedTopics)
|
||||
{
|
||||
ros::NodeHandle nh;
|
||||
|
||||
std::vector<std::string> topics;
|
||||
|
||||
ros::this_node::getAdvertisedTopics(topics);
|
||||
// Note that it's 1, not 0, because the rosout appender has already snuck
|
||||
// in and advertised.
|
||||
ASSERT_EQ((int)topics.size(),1);
|
||||
ASSERT_EQ(topics[0], "/rosout");
|
||||
|
||||
{
|
||||
ros::Publisher pub1 = nh.advertise<test_roscpp::TestArray>("topic",1);
|
||||
ros::Publisher pub2 = nh.advertise<test_roscpp::TestArray>("ns/topic",1);
|
||||
ros::Publisher pub3 = nh.advertise<test_roscpp::TestArray>("/global/topic",1);
|
||||
|
||||
topics.clear();
|
||||
ros::this_node::getAdvertisedTopics(topics);
|
||||
// Note that it's 4, not 3, because the rosout appender has already snuck
|
||||
// in and advertised.
|
||||
ASSERT_EQ((int)topics.size(),4);
|
||||
|
||||
// The following tests assume strict ordering of the topics, which is not
|
||||
// guaranteed by the API.
|
||||
ASSERT_EQ(topics[0], "/rosout");
|
||||
ASSERT_EQ(topics[1], "/topic");
|
||||
ASSERT_EQ(topics[2], "/ns/topic");
|
||||
ASSERT_EQ(topics[3], "/global/topic");
|
||||
}
|
||||
|
||||
topics.clear();
|
||||
ros::this_node::getAdvertisedTopics(topics);
|
||||
// Note that it's 1, not 0, because the rosout appender has already snuck
|
||||
// in and advertised.
|
||||
ASSERT_EQ((int)topics.size(),1);
|
||||
ASSERT_EQ(topics[0], "/rosout");
|
||||
}
|
||||
|
||||
TEST(Inspection, commandLineParsing)
|
||||
{
|
||||
ASSERT_EQ(g_argc, 5);
|
||||
ros::M_string remappings = ros::names::getRemappings();
|
||||
|
||||
ASSERT_STREQ(remappings["/foo"].c_str(), "/bar");
|
||||
ASSERT_STREQ(remappings["/baz"].c_str(), "/bang");
|
||||
ASSERT_STREQ(remappings["/bomb"].c_str(), "/barn");
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
|
||||
g_argc = 8;
|
||||
|
||||
g_argv[0] = strdup(argv[0]);
|
||||
g_argv[1] = strdup("foo:=bar");
|
||||
g_argv[2] = strdup("bat");
|
||||
g_argv[3] = strdup("baz:=bang");
|
||||
g_argv[4] = strdup("boom");
|
||||
g_argv[5] = strdup("baz=bomb");
|
||||
g_argv[6] = strdup("bomb:=barn");
|
||||
g_argv[7] = strdup("--bangbang");
|
||||
|
||||
ros::init( g_argc, g_argv, "inspection" );
|
||||
ros::NodeHandle nh;
|
||||
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
297
thirdparty/ros/ros_comm/test/test_roscpp/test/src/intraprocess_subscriptions.cpp
vendored
Normal file
297
thirdparty/ros/ros_comm/test/test_roscpp/test/src/intraprocess_subscriptions.cpp
vendored
Normal file
@@ -0,0 +1,297 @@
|
||||
/*
|
||||
* Copyright (c) 2010, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Author: Josh Faust */
|
||||
|
||||
/*
|
||||
* Subscribe intraprocess, ensuring that no copy happens
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "ros/ros.h"
|
||||
|
||||
uint32_t g_msg_constructor = 0;
|
||||
uint32_t g_msg2_constructor = 0;
|
||||
|
||||
struct Msg
|
||||
{
|
||||
Msg()
|
||||
: serialized(false)
|
||||
, deserialized(false)
|
||||
{
|
||||
++g_msg_constructor;
|
||||
}
|
||||
|
||||
mutable bool serialized;
|
||||
bool deserialized;
|
||||
};
|
||||
typedef boost::shared_ptr<Msg const> MsgConstPtr;
|
||||
|
||||
namespace ros
|
||||
{
|
||||
namespace message_traits
|
||||
{
|
||||
template<>
|
||||
struct MD5Sum<Msg>
|
||||
{
|
||||
static const char* value() { return "MsgMD5Sum"; }
|
||||
static const char* value(const Msg&) { return "MsgMD5Sum"; }
|
||||
};
|
||||
|
||||
template<>
|
||||
struct DataType<Msg>
|
||||
{
|
||||
static const char* value() { return "roscpp/MsgDataType"; }
|
||||
static const char* value(const Msg&) { return "roscpp/MsgDataType"; }
|
||||
};
|
||||
|
||||
template<>
|
||||
struct Definition<Msg>
|
||||
{
|
||||
static const char* value() { return ""; }
|
||||
static const char* value(const Msg&) { return ""; }
|
||||
};
|
||||
} // namespace message_traits
|
||||
|
||||
namespace serialization
|
||||
{
|
||||
template<>
|
||||
struct Serializer<Msg>
|
||||
{
|
||||
template<typename Stream>
|
||||
inline static void write(Stream&, const Msg& v)
|
||||
{
|
||||
v.serialized = true;
|
||||
}
|
||||
|
||||
template<typename Stream>
|
||||
inline static void read(Stream&, Msg& v)
|
||||
{
|
||||
v.deserialized = true;
|
||||
}
|
||||
|
||||
inline static uint32_t serializedLength(const Msg&)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
} // namespace serialization
|
||||
} // namespace ros
|
||||
|
||||
MsgConstPtr g_msg;
|
||||
|
||||
struct Msg2
|
||||
{
|
||||
Msg2()
|
||||
: serialized(false)
|
||||
, deserialized(false)
|
||||
{
|
||||
++g_msg2_constructor;
|
||||
}
|
||||
|
||||
mutable bool serialized;
|
||||
bool deserialized;
|
||||
};
|
||||
typedef boost::shared_ptr<Msg2 const> Msg2ConstPtr;
|
||||
|
||||
namespace ros
|
||||
{
|
||||
namespace message_traits
|
||||
{
|
||||
template<>
|
||||
struct MD5Sum<Msg2>
|
||||
{
|
||||
static const char* value() { return "MsgMD5Sum"; }
|
||||
static const char* value(const Msg2&) { return "MsgMD5Sum"; }
|
||||
};
|
||||
|
||||
template<>
|
||||
struct DataType<Msg2>
|
||||
{
|
||||
static const char* value() { return "roscpp/MsgDataType"; }
|
||||
static const char* value(const Msg2&) { return "roscpp/MsgDataType"; }
|
||||
};
|
||||
|
||||
template<>
|
||||
struct Definition<Msg2>
|
||||
{
|
||||
static const char* value() { return ""; }
|
||||
static const char* value(const Msg2&) { return ""; }
|
||||
};
|
||||
} // namespace message_traits
|
||||
|
||||
namespace serialization
|
||||
{
|
||||
template<>
|
||||
struct Serializer<Msg2>
|
||||
{
|
||||
template<typename Stream>
|
||||
inline static void write(Stream&, const Msg2& v)
|
||||
{
|
||||
v.serialized = true;
|
||||
}
|
||||
|
||||
template<typename Stream>
|
||||
inline static void read(Stream&, Msg2& v)
|
||||
{
|
||||
v.deserialized = true;
|
||||
}
|
||||
|
||||
inline static uint32_t serializedLength(const Msg2&)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
} // namespace serialization
|
||||
} // namespace ros
|
||||
|
||||
void messageCallback(const MsgConstPtr& msg)
|
||||
{
|
||||
g_msg = msg;
|
||||
}
|
||||
|
||||
TEST(IntraprocessSubscriptions, noCopy)
|
||||
{
|
||||
g_msg.reset();
|
||||
g_msg_constructor = 0;
|
||||
|
||||
ros::NodeHandle nh;
|
||||
ros::Subscriber sub = nh.subscribe("test", 0, messageCallback);
|
||||
ros::Publisher pub = nh.advertise<Msg>("test", 0);
|
||||
|
||||
MsgConstPtr msg(boost::make_shared<Msg>());
|
||||
|
||||
while (pub.getNumSubscribers() == 0)
|
||||
{
|
||||
ros::Duration(0.01).sleep();
|
||||
}
|
||||
|
||||
pub.publish(msg);
|
||||
|
||||
while (!g_msg)
|
||||
{
|
||||
ros::spinOnce();
|
||||
ros::Duration(0.01).sleep();
|
||||
}
|
||||
|
||||
ASSERT_TRUE(g_msg);
|
||||
EXPECT_EQ(g_msg.get(), msg.get());
|
||||
EXPECT_FALSE(g_msg->serialized);
|
||||
EXPECT_FALSE(g_msg->deserialized);
|
||||
EXPECT_EQ(g_msg_constructor, 1ULL);
|
||||
}
|
||||
|
||||
TEST(IntraprocessSubscriptions, differentRTTI)
|
||||
{
|
||||
g_msg_constructor = 0;
|
||||
g_msg.reset();
|
||||
|
||||
ros::NodeHandle nh;
|
||||
ros::Subscriber sub = nh.subscribe("test", 0, messageCallback);
|
||||
ros::Publisher pub = nh.advertise<Msg2>("test", 0);
|
||||
|
||||
Msg2ConstPtr msg(boost::make_shared<Msg2>());
|
||||
|
||||
while (pub.getNumSubscribers() == 0)
|
||||
{
|
||||
ros::Duration(0.01).sleep();
|
||||
}
|
||||
|
||||
pub.publish(msg);
|
||||
|
||||
while (!g_msg)
|
||||
{
|
||||
ros::spinOnce();
|
||||
ros::Duration(0.01).sleep();
|
||||
}
|
||||
|
||||
ASSERT_TRUE(g_msg);
|
||||
EXPECT_NE((void*)g_msg.get(), (void*)msg.get());
|
||||
EXPECT_TRUE(msg->serialized);
|
||||
EXPECT_TRUE(g_msg->deserialized);
|
||||
EXPECT_EQ(g_msg_constructor, 1ULL);
|
||||
EXPECT_EQ(g_msg2_constructor, 1ULL);
|
||||
}
|
||||
|
||||
Msg2ConstPtr g_msg2;
|
||||
void messageCallback2(const Msg2ConstPtr& msg)
|
||||
{
|
||||
g_msg2 = msg;
|
||||
}
|
||||
|
||||
TEST(IntraprocessSubscriptions, noCopyAndDifferentRTTI)
|
||||
{
|
||||
g_msg.reset();
|
||||
|
||||
ros::NodeHandle nh;
|
||||
ros::Subscriber sub1 = nh.subscribe("test", 0, messageCallback);
|
||||
ros::Subscriber sub2 = nh.subscribe("test", 0, messageCallback2);
|
||||
ros::Publisher pub = nh.advertise<Msg2>("test", 0);
|
||||
|
||||
Msg2ConstPtr msg(boost::make_shared<Msg2>());
|
||||
|
||||
while (pub.getNumSubscribers() == 0)
|
||||
{
|
||||
ros::Duration(0.01).sleep();
|
||||
}
|
||||
|
||||
pub.publish(msg);
|
||||
|
||||
while (!g_msg || !g_msg2)
|
||||
{
|
||||
ros::spinOnce();
|
||||
ros::Duration(0.01).sleep();
|
||||
}
|
||||
|
||||
ASSERT_TRUE(g_msg);
|
||||
EXPECT_NE((void*)g_msg.get(), (void*)msg.get());
|
||||
EXPECT_TRUE(msg->serialized);
|
||||
EXPECT_TRUE(g_msg->deserialized);
|
||||
|
||||
ASSERT_TRUE(g_msg2);
|
||||
EXPECT_EQ(g_msg2.get(), msg.get());
|
||||
EXPECT_TRUE(g_msg2->serialized);
|
||||
EXPECT_FALSE(g_msg2->deserialized);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
ros::init(argc, argv, "intraprocess_subscriptions");
|
||||
|
||||
ros::NodeHandle nh;
|
||||
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
||||
129
thirdparty/ros/ros_comm/test/test_roscpp/test/src/latching_publisher.cpp
vendored
Normal file
129
thirdparty/ros/ros_comm/test/test_roscpp/test/src/latching_publisher.cpp
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Author: Josh Faust */
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "ros/ros.h"
|
||||
#include <test_roscpp/TestArray.h>
|
||||
|
||||
using namespace ros;
|
||||
using namespace test_roscpp;
|
||||
|
||||
std::string g_node_name = "test_latching_publisher";
|
||||
|
||||
class Helper
|
||||
{
|
||||
public:
|
||||
Helper()
|
||||
: count_(0)
|
||||
{}
|
||||
|
||||
void cb(const ros::MessageEvent<TestArray>& msg_event)
|
||||
{
|
||||
++count_;
|
||||
last_msg_event_ = msg_event;
|
||||
}
|
||||
|
||||
int32_t count_;
|
||||
ros::MessageEvent<TestArray> last_msg_event_;
|
||||
};
|
||||
|
||||
TEST(RoscppLatchingPublisher, nonLatching)
|
||||
{
|
||||
ros::NodeHandle n;
|
||||
ros::Publisher pub = n.advertise<TestArray>("test", 1, false);
|
||||
TestArray arr;
|
||||
pub.publish(arr);
|
||||
|
||||
Helper h;
|
||||
ros::Subscriber sub = n.subscribe("test", 1, &Helper::cb, &h);
|
||||
ros::Duration(0.1).sleep();
|
||||
ros::spinOnce();
|
||||
|
||||
ASSERT_EQ(h.count_, 0);
|
||||
}
|
||||
|
||||
TEST(RoscppLatchingPublisher, latching)
|
||||
{
|
||||
ros::NodeHandle n;
|
||||
ros::Publisher pub = n.advertise<TestArray>("test", 1, true);
|
||||
TestArray arr;
|
||||
pub.publish(arr);
|
||||
|
||||
Helper h;
|
||||
ros::Subscriber sub = n.subscribe("test", 1, &Helper::cb, &h);
|
||||
ros::Duration(0.1).sleep();
|
||||
ros::spinOnce();
|
||||
|
||||
ASSERT_EQ(h.count_, 1);
|
||||
|
||||
ASSERT_STREQ(h.last_msg_event_.getConnectionHeader()["latching"].c_str(), "1");
|
||||
}
|
||||
|
||||
TEST(RoscppLatchingPublisher, latchingMultipleSubscriptions)
|
||||
{
|
||||
ros::NodeHandle n;
|
||||
ros::Publisher pub = n.advertise<TestArray>("test", 1, true);
|
||||
TestArray arr;
|
||||
pub.publish(arr);
|
||||
|
||||
Helper h1, h2;
|
||||
ros::Subscriber sub1 = n.subscribe("test", 1, &Helper::cb, &h1);
|
||||
ros::Duration(0.1).sleep();
|
||||
ros::spinOnce();
|
||||
|
||||
ASSERT_EQ(h1.count_, 1);
|
||||
ASSERT_EQ(h2.count_, 0);
|
||||
|
||||
ros::Subscriber sub2 = n.subscribe("test", 1, &Helper::cb, &h2);
|
||||
ros::spinOnce();
|
||||
|
||||
ASSERT_EQ(h1.count_, 1);
|
||||
ASSERT_EQ(h2.count_, 1);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
ros::init(argc, argv, g_node_name);
|
||||
|
||||
ros::NodeHandle nh;
|
||||
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
||||
77
thirdparty/ros/ros_comm/test/test_roscpp/test/src/left_right.cpp
vendored
Normal file
77
thirdparty/ros/ros_comm/test/test_roscpp/test/src/left_right.cpp
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (c) 2011, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Author: Troy Straszheim */
|
||||
|
||||
/*
|
||||
* Basic publisher of two messages.
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "ros/ros.h"
|
||||
#include "std_msgs/String.h"
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
ros::init( argc, argv, "left_right");
|
||||
ros::NodeHandle nh;
|
||||
|
||||
ros::Publisher left = nh.advertise<std_msgs::String>("left", 0);
|
||||
ros::Publisher right = nh.advertise<std_msgs::String>("right", 0);
|
||||
|
||||
std_msgs::String msg_l, msg_r;
|
||||
msg_l.data = "left";
|
||||
msg_r.data = "right";
|
||||
|
||||
ros::Rate loop_rate(2);
|
||||
|
||||
for (unsigned j=0; j<5; ++j)
|
||||
{
|
||||
assert(ros::ok());
|
||||
|
||||
left.publish(msg_l);
|
||||
right.publish(msg_r);
|
||||
|
||||
ROS_INFO("ping!");
|
||||
|
||||
ros::spinOnce();
|
||||
loop_rate.sleep();
|
||||
ros::spinOnce();
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
97
thirdparty/ros/ros_comm/test/test_roscpp/test/src/loads_of_publishers.cpp
vendored
Normal file
97
thirdparty/ros/ros_comm/test/test_roscpp/test/src/loads_of_publishers.cpp
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Author: Josh Faust */
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <ros/ros.h>
|
||||
#include <ros/callback_queue.h>
|
||||
|
||||
#include "test_roscpp/TestArray.h"
|
||||
|
||||
uint32_t g_pub_count = 0;
|
||||
|
||||
void callback(const test_roscpp::TestArrayConstPtr&)
|
||||
{
|
||||
}
|
||||
|
||||
TEST(LoadsOfPublishers, waitForAll)
|
||||
{
|
||||
ros::NodeHandle nh;
|
||||
ros::Subscriber sub = nh.subscribe("roscpp/pubsub_test", 1000, callback);
|
||||
|
||||
while (sub.getNumPublishers() < g_pub_count)
|
||||
{
|
||||
ros::getGlobalCallbackQueue()->callAvailable(ros::WallDuration(0.1));
|
||||
}
|
||||
|
||||
ros::WallDuration(10).sleep();
|
||||
ros::spinOnce();
|
||||
ASSERT_EQ(sub.getNumPublishers(), g_pub_count);
|
||||
}
|
||||
|
||||
struct Helper
|
||||
{
|
||||
void callback(const ros::MessageEvent<test_roscpp::TestArray>& msg_event)
|
||||
{
|
||||
alive[msg_event.getPublisherName()] = true;
|
||||
}
|
||||
|
||||
std::map<std::string, bool> alive;
|
||||
};
|
||||
|
||||
TEST(LoadsOfPublishers, receiveFromAll)
|
||||
{
|
||||
ros::NodeHandle nh;
|
||||
Helper helper;
|
||||
ros::Subscriber sub = nh.subscribe("roscpp/pubsub_test", 1000, &Helper::callback, &helper);
|
||||
|
||||
while (helper.alive.size() < g_pub_count)
|
||||
{
|
||||
ros::getGlobalCallbackQueue()->callAvailable(ros::WallDuration(0.1));
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
ros::init(argc, argv, "loads_of_publishers");
|
||||
|
||||
if (argc < 2)
|
||||
{
|
||||
ROS_ERROR("Not enough arguments (usage: loads_of_publishers num_publishers)");
|
||||
return 1;
|
||||
}
|
||||
|
||||
g_pub_count = atoi(argv[1]);
|
||||
|
||||
ros::NodeHandle nh;
|
||||
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
83
thirdparty/ros/ros_comm/test/test_roscpp/test/src/multiple_init_fini.cpp
vendored
Normal file
83
thirdparty/ros/ros_comm/test/test_roscpp/test/src/multiple_init_fini.cpp
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Author: Josh Faust */
|
||||
|
||||
/*
|
||||
* Repeatedly create and destroy a node. Do some stuff in between to be sure things are working
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "ros/ros.h"
|
||||
#include <test_roscpp/TestArray.h>
|
||||
|
||||
int g_argc;
|
||||
char** g_argv;
|
||||
|
||||
void callback(const test_roscpp::TestArrayConstPtr&)
|
||||
{
|
||||
}
|
||||
|
||||
TEST(roscpp, multipleInitAndFini)
|
||||
{
|
||||
int try_count = 10;
|
||||
if ( g_argc > 1 )
|
||||
{
|
||||
try_count = atoi(g_argv[1]);
|
||||
}
|
||||
|
||||
for ( int i = 0; i < try_count; ++i )
|
||||
{
|
||||
ros::init( g_argc, g_argv, "multiple_init_fini" );
|
||||
ros::NodeHandle nh;
|
||||
|
||||
ros::Subscriber sub = nh.subscribe("test", 1, callback);
|
||||
ASSERT_TRUE(sub);
|
||||
|
||||
ros::Publisher pub = nh.advertise<test_roscpp::TestArray>( "test2", 1 );
|
||||
ASSERT_TRUE(pub);
|
||||
|
||||
ros::shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
g_argc = argc;
|
||||
g_argv = argv;
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
191
thirdparty/ros/ros_comm/test/test_roscpp/test/src/multiple_subscriptions.cpp
vendored
Normal file
191
thirdparty/ros/ros_comm/test/test_roscpp/test/src/multiple_subscriptions.cpp
vendored
Normal file
@@ -0,0 +1,191 @@
|
||||
/*
|
||||
* Copyright (C) 2008, Morgan Quigley and Willow Garage, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the names of Stanford University or Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Author: Morgan Quigley */
|
||||
|
||||
/*
|
||||
* Subscribe to a topic multiple times
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <gtest/gtest.h>
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
#include "ros/ros.h"
|
||||
#include <test_roscpp/TestArray.h>
|
||||
#include <test_roscpp/TestEmpty.h>
|
||||
|
||||
int g_argc;
|
||||
char** g_argv;
|
||||
|
||||
class Subscriptions : public testing::Test
|
||||
{
|
||||
public:
|
||||
ros::NodeHandle nh_;
|
||||
bool got_it[4], should_have_it[4];
|
||||
ros::Subscriber subs_[4];
|
||||
ros::Subscriber verify_sub_;
|
||||
ros::Subscriber reset_sub_;
|
||||
bool test_ready;
|
||||
int n_test;
|
||||
|
||||
void cb0(const test_roscpp::TestArrayConstPtr&) { if (!test_ready) return; got_it[0] = true; }
|
||||
void cb1(const test_roscpp::TestArrayConstPtr&) { if (!test_ready) return; got_it[1] = true; }
|
||||
void cb2(const test_roscpp::TestArrayConstPtr&) { if (!test_ready) return; got_it[2] = true; }
|
||||
void cb3(const test_roscpp::TestArrayConstPtr&) { if (!test_ready) return; got_it[3] = true; }
|
||||
void cb_verify(const test_roscpp::TestArrayConstPtr&)
|
||||
{
|
||||
if (!test_ready)
|
||||
return;
|
||||
n_test++;
|
||||
/*
|
||||
ASSERT_TRUE(((should_have_it[0] ? got_it[0] : true) &&
|
||||
(should_have_it[1] ? got_it[1] : true) &&
|
||||
(should_have_it[2] ? got_it[2] : true) &&
|
||||
(should_have_it[3] ? got_it[3] : true)));
|
||||
*/
|
||||
}
|
||||
void cb_reset(const test_roscpp::TestArrayConstPtr&)
|
||||
{
|
||||
got_it[0] = got_it[1] = got_it[2] = got_it[3] = false; test_ready = true;
|
||||
}
|
||||
|
||||
protected:
|
||||
bool sub(int cb_num)
|
||||
{
|
||||
ROS_INFO("Subscribing %d", cb_num);
|
||||
boost::function<void(const test_roscpp::TestArrayConstPtr&)> funcs[4] =
|
||||
{
|
||||
boost::bind(&Subscriptions::cb0, this, _1),
|
||||
boost::bind(&Subscriptions::cb1, this, _1),
|
||||
boost::bind(&Subscriptions::cb2, this, _1),
|
||||
boost::bind(&Subscriptions::cb3, this, _1),
|
||||
};
|
||||
|
||||
subs_[cb_num] = nh_.subscribe("roscpp/pubsub_test", 10, funcs[cb_num]);
|
||||
|
||||
return subs_[cb_num];
|
||||
}
|
||||
bool sub_wrappers()
|
||||
{
|
||||
ROS_INFO("sub_wrappers");
|
||||
verify_sub_ = nh_.subscribe("roscpp/pubsub_test", 10, &Subscriptions::cb_verify, this);
|
||||
reset_sub_ = nh_.subscribe("roscpp/pubsub_test", 10, &Subscriptions::cb_reset, this);
|
||||
return verify_sub_ && reset_sub_;
|
||||
}
|
||||
bool unsub(int cb_num)
|
||||
{
|
||||
ROS_INFO("unsubscribing %d", cb_num);
|
||||
subs_[cb_num].shutdown();
|
||||
|
||||
return true;
|
||||
}
|
||||
bool unsub_wrappers()
|
||||
{
|
||||
ROS_INFO("unsub wrappers");
|
||||
verify_sub_.shutdown();
|
||||
reset_sub_.shutdown();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(Subscriptions, multipleSubscriptions)
|
||||
{
|
||||
test_ready = false;
|
||||
|
||||
for (int i = 0; i < 0x10; i++)
|
||||
{
|
||||
for (int j = 0; j < 4; j++)
|
||||
should_have_it[j] = (i & (1 << j) ? true : false);
|
||||
|
||||
ROS_INFO(" testing: %d, %d, %d, %d\n",
|
||||
should_have_it[0],
|
||||
should_have_it[1],
|
||||
should_have_it[2],
|
||||
should_have_it[3]);
|
||||
|
||||
for (int j = 0; j < 4; j++)
|
||||
if (should_have_it[j])
|
||||
ASSERT_TRUE(sub(j));
|
||||
ASSERT_TRUE(sub_wrappers());
|
||||
|
||||
ros::Time t_start = ros::Time::now();
|
||||
n_test = 0;
|
||||
while (n_test < 10 && ros::Time::now() - t_start < ros::Duration(5000.0))
|
||||
{
|
||||
static int count = 0;
|
||||
if (count++ % 10 == 0)
|
||||
ROS_INFO("%d/100 tests completed...\n", n_test);
|
||||
|
||||
ros::spinOnce();
|
||||
ros::Duration(0.01).sleep();
|
||||
}
|
||||
|
||||
for (int j = 0; j < 4; j++)
|
||||
if (should_have_it[j])
|
||||
ASSERT_TRUE(unsub(j));
|
||||
ASSERT_TRUE(unsub_wrappers());
|
||||
}
|
||||
SUCCEED();
|
||||
}
|
||||
|
||||
void callback1(const test_roscpp::TestArrayConstPtr&)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void callback2(const test_roscpp::TestEmptyConstPtr&)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
TEST(Subscriptions2, multipleDifferentMD5Sums)
|
||||
{
|
||||
ros::NodeHandle nh;
|
||||
ros::Subscriber sub1 = nh.subscribe("test", 0, callback1);
|
||||
|
||||
try
|
||||
{
|
||||
ros::Subscriber sub2 = nh.subscribe("test", 0, callback2);
|
||||
FAIL();
|
||||
}
|
||||
catch (ros::ConflictingSubscriptionException&)
|
||||
{
|
||||
SUCCEED();
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
ros::init(argc, argv, "multiple_subscriptions");
|
||||
ros::NodeHandle nh;
|
||||
g_argc = argc;
|
||||
g_argv = argv;
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
||||
45
thirdparty/ros/ros_comm/test/test_roscpp/test/src/name_not_remappable.cpp
vendored
Normal file
45
thirdparty/ros/ros_comm/test/test_roscpp/test/src/name_not_remappable.cpp
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <ros/ros.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(RemappingTest, remapping_test)
|
||||
{
|
||||
ros::NodeHandle nh;
|
||||
|
||||
ASSERT_EQ(ros::this_node::getName(), "/NAME");
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
ros::init(argc, argv, "remapping_tester");
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
103
thirdparty/ros/ros_comm/test/test_roscpp/test/src/name_remapping.cpp
vendored
Normal file
103
thirdparty/ros/ros_comm/test/test_roscpp/test/src/name_remapping.cpp
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Author: Josh Faust */
|
||||
|
||||
/*
|
||||
* Test name remapping. Assumes the parameter "test" is remapped to "test_remap", and the node name is remapped to "name_remapped"
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "ros/ros.h"
|
||||
#include <ros/param.h>
|
||||
#include <ros/names.h>
|
||||
|
||||
TEST(roscpp, parameterRemapping)
|
||||
{
|
||||
std::string param;
|
||||
ASSERT_TRUE(ros::param::get("mapfrom", param));
|
||||
ASSERT_STREQ(ros::names::resolve("mapfrom").c_str(), "/mapto");
|
||||
|
||||
ASSERT_TRUE(ros::param::get("/mapto", param));
|
||||
ASSERT_STREQ(ros::names::resolve("/mapfrom").c_str(), "/mapto");
|
||||
}
|
||||
|
||||
TEST(roscpp, nodeNameRemapping)
|
||||
{
|
||||
std::string node_name = ros::this_node::getName();
|
||||
ASSERT_STREQ(node_name.c_str(), "/name_remapped");
|
||||
}
|
||||
|
||||
TEST(roscpp, cleanName)
|
||||
{
|
||||
ASSERT_STREQ(ros::names::clean("////asdf///").c_str(), "/asdf");
|
||||
ASSERT_STREQ(ros::names::clean("////asdf///jioweioj").c_str(), "/asdf/jioweioj");
|
||||
ASSERT_STREQ(ros::names::clean("////asdf///jioweioj/").c_str(), "/asdf/jioweioj");
|
||||
}
|
||||
|
||||
TEST(RoscppHandles, nodeHandleNameRemapping)
|
||||
{
|
||||
ros::M_string remap;
|
||||
remap["a"] = "b";
|
||||
remap["/a/a"] = "/a/b";
|
||||
remap["c"] = "/a/c";
|
||||
remap["d/d"] = "/c/e";
|
||||
remap["d/e"] = "c/f";
|
||||
ros::NodeHandle n("", remap);
|
||||
|
||||
EXPECT_STREQ(n.resolveName("a").c_str(), "/b");
|
||||
EXPECT_STREQ(n.resolveName("/a/a").c_str(), "/a/b");
|
||||
EXPECT_STREQ(n.resolveName("c").c_str(), "/a/c");
|
||||
EXPECT_STREQ(n.resolveName("d/d").c_str(), "/c/e");
|
||||
|
||||
ros::NodeHandle n2("z", remap);
|
||||
EXPECT_STREQ(n2.resolveName("a").c_str(), "/z/b");
|
||||
EXPECT_STREQ(n2.resolveName("/a/a").c_str(), "/a/b");
|
||||
EXPECT_STREQ(n2.resolveName("c").c_str(), "/a/c");
|
||||
EXPECT_STREQ(n2.resolveName("d/d").c_str(), "/c/e");
|
||||
EXPECT_STREQ(n2.resolveName("d/e").c_str(), "/z/c/f");
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
ros::init( argc, argv, "name_remapping" );
|
||||
ros::NodeHandle nh;
|
||||
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
81
thirdparty/ros/ros_comm/test/test_roscpp/test/src/name_remapping_with_ns.cpp
vendored
Normal file
81
thirdparty/ros/ros_comm/test/test_roscpp/test/src/name_remapping_with_ns.cpp
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Author: Josh Faust */
|
||||
|
||||
/*
|
||||
* Test name remapping. Assumes the parameter "test" is remapped to "test_remap", and the node name is remapped to "name_remapped"
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "ros/ros.h"
|
||||
#include <ros/param.h>
|
||||
#include <ros/names.h>
|
||||
|
||||
TEST(roscpp, parameterRemapping)
|
||||
{
|
||||
std::string param;
|
||||
ASSERT_STREQ(ros::names::resolve("test_full").c_str(), "/b/test_full");
|
||||
ASSERT_TRUE(ros::param::get("test_full", param));
|
||||
ASSERT_STREQ(ros::names::resolve("/a/test_full").c_str(), "/b/test_full");
|
||||
ASSERT_TRUE(ros::param::get("/a/test_full", param));
|
||||
|
||||
ASSERT_STREQ(ros::names::resolve("test_local").c_str(), "/a/test_local2");
|
||||
ASSERT_TRUE(ros::param::get("test_local", param));
|
||||
ASSERT_STREQ(ros::names::resolve("/a/test_local").c_str(), "/a/test_local2");
|
||||
ASSERT_TRUE(ros::param::get("/a/test_local", param));
|
||||
|
||||
ASSERT_STREQ(ros::names::resolve("test_relative").c_str(), "/b/test_relative");
|
||||
ASSERT_TRUE(ros::param::get("test_relative", param));
|
||||
ASSERT_STREQ(ros::names::resolve("/a/test_relative").c_str(), "/b/test_relative");
|
||||
ASSERT_TRUE(ros::param::get("/a/test_relative", param));
|
||||
}
|
||||
|
||||
TEST(roscpp, nodeNameRemapping)
|
||||
{
|
||||
std::string node_name = ros::this_node::getName();
|
||||
ASSERT_STREQ(node_name.c_str(), "/a/name_remapped_with_ns");
|
||||
}
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
ros::init( argc, argv, "name_remapping_with_ns" );
|
||||
ros::NodeHandle nh;
|
||||
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
99
thirdparty/ros/ros_comm/test/test_roscpp/test/src/namespaces.cpp
vendored
Normal file
99
thirdparty/ros/ros_comm/test/test_roscpp/test/src/namespaces.cpp
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Author: Josh Faust */
|
||||
|
||||
/*
|
||||
* Test namespaces
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <ros/ros.h>
|
||||
#include <ros/param.h>
|
||||
|
||||
TEST(namespaces, param)
|
||||
{
|
||||
std::string param;
|
||||
ASSERT_TRUE( ros::param::get( "parent", param ) );
|
||||
ROS_INFO("parent=%s", param.c_str());
|
||||
ASSERT_EQ(param, ":ROS_NAMESPACE:parent");
|
||||
}
|
||||
|
||||
TEST(namespaces, localParam)
|
||||
{
|
||||
std::string param;
|
||||
ASSERT_TRUE( ros::param::get( "~/local", param ) );
|
||||
ROS_INFO("~/local=%s", param.c_str());
|
||||
ASSERT_EQ(param, ":ROS_NAMESPACE:NODE_NAME:local");
|
||||
|
||||
ros::NodeHandle n("~");
|
||||
std::string param2;
|
||||
n.param<std::string>("local", param2, param);
|
||||
ASSERT_STREQ(param2.c_str(), param.c_str());
|
||||
ASSERT_STREQ(param2.c_str(), ":ROS_NAMESPACE:NODE_NAME:local");
|
||||
}
|
||||
|
||||
TEST(namespaces, globalParam)
|
||||
{
|
||||
std::string param;
|
||||
ASSERT_TRUE( ros::param::get( "/global", param ) );
|
||||
ASSERT_EQ(param, ":global");
|
||||
}
|
||||
|
||||
TEST(namespaces, otherNamespaceParam)
|
||||
{
|
||||
std::string param;
|
||||
ASSERT_TRUE( ros::param::get( "/other_namespace/param", param ) );
|
||||
ASSERT_EQ(param, ":other_namespace:param");
|
||||
}
|
||||
|
||||
TEST(namespaces, name)
|
||||
{
|
||||
std::string name = ros::this_node::getName();
|
||||
ASSERT_EQ(name, "/ROS_NAMESPACE/NODE_NAME");
|
||||
std::string nspace = ros::this_node::getNamespace();
|
||||
ASSERT_EQ(nspace, "/ROS_NAMESPACE");
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
ros::init( argc, argv, "namespaces" );
|
||||
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
144
thirdparty/ros/ros_comm/test/test_roscpp/test/src/nonconst_subscriptions.cpp
vendored
Normal file
144
thirdparty/ros/ros_comm/test/test_roscpp/test/src/nonconst_subscriptions.cpp
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* Copyright (c) 2010, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Author: Josh Faust */
|
||||
|
||||
/*
|
||||
* Subscribe intraprocess, ensuring that no copy happens
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "ros/ros.h"
|
||||
|
||||
#include "test_roscpp/TestEmpty.h"
|
||||
|
||||
|
||||
struct ConstHelper
|
||||
{
|
||||
void callback(const test_roscpp::TestEmptyConstPtr& msg)
|
||||
{
|
||||
message_ = msg;
|
||||
}
|
||||
|
||||
test_roscpp::TestEmptyConstPtr message_;
|
||||
};
|
||||
|
||||
struct NonConstHelper
|
||||
{
|
||||
void callback(const test_roscpp::TestEmptyPtr& msg)
|
||||
{
|
||||
message_ = msg;
|
||||
}
|
||||
|
||||
test_roscpp::TestEmptyPtr message_;
|
||||
};
|
||||
|
||||
TEST(NonConstSubscriptions, oneNonConstSubscriber)
|
||||
{
|
||||
NonConstHelper h;
|
||||
ros::NodeHandle nh;
|
||||
ros::Subscriber sub = nh.subscribe("test", 0, &NonConstHelper::callback, &h);
|
||||
ros::Publisher pub = nh.advertise<test_roscpp::TestEmpty>("test", 0);
|
||||
|
||||
test_roscpp::TestEmptyPtr msg(boost::make_shared<test_roscpp::TestEmpty>());
|
||||
pub.publish(msg);
|
||||
ros::spinOnce();
|
||||
|
||||
ASSERT_TRUE(h.message_);
|
||||
EXPECT_EQ(h.message_, msg);
|
||||
}
|
||||
|
||||
TEST(NonConstSubscriptions, oneConstOneNonConst)
|
||||
{
|
||||
NonConstHelper h;
|
||||
ConstHelper h2;
|
||||
ros::NodeHandle nh;
|
||||
ros::Subscriber sub = nh.subscribe("test", 0, &NonConstHelper::callback, &h);
|
||||
ros::Subscriber sub2 = nh.subscribe("test", 0, &ConstHelper::callback, &h2);
|
||||
ros::Publisher pub = nh.advertise<test_roscpp::TestEmpty>("test", 0);
|
||||
|
||||
test_roscpp::TestEmptyPtr msg(boost::make_shared<test_roscpp::TestEmpty>());
|
||||
pub.publish(msg);
|
||||
ros::spinOnce();
|
||||
|
||||
ASSERT_TRUE(h.message_);
|
||||
EXPECT_NE(h.message_, msg);
|
||||
EXPECT_EQ(h2.message_, msg);
|
||||
}
|
||||
|
||||
TEST(NonConstSubscriptions, twoNonConst)
|
||||
{
|
||||
NonConstHelper h;
|
||||
NonConstHelper h2;
|
||||
ros::NodeHandle nh;
|
||||
ros::Subscriber sub = nh.subscribe("test", 0, &NonConstHelper::callback, &h);
|
||||
ros::Subscriber sub2 = nh.subscribe("test", 0, &NonConstHelper::callback, &h2);
|
||||
ros::Publisher pub = nh.advertise<test_roscpp::TestEmpty>("test", 0);
|
||||
|
||||
test_roscpp::TestEmptyPtr msg(boost::make_shared<test_roscpp::TestEmpty>());
|
||||
pub.publish(msg);
|
||||
ros::spinOnce();
|
||||
|
||||
ASSERT_TRUE(h.message_);
|
||||
EXPECT_NE(h.message_, msg);
|
||||
}
|
||||
|
||||
TEST(NonConstSubscriptions, twoConst)
|
||||
{
|
||||
ConstHelper h;
|
||||
ConstHelper h2;
|
||||
ros::NodeHandle nh;
|
||||
ros::Subscriber sub = nh.subscribe("test", 0, &ConstHelper::callback, &h);
|
||||
ros::Subscriber sub2 = nh.subscribe("test", 0, &ConstHelper::callback, &h2);
|
||||
ros::Publisher pub = nh.advertise<test_roscpp::TestEmpty>("test", 0);
|
||||
|
||||
test_roscpp::TestEmptyPtr msg(boost::make_shared<test_roscpp::TestEmpty>());
|
||||
pub.publish(msg);
|
||||
ros::spinOnce();
|
||||
|
||||
ASSERT_TRUE(h.message_);
|
||||
EXPECT_EQ(h.message_, msg);
|
||||
EXPECT_EQ(h2.message_, msg);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
ros::init(argc, argv, "intraprocess_subscriptions");
|
||||
|
||||
ros::NodeHandle nh;
|
||||
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
||||
81
thirdparty/ros/ros_comm/test/test_roscpp/test/src/param_locale_avoidance_test.cpp
vendored
Normal file
81
thirdparty/ros/ros_comm/test/test_roscpp/test/src/param_locale_avoidance_test.cpp
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
/*********************************************************************
|
||||
* Software License Agreement (BSD License)
|
||||
*
|
||||
* Copyright (c) 2010, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
********************************************************************/
|
||||
|
||||
#include "ros/ros.h"
|
||||
#include <locale.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(Locale, push_pop)
|
||||
{
|
||||
int argc = 0;
|
||||
char argv[1][255] = { "string" };
|
||||
ros::init(argc, (char**)argv, "locale_push_pop");
|
||||
ros::NodeHandle nh;
|
||||
|
||||
ROS_INFO("locale is %s", setlocale(LC_NUMERIC, 0));
|
||||
|
||||
// this test only works on machines that have de_DE installed
|
||||
if (!setlocale(LC_NUMERIC, "de_DE.utf8"))
|
||||
{
|
||||
ROS_WARN("unable to set locale to de_DE.utf8, skipping test");
|
||||
return;
|
||||
}
|
||||
ROS_INFO("locale now %s", setlocale(LC_NUMERIC, 0));
|
||||
for(unsigned j=0; ros::ok() && j < 5; ++j)
|
||||
{
|
||||
ROS_INFO("setting parameters...");
|
||||
|
||||
double set = 123.45;
|
||||
nh.setParam("V", set);
|
||||
|
||||
double got;
|
||||
if (nh.getParam("V", got))
|
||||
{
|
||||
ROS_INFO("got pi=%3f <- should have commas in it", got);
|
||||
ASSERT_EQ(set, got);
|
||||
} else {
|
||||
FAIL();
|
||||
}
|
||||
|
||||
ros::WallDuration(0.1).sleep();
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
ros::init(argc, argv, "locale_push_pop");
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
66
thirdparty/ros/ros_comm/test/test_roscpp/test/src/param_update_test.cpp
vendored
Normal file
66
thirdparty/ros/ros_comm/test/test_roscpp/test/src/param_update_test.cpp
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
/*********************************************************************
|
||||
* Software License Agreement (BSD License)
|
||||
*
|
||||
* Copyright (c) 2008, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
********************************************************************/
|
||||
|
||||
#include "ros/ros.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
ros::init(argc, argv, "param_update_test");
|
||||
ros::NodeHandle nh;
|
||||
|
||||
while (ros::ok())
|
||||
{
|
||||
ROS_INFO("getting parameters...");
|
||||
|
||||
int i = -1;
|
||||
if (nh.getParamCached("test", i))
|
||||
{
|
||||
ROS_INFO("test=%d", i);
|
||||
}
|
||||
|
||||
if (nh.getParamCached("test2", i))
|
||||
{
|
||||
ROS_INFO("test2=%d", i);
|
||||
}
|
||||
|
||||
if (nh.getParamCached("test3", i))
|
||||
{
|
||||
ROS_INFO("test3=%d", i);
|
||||
}
|
||||
|
||||
ros::WallDuration(0.1).sleep();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
113
thirdparty/ros/ros_comm/test/test_roscpp/test/src/parameter_validation.cpp
vendored
Normal file
113
thirdparty/ros/ros_comm/test/test_roscpp/test/src/parameter_validation.cpp
vendored
Normal file
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* Copyright (c) 2010, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <ros/ros.h>
|
||||
|
||||
#include <test_roscpp/TestEmpty.h>
|
||||
|
||||
#define ASSERT_THROWS(expr) \
|
||||
try \
|
||||
{ \
|
||||
expr; \
|
||||
FAIL(); \
|
||||
} \
|
||||
catch (std::exception& e) \
|
||||
{ \
|
||||
ROS_INFO("Caught exception: %s", e.what());\
|
||||
}
|
||||
|
||||
void callback(const test_roscpp::TestEmptyConstPtr&)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
TEST(ParameterValidation, subscribeEmptyMD5Sum)
|
||||
{
|
||||
ros::NodeHandle nh;
|
||||
ros::SubscribeOptions ops;
|
||||
ops.init<test_roscpp::TestEmpty>("blah", 0, callback);
|
||||
ops.md5sum.clear();
|
||||
ASSERT_THROWS(nh.subscribe(ops));
|
||||
}
|
||||
|
||||
TEST(ParameterValidation, subscribeEmptyDataType)
|
||||
{
|
||||
ros::NodeHandle nh;
|
||||
ros::SubscribeOptions ops;
|
||||
ops.init<test_roscpp::TestEmpty>("blah", 0, callback);
|
||||
ops.datatype.clear();
|
||||
ASSERT_THROWS(nh.subscribe(ops));
|
||||
}
|
||||
|
||||
TEST(ParameterValidation, subscribeNoCallback)
|
||||
{
|
||||
ros::NodeHandle nh;
|
||||
ros::SubscribeOptions ops("blah", 0, "blah", "blah");
|
||||
ASSERT_THROWS(nh.subscribe(ops));
|
||||
}
|
||||
|
||||
TEST(ParameterValidation, advertiseEmptyMD5Sum)
|
||||
{
|
||||
ros::NodeHandle nh;
|
||||
ros::AdvertiseOptions ops("blah", 0, "", "blah", "blah");
|
||||
ASSERT_THROWS(nh.advertise(ops));
|
||||
}
|
||||
|
||||
TEST(ParameterValidation, advertiseEmptyDataType)
|
||||
{
|
||||
ros::NodeHandle nh;
|
||||
ros::AdvertiseOptions ops("blah", 0, "blah", "", "blah");
|
||||
ASSERT_THROWS(nh.advertise(ops));
|
||||
}
|
||||
|
||||
TEST(ParameterValidation, advertiseStarMD5Sum)
|
||||
{
|
||||
ros::NodeHandle nh;
|
||||
ros::AdvertiseOptions ops("blah", 0, "*", "blah", "blah");
|
||||
ASSERT_THROWS(nh.advertise(ops));
|
||||
}
|
||||
|
||||
TEST(ParameterValidation, advertiseStarDataType)
|
||||
{
|
||||
ros::NodeHandle nh;
|
||||
ros::AdvertiseOptions ops("blah", 0, "blah", "*", "blah");
|
||||
ASSERT_THROWS(nh.advertise(ops));
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
ros::init(argc, argv, "parameter_validation");
|
||||
|
||||
ros::NodeHandle nh;
|
||||
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
577
thirdparty/ros/ros_comm/test/test_roscpp/test/src/params.cpp
vendored
Normal file
577
thirdparty/ros/ros_comm/test/test_roscpp/test/src/params.cpp
vendored
Normal file
@@ -0,0 +1,577 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Author: Josh Faust */
|
||||
|
||||
/*
|
||||
* Test parameters
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "ros/ros.h"
|
||||
#include <ros/param.h>
|
||||
|
||||
using namespace ros;
|
||||
|
||||
TEST(Params, allParamTypes)
|
||||
{
|
||||
std::string string_param;
|
||||
EXPECT_TRUE( param::get( "string", string_param ) );
|
||||
EXPECT_TRUE( string_param == "test" );
|
||||
|
||||
int int_param = 0;
|
||||
EXPECT_TRUE( param::get( "int", int_param ) );
|
||||
EXPECT_TRUE( int_param == 10 );
|
||||
|
||||
double double_param = 0.0;
|
||||
EXPECT_TRUE( param::get( "double", double_param ) );
|
||||
EXPECT_DOUBLE_EQ( double_param, 10.5 );
|
||||
|
||||
bool bool_param = true;
|
||||
EXPECT_TRUE( param::get( "bool", bool_param ) );
|
||||
EXPECT_FALSE( bool_param );
|
||||
}
|
||||
|
||||
TEST(Params, setThenGetString)
|
||||
{
|
||||
param::set( "test_set_param", std::string("asdf") );
|
||||
std::string param;
|
||||
ASSERT_TRUE( param::get( "test_set_param", param ) );
|
||||
ASSERT_STREQ( "asdf", param.c_str() );
|
||||
|
||||
XmlRpc::XmlRpcValue v;
|
||||
param::get("test_set_param", v);
|
||||
ASSERT_EQ(v.getType(), XmlRpc::XmlRpcValue::TypeString);
|
||||
}
|
||||
|
||||
TEST(Params, setThenGetStringCached)
|
||||
{
|
||||
std::string param;
|
||||
ASSERT_FALSE( param::getCached( "test_set_param_setThenGetStringCached", param) );
|
||||
|
||||
param::set( "test_set_param_setThenGetStringCached", std::string("asdf") );
|
||||
|
||||
ASSERT_TRUE( param::getCached( "test_set_param_setThenGetStringCached", param) );
|
||||
ASSERT_STREQ( "asdf", param.c_str() );
|
||||
}
|
||||
|
||||
TEST(Params, setThenGetStringCachedNodeHandle)
|
||||
{
|
||||
NodeHandle nh;
|
||||
std::string param;
|
||||
ASSERT_FALSE( nh.getParamCached( "test_set_param_setThenGetStringCachedNodeHandle", param) );
|
||||
|
||||
nh.setParam( "test_set_param_setThenGetStringCachedNodeHandle", std::string("asdf") );
|
||||
|
||||
ASSERT_TRUE( nh.getParamCached( "test_set_param_setThenGetStringCachedNodeHandle", param) );
|
||||
ASSERT_STREQ( "asdf", param.c_str() );
|
||||
}
|
||||
|
||||
TEST(Params, setThenGetNamespaceCached)
|
||||
{
|
||||
std::string stringParam;
|
||||
XmlRpc::XmlRpcValue structParam;
|
||||
const std::string ns = "test_set_param_setThenGetStringCached2";
|
||||
ASSERT_FALSE(param::getCached(ns, stringParam));
|
||||
|
||||
param::set(ns, std::string("a"));
|
||||
ASSERT_TRUE(param::getCached(ns, stringParam));
|
||||
ASSERT_STREQ("a", stringParam.c_str());
|
||||
|
||||
param::set(ns + "/foo", std::string("b"));
|
||||
ASSERT_TRUE(param::getCached(ns + "/foo", stringParam));
|
||||
ASSERT_STREQ("b", stringParam.c_str());
|
||||
ASSERT_TRUE(param::getCached(ns, structParam));
|
||||
ASSERT_TRUE(structParam.hasMember("foo"));
|
||||
ASSERT_STREQ("b", static_cast<std::string>(structParam["foo"]).c_str());
|
||||
}
|
||||
|
||||
TEST(Params, setThenGetCString)
|
||||
{
|
||||
param::set( "test_set_param", "asdf" );
|
||||
std::string param;
|
||||
ASSERT_TRUE( param::get( "test_set_param", param ) );
|
||||
ASSERT_STREQ( "asdf", param.c_str() );
|
||||
}
|
||||
|
||||
TEST(Params, setThenGetInt)
|
||||
{
|
||||
param::set( "test_set_param", 42);
|
||||
int param;
|
||||
ASSERT_TRUE( param::get( "test_set_param", param ) );
|
||||
ASSERT_EQ( 42, param );
|
||||
XmlRpc::XmlRpcValue v;
|
||||
param::get("test_set_param", v);
|
||||
ASSERT_EQ(v.getType(), XmlRpc::XmlRpcValue::TypeInt);
|
||||
}
|
||||
|
||||
TEST(Params, unknownParam)
|
||||
{
|
||||
std::string param;
|
||||
ASSERT_FALSE( param::get( "this_param_really_should_not_exist", param ) );
|
||||
}
|
||||
|
||||
TEST(Params, deleteParam)
|
||||
{
|
||||
param::set( "test_delete_param", "asdf" );
|
||||
param::del( "test_delete_param" );
|
||||
std::string param;
|
||||
ASSERT_FALSE( param::get( "test_delete_param", param ) );
|
||||
}
|
||||
|
||||
TEST(Params, hasParam)
|
||||
{
|
||||
ASSERT_TRUE( param::has( "string" ) );
|
||||
}
|
||||
|
||||
TEST(Params, setIntDoubleGetInt)
|
||||
{
|
||||
param::set("test_set_int_as_double", 1);
|
||||
param::set("test_set_int_as_double", 3.0f);
|
||||
|
||||
int i = -1;
|
||||
ASSERT_TRUE(param::get("test_set_int_as_double", i));
|
||||
ASSERT_EQ(3, i);
|
||||
double d = 0.0f;
|
||||
ASSERT_TRUE(param::get("test_set_int_as_double", d));
|
||||
ASSERT_EQ(3.0, d);
|
||||
}
|
||||
|
||||
TEST(Params, getIntAsDouble)
|
||||
{
|
||||
param::set("int_param", 1);
|
||||
double d = 0.0;
|
||||
ASSERT_TRUE(param::get("int_param", d));
|
||||
ASSERT_EQ(1.0, d);
|
||||
}
|
||||
|
||||
TEST(Params, getDoubleAsInt)
|
||||
{
|
||||
param::set("double_param", 2.3);
|
||||
int i = -1;
|
||||
ASSERT_TRUE(param::get("double_param", i));
|
||||
ASSERT_EQ(2, i);
|
||||
|
||||
param::set("double_param", 3.8);
|
||||
i = -1;
|
||||
ASSERT_TRUE(param::get("double_param", i));
|
||||
ASSERT_EQ(4, i);
|
||||
}
|
||||
|
||||
TEST(Params, searchParam)
|
||||
{
|
||||
std::string ns = "/a/b/c/d/e/f";
|
||||
std::string result;
|
||||
|
||||
param::set("/s_i", 1);
|
||||
ASSERT_TRUE(param::search(ns, "s_i", result));
|
||||
ASSERT_STREQ(result.c_str(), "/s_i");
|
||||
param::del("/s_i");
|
||||
|
||||
param::set("/a/b/s_i", 1);
|
||||
ASSERT_TRUE(param::search(ns, "s_i", result));
|
||||
ASSERT_STREQ(result.c_str(), "/a/b/s_i");
|
||||
param::del("/a/b/s_i");
|
||||
|
||||
param::set("/a/b/c/d/e/f/s_i", 1);
|
||||
ASSERT_TRUE(param::search(ns, "s_i", result));
|
||||
ASSERT_STREQ(result.c_str(), "/a/b/c/d/e/f/s_i");
|
||||
param::del("/a/b/c/d/e/f/s_i");
|
||||
|
||||
bool cont = true;
|
||||
while (!cont)
|
||||
{
|
||||
ros::WallDuration(0.1).sleep();
|
||||
}
|
||||
|
||||
ASSERT_FALSE(param::search(ns, "s_j", result));
|
||||
}
|
||||
|
||||
TEST(Params, searchParamNodeHandle)
|
||||
{
|
||||
NodeHandle n("/a/b/c/d/e/f");
|
||||
std::string result;
|
||||
|
||||
n.setParam("/s_i", 1);
|
||||
ASSERT_TRUE(n.searchParam("s_i", result));
|
||||
ASSERT_STREQ(result.c_str(), "/s_i");
|
||||
n.deleteParam("/s_i");
|
||||
|
||||
n.setParam("/a/b/s_i", 1);
|
||||
ASSERT_TRUE(n.searchParam("s_i", result));
|
||||
ASSERT_STREQ(result.c_str(), "/a/b/s_i");
|
||||
n.deleteParam("/a/b/s_i");
|
||||
|
||||
n.setParam("/a/b/c/d/e/f/s_i", 1);
|
||||
ASSERT_TRUE(n.searchParam("s_i", result));
|
||||
ASSERT_STREQ(result.c_str(), "/a/b/c/d/e/f/s_i");
|
||||
n.deleteParam("/a/b/c/d/e/f/s_i");
|
||||
|
||||
ASSERT_FALSE(n.searchParam("s_j", result));
|
||||
}
|
||||
|
||||
TEST(Params, searchParamNodeHandleWithRemapping)
|
||||
{
|
||||
M_string remappings;
|
||||
remappings["s_c"] = "s_b";
|
||||
NodeHandle n("/a/b/c/d/e/f", remappings);
|
||||
std::string result;
|
||||
|
||||
n.setParam("/s_c", 1);
|
||||
ASSERT_FALSE(n.searchParam("s_c", result));
|
||||
n.setParam("/s_b", 1);
|
||||
ASSERT_TRUE(n.searchParam("s_c", result));
|
||||
}
|
||||
|
||||
// See ROS ticket #2381
|
||||
TEST(Params, getMissingXmlRpcValueParameterCachedTwice)
|
||||
{
|
||||
XmlRpc::XmlRpcValue v;
|
||||
ASSERT_FALSE(ros::param::getCached("invalid_xmlrpcvalue_param", v));
|
||||
ASSERT_FALSE(ros::param::getCached("invalid_xmlrpcvalue_param", v));
|
||||
}
|
||||
|
||||
// See ROS ticket #2353
|
||||
TEST(Params, doublePrecision)
|
||||
{
|
||||
ros::param::set("bar", 0.123456789123456789);
|
||||
double d;
|
||||
ASSERT_TRUE(ros::param::get("bar", d));
|
||||
EXPECT_DOUBLE_EQ(d, 0.12345678912345678);
|
||||
}
|
||||
|
||||
std::vector<std::string> vec_s, vec_s2;
|
||||
std::vector<double> vec_d, vec_d2;
|
||||
std::vector<float> vec_f, vec_f2;
|
||||
std::vector<int> vec_i, vec_i2;
|
||||
std::vector<bool> vec_b, vec_b2;
|
||||
|
||||
TEST(Params, vectorStringParam)
|
||||
{
|
||||
const std::string param_name = "vec_str_param";
|
||||
|
||||
vec_s.clear();
|
||||
vec_s.push_back("foo");
|
||||
vec_s.push_back("bar");
|
||||
vec_s.push_back("baz");
|
||||
|
||||
ros::param::set(param_name, vec_s);
|
||||
|
||||
ASSERT_FALSE(ros::param::get(param_name, vec_d));
|
||||
ASSERT_FALSE(ros::param::get(param_name, vec_f));
|
||||
ASSERT_FALSE(ros::param::get(param_name, vec_i));
|
||||
ASSERT_FALSE(ros::param::get(param_name, vec_b));
|
||||
|
||||
ASSERT_TRUE(ros::param::get(param_name, vec_s2));
|
||||
|
||||
ASSERT_EQ(vec_s.size(), vec_s2.size());
|
||||
ASSERT_TRUE(std::equal(vec_s.begin(), vec_s.end(), vec_s2.begin()));
|
||||
|
||||
// Test empty vector
|
||||
vec_s.clear();
|
||||
ros::param::set(param_name, vec_s);
|
||||
ASSERT_TRUE(ros::param::get(param_name, vec_s2));
|
||||
ASSERT_EQ(vec_s.size(), vec_s2.size());
|
||||
}
|
||||
|
||||
TEST(Params, vectorDoubleParam)
|
||||
{
|
||||
const std::string param_name = "vec_double_param";
|
||||
|
||||
vec_d.clear();
|
||||
vec_d.push_back(-0.123456789);
|
||||
vec_d.push_back(3);
|
||||
vec_d.push_back(3.01);
|
||||
vec_d.push_back(7.01);
|
||||
|
||||
ros::param::set(param_name, vec_d);
|
||||
|
||||
ASSERT_FALSE(ros::param::get(param_name, vec_s));
|
||||
ASSERT_TRUE(ros::param::get(param_name, vec_i));
|
||||
ASSERT_TRUE(ros::param::get(param_name, vec_b));
|
||||
ASSERT_TRUE(ros::param::get(param_name, vec_f));
|
||||
|
||||
ASSERT_TRUE(ros::param::get(param_name, vec_d2));
|
||||
|
||||
ASSERT_EQ(vec_d.size(), vec_d2.size());
|
||||
ASSERT_TRUE(std::equal(vec_d.begin(), vec_d.end(), vec_d2.begin()));
|
||||
}
|
||||
|
||||
TEST(Params, vectorFloatParam)
|
||||
{
|
||||
const std::string param_name = "vec_float_param";
|
||||
|
||||
vec_f.clear();
|
||||
vec_f.push_back(-0.123456789);
|
||||
vec_f.push_back(0.0);
|
||||
vec_f.push_back(3);
|
||||
vec_f.push_back(3.01);
|
||||
|
||||
ros::param::set(param_name, vec_f);
|
||||
|
||||
ASSERT_FALSE(ros::param::get(param_name, vec_s));
|
||||
ASSERT_TRUE(ros::param::get(param_name, vec_i));
|
||||
ASSERT_TRUE(ros::param::get(param_name, vec_b));
|
||||
ASSERT_TRUE(ros::param::get(param_name, vec_d));
|
||||
|
||||
ASSERT_EQ(vec_b[0],true);
|
||||
ASSERT_EQ(vec_b[1],false);
|
||||
|
||||
ASSERT_TRUE(ros::param::get(param_name, vec_f2));
|
||||
|
||||
ASSERT_EQ(vec_f.size(), vec_f2.size());
|
||||
ASSERT_TRUE(std::equal(vec_f.begin(), vec_f.end(), vec_f2.begin()));
|
||||
}
|
||||
|
||||
TEST(Params, vectorIntParam)
|
||||
{
|
||||
const std::string param_name = "vec_int_param";
|
||||
|
||||
vec_i.clear();
|
||||
vec_i.push_back(-1);
|
||||
vec_i.push_back(0);
|
||||
vec_i.push_back(1337);
|
||||
vec_i.push_back(2);
|
||||
|
||||
ros::param::set(param_name, vec_i);
|
||||
|
||||
ASSERT_FALSE(ros::param::get(param_name, vec_s));
|
||||
ASSERT_TRUE(ros::param::get(param_name, vec_d));
|
||||
ASSERT_TRUE(ros::param::get(param_name, vec_f));
|
||||
ASSERT_TRUE(ros::param::get(param_name, vec_b));
|
||||
|
||||
ASSERT_EQ(vec_b[0],true);
|
||||
ASSERT_EQ(vec_b[1],false);
|
||||
|
||||
ASSERT_TRUE(ros::param::get(param_name, vec_i2));
|
||||
|
||||
ASSERT_EQ(vec_i.size(), vec_i2.size());
|
||||
ASSERT_TRUE(std::equal(vec_i.begin(), vec_i.end(), vec_i2.begin()));
|
||||
}
|
||||
|
||||
TEST(Params, vectorBoolParam)
|
||||
{
|
||||
const std::string param_name = "vec_bool_param";
|
||||
|
||||
vec_b.clear();
|
||||
vec_b.push_back(true);
|
||||
vec_b.push_back(false);
|
||||
vec_b.push_back(true);
|
||||
vec_b.push_back(true);
|
||||
|
||||
ros::param::set(param_name, vec_b);
|
||||
|
||||
ASSERT_FALSE(ros::param::get(param_name, vec_s));
|
||||
ASSERT_TRUE(ros::param::get(param_name, vec_d));
|
||||
ASSERT_TRUE(ros::param::get(param_name, vec_f));
|
||||
ASSERT_TRUE(ros::param::get(param_name, vec_i));
|
||||
|
||||
ASSERT_EQ(vec_i[0],1);
|
||||
ASSERT_EQ(vec_i[1],0);
|
||||
|
||||
ASSERT_TRUE(ros::param::get(param_name, vec_b2));
|
||||
|
||||
ASSERT_EQ(vec_b.size(), vec_b2.size());
|
||||
ASSERT_TRUE(std::equal(vec_b.begin(), vec_b.end(), vec_b2.begin()));
|
||||
}
|
||||
|
||||
std::map<std::string,std::string> map_s, map_s2;
|
||||
std::map<std::string,double> map_d, map_d2;
|
||||
std::map<std::string,float> map_f, map_f2;
|
||||
std::map<std::string,int> map_i, map_i2;
|
||||
std::map<std::string,bool> map_b, map_b2;
|
||||
|
||||
TEST(Params, mapStringParam)
|
||||
{
|
||||
const std::string param_name = "map_str_param";
|
||||
|
||||
map_s.clear();
|
||||
map_s["a"] = "apple";
|
||||
map_s["b"] = "blueberry";
|
||||
map_s["c"] = "carrot";
|
||||
|
||||
ros::param::set(param_name, map_s);
|
||||
|
||||
ASSERT_FALSE(ros::param::get(param_name, map_d));
|
||||
ASSERT_FALSE(ros::param::get(param_name, map_f));
|
||||
ASSERT_FALSE(ros::param::get(param_name, map_i));
|
||||
ASSERT_FALSE(ros::param::get(param_name, map_b));
|
||||
|
||||
ASSERT_TRUE(ros::param::get(param_name, map_s2));
|
||||
|
||||
ASSERT_EQ(map_s.size(), map_s2.size());
|
||||
ASSERT_TRUE(std::equal(map_s.begin(), map_s.end(), map_s2.begin()));
|
||||
}
|
||||
|
||||
TEST(Params, mapDoubleParam)
|
||||
{
|
||||
const std::string param_name = "map_double_param";
|
||||
|
||||
map_d.clear();
|
||||
map_d["a"] = 0.0;
|
||||
map_d["b"] = -0.123456789;
|
||||
map_d["c"] = 123456789;
|
||||
|
||||
ros::param::set(param_name, map_d);
|
||||
|
||||
ASSERT_FALSE(ros::param::get(param_name, map_s));
|
||||
ASSERT_TRUE(ros::param::get(param_name, map_f));
|
||||
ASSERT_TRUE(ros::param::get(param_name, map_i));
|
||||
ASSERT_TRUE(ros::param::get(param_name, map_b));
|
||||
|
||||
ASSERT_TRUE(ros::param::get(param_name, map_d2));
|
||||
|
||||
ASSERT_EQ(map_d.size(), map_d2.size());
|
||||
ASSERT_TRUE(std::equal(map_d.begin(), map_d.end(), map_d2.begin()));
|
||||
}
|
||||
|
||||
TEST(Params, mapFloatParam)
|
||||
{
|
||||
const std::string param_name = "map_float_param";
|
||||
|
||||
map_f.clear();
|
||||
map_f["a"] = 0.0;
|
||||
map_f["b"] = -0.123456789;
|
||||
map_f["c"] = 123456789;
|
||||
|
||||
ros::param::set(param_name, map_f);
|
||||
|
||||
ASSERT_FALSE(ros::param::get(param_name, map_s));
|
||||
ASSERT_TRUE(ros::param::get(param_name, map_d));
|
||||
ASSERT_TRUE(ros::param::get(param_name, map_i));
|
||||
ASSERT_TRUE(ros::param::get(param_name, map_b));
|
||||
|
||||
ASSERT_TRUE(ros::param::get(param_name, map_f2));
|
||||
|
||||
ASSERT_EQ(map_f.size(), map_f2.size());
|
||||
ASSERT_TRUE(std::equal(map_f.begin(), map_f.end(), map_f2.begin()));
|
||||
}
|
||||
|
||||
TEST(Params, mapIntParam)
|
||||
{
|
||||
const std::string param_name = "map_int_param";
|
||||
|
||||
map_i.clear();
|
||||
map_i["a"] = 0;
|
||||
map_i["b"] = -1;
|
||||
map_i["c"] = 1337;
|
||||
|
||||
ros::param::set(param_name, map_i);
|
||||
|
||||
ASSERT_FALSE(ros::param::get(param_name, map_s));
|
||||
ASSERT_TRUE(ros::param::get(param_name, map_d));
|
||||
ASSERT_TRUE(ros::param::get(param_name, map_f));
|
||||
ASSERT_TRUE(ros::param::get(param_name, map_b));
|
||||
|
||||
ASSERT_TRUE(ros::param::get(param_name, map_i2));
|
||||
|
||||
ASSERT_EQ(map_i.size(), map_i2.size());
|
||||
ASSERT_TRUE(std::equal(map_i.begin(), map_i.end(), map_i2.begin()));
|
||||
}
|
||||
|
||||
TEST(Params, mapBoolParam)
|
||||
{
|
||||
const std::string param_name = "map_bool_param";
|
||||
|
||||
map_b.clear();
|
||||
map_b["a"] = true;
|
||||
map_b["b"] = false;
|
||||
map_b["c"] = true;
|
||||
|
||||
ros::param::set(param_name, map_b);
|
||||
|
||||
ASSERT_FALSE(ros::param::get(param_name, map_s));
|
||||
ASSERT_TRUE(ros::param::get(param_name, map_d));
|
||||
ASSERT_TRUE(ros::param::get(param_name, map_f));
|
||||
ASSERT_TRUE(ros::param::get(param_name, map_i));
|
||||
|
||||
ASSERT_EQ(map_i["a"],1);
|
||||
ASSERT_EQ(map_i["b"],0);
|
||||
|
||||
ASSERT_TRUE(ros::param::get(param_name, map_b2));
|
||||
|
||||
ASSERT_EQ(map_b.size(), map_b2.size());
|
||||
ASSERT_TRUE(std::equal(map_b.begin(), map_b.end(), map_b2.begin()));
|
||||
}
|
||||
|
||||
TEST(Params, paramTemplateFunction)
|
||||
{
|
||||
EXPECT_EQ( param::param<std::string>( "string", "" ), "test" );
|
||||
EXPECT_EQ( param::param<std::string>( "gnirts", "test" ), "test" );
|
||||
|
||||
EXPECT_EQ( param::param<int>( "int", 0 ), 10 );
|
||||
EXPECT_EQ( param::param<int>( "tni", 10 ), 10 );
|
||||
|
||||
EXPECT_DOUBLE_EQ( param::param<double>( "double", 0.0 ), 10.5 );
|
||||
EXPECT_DOUBLE_EQ( param::param<double>( "elbuod", 10.5 ), 10.5 );
|
||||
|
||||
EXPECT_EQ( param::param<bool>( "bool", true ), false );
|
||||
EXPECT_EQ( param::param<bool>( "loob", true ), true );
|
||||
}
|
||||
|
||||
TEST(Params, paramNodeHandleTemplateFunction)
|
||||
{
|
||||
NodeHandle nh;
|
||||
|
||||
EXPECT_EQ( nh.param<std::string>( "string", "" ), "test" );
|
||||
EXPECT_EQ( nh.param<std::string>( "gnirts", "test" ), "test" );
|
||||
|
||||
EXPECT_EQ( nh.param<int>( "int", 0 ), 10 );
|
||||
EXPECT_EQ( nh.param<int>( "tni", 10 ), 10 );
|
||||
|
||||
EXPECT_DOUBLE_EQ( nh.param<double>( "double", 0.0 ), 10.5 );
|
||||
EXPECT_DOUBLE_EQ( nh.param<double>( "elbuod", 10.5 ), 10.5 );
|
||||
|
||||
EXPECT_EQ( nh.param<bool>( "bool", true ), false );
|
||||
EXPECT_EQ( nh.param<bool>( "loob", true ), true );
|
||||
}
|
||||
|
||||
TEST(Params, getParamNames) {
|
||||
std::vector<std::string> test_params;
|
||||
EXPECT_TRUE(ros::param::getParamNames(test_params));
|
||||
EXPECT_LT(10, test_params.size());
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
ros::init( argc, argv, "params" );
|
||||
// ros::NodeHandle nh;
|
||||
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
79
thirdparty/ros/ros_comm/test/test_roscpp/test/src/pub_sub.cpp
vendored
Normal file
79
thirdparty/ros/ros_comm/test/test_roscpp/test/src/pub_sub.cpp
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Author: Brian Gerkey */
|
||||
|
||||
/*
|
||||
* Publish a message N times, back to back
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "ros/ros.h"
|
||||
#include <test_roscpp/TestArray.h>
|
||||
|
||||
int32_t g_array_size = 1;
|
||||
|
||||
void messageCallback(const test_roscpp::TestArrayConstPtr& msg, ros::Publisher pub)
|
||||
{
|
||||
test_roscpp::TestArray copy = *msg;
|
||||
copy.counter++;
|
||||
|
||||
while (ros::ok() && pub.getNumSubscribers() == 0)
|
||||
{
|
||||
ros::Duration(0.01).sleep();
|
||||
}
|
||||
|
||||
pub.publish(copy);
|
||||
}
|
||||
|
||||
#define USAGE "USAGE: publish_n_fast <sz>"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
ros::init(argc, argv, "pub_sub");
|
||||
|
||||
if(argc != 2)
|
||||
{
|
||||
puts(USAGE);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
g_array_size = atoi(argv[1]);
|
||||
|
||||
ros::NodeHandle nh;
|
||||
|
||||
ros::Publisher pub = nh.advertise<test_roscpp::TestArray>("roscpp/pubsub_test", 1);
|
||||
ros::Subscriber sub = nh.subscribe<test_roscpp::TestArray>("roscpp/subpub_test", 1, boost::bind(messageCallback, _1, pub));
|
||||
|
||||
ros::spin();
|
||||
}
|
||||
54
thirdparty/ros/ros_comm/test/test_roscpp/test/src/publish_constantly.cpp
vendored
Normal file
54
thirdparty/ros/ros_comm/test/test_roscpp/test/src/publish_constantly.cpp
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Author: Brian Gerkey */
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#include "ros/ros.h"
|
||||
#include "test_roscpp/TestArray.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
ros::init(argc, argv, "publish_constantly");
|
||||
ros::NodeHandle nh;
|
||||
ros::Publisher pub = nh.advertise<test_roscpp::TestArray>("roscpp/pubsub_test", 100);
|
||||
|
||||
test_roscpp::TestArray msg;
|
||||
msg.float_arr.resize(100);
|
||||
|
||||
ros::WallDuration d(0.01);
|
||||
while(ros::ok())
|
||||
{
|
||||
d.sleep();
|
||||
pub.publish(msg);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
74
thirdparty/ros/ros_comm/test/test_roscpp/test/src/publish_empty.cpp
vendored
Normal file
74
thirdparty/ros/ros_comm/test/test_roscpp/test/src/publish_empty.cpp
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Author: Brian Gerkey */
|
||||
|
||||
/*
|
||||
* Publish an empty message N times, back to back
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "ros/ros.h"
|
||||
#include <test_roscpp/TestEmpty.h>
|
||||
|
||||
int32_t g_msg_count = 0;
|
||||
void subscriberCallback(const ros::SingleSubscriberPublisher&, ros::Publisher& pub)
|
||||
{
|
||||
test_roscpp::TestEmpty msg;
|
||||
for(int i = 0; i < g_msg_count; i++)
|
||||
{
|
||||
pub.publish(msg);
|
||||
ROS_INFO("published message %d", i);
|
||||
}
|
||||
}
|
||||
|
||||
#define USAGE "USAGE: publish_empty <count>"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
ros::init(argc, argv, "publish_onsub");
|
||||
|
||||
if(argc != 2)
|
||||
{
|
||||
puts(USAGE);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
g_msg_count = atoi(argv[1]);
|
||||
|
||||
ros::NodeHandle nh;
|
||||
ros::Publisher pub;
|
||||
pub = nh.advertise<test_roscpp::TestEmpty>("roscpp/pubsub_test", g_msg_count, boost::bind(subscriberCallback, _1, boost::ref(pub)));
|
||||
|
||||
ros::spin();
|
||||
}
|
||||
80
thirdparty/ros/ros_comm/test/test_roscpp/test/src/publish_n_fast.cpp
vendored
Normal file
80
thirdparty/ros/ros_comm/test/test_roscpp/test/src/publish_n_fast.cpp
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Author: Brian Gerkey */
|
||||
|
||||
/*
|
||||
* Publish a message N times, back to back
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "ros/ros.h"
|
||||
#include <test_roscpp/TestArray.h>
|
||||
|
||||
#define USAGE "USAGE: publish_n_fast <count> <min_size> <max_size>"
|
||||
|
||||
void connectCallback(const ros::SingleSubscriberPublisher &pub, int msg_count, int min_size, int max_size)
|
||||
{
|
||||
test_roscpp::TestArray msg;
|
||||
for(int i = 0; i < msg_count; i++)
|
||||
{
|
||||
msg.counter = i;
|
||||
int j = min_size + (int) ((max_size - min_size) * (rand() / (RAND_MAX + 1.0)));
|
||||
msg.float_arr.resize(j);
|
||||
ROS_INFO("published message %d (%d bytes)\n",
|
||||
msg.counter, ros::serialization::Serializer<test_roscpp::TestArray>::serializedLength(msg));
|
||||
pub.publish(msg);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
ros::init(argc, argv, "publish_n_fast");
|
||||
ros::NodeHandle n;
|
||||
|
||||
if(argc != 4)
|
||||
{
|
||||
puts(USAGE);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
int msg_count = atoi(argv[1]);
|
||||
int min_size = atoi(argv[2]);
|
||||
int max_size = atoi(argv[3]);
|
||||
|
||||
ros::Publisher pub_ = n.advertise<test_roscpp::TestArray>("roscpp/pubsub_test", msg_count, boost::bind(&connectCallback, _1, msg_count, min_size, max_size));
|
||||
ros::spin();
|
||||
|
||||
return 0;
|
||||
}
|
||||
73
thirdparty/ros/ros_comm/test/test_roscpp/test/src/publish_onsub.cpp
vendored
Normal file
73
thirdparty/ros/ros_comm/test/test_roscpp/test/src/publish_onsub.cpp
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Author: Brian Gerkey */
|
||||
|
||||
/*
|
||||
* Publish an empty message N times, back to back
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "ros/ros.h"
|
||||
#include <test_roscpp/TestEmpty.h>
|
||||
|
||||
int32_t g_msg_count = 0;
|
||||
void subscriberCallback(const ros::SingleSubscriberPublisher& pub)
|
||||
{
|
||||
test_roscpp::TestEmpty msg;
|
||||
for(int i = 0; i < g_msg_count; i++)
|
||||
{
|
||||
pub.publish(msg);
|
||||
ROS_INFO("published message %d", i);
|
||||
}
|
||||
}
|
||||
|
||||
#define USAGE "USAGE: publish_empty <count>"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
ros::init(argc, argv, "publish_onsub");
|
||||
|
||||
if(argc != 2)
|
||||
{
|
||||
puts(USAGE);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
g_msg_count = atoi(argv[1]);
|
||||
|
||||
ros::NodeHandle nh;
|
||||
ros::Publisher pub = nh.advertise<test_roscpp::TestEmpty>("roscpp/pubsub_test", g_msg_count, boost::bind(subscriberCallback, _1));
|
||||
|
||||
ros::spin();
|
||||
}
|
||||
133
thirdparty/ros/ros_comm/test/test_roscpp/test/src/publish_unadvertise.cpp
vendored
Normal file
133
thirdparty/ros/ros_comm/test/test_roscpp/test/src/publish_unadvertise.cpp
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Author: Brian Gerkey */
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "ros/ros.h"
|
||||
#include <test_roscpp/TestArray.h>
|
||||
|
||||
static int g_argc;
|
||||
static char** g_argv;
|
||||
|
||||
bool failure;
|
||||
bool advertised;
|
||||
|
||||
class Publications : public testing::Test
|
||||
{
|
||||
public:
|
||||
ros::NodeHandle nh_;
|
||||
ros::Publisher pub_;
|
||||
|
||||
void subscriberCallback(const ros::SingleSubscriberPublisher&)
|
||||
{
|
||||
ROS_INFO("subscriberCallback invoked");
|
||||
if(!advertised)
|
||||
{
|
||||
ROS_INFO("but not advertised");
|
||||
failure = true;
|
||||
}
|
||||
}
|
||||
|
||||
bool adv()
|
||||
{
|
||||
pub_ = nh_.advertise<test_roscpp::TestArray>("roscpp/pubsub_test", 1, boost::bind(&Publications::subscriberCallback, this, _1));
|
||||
return pub_;
|
||||
}
|
||||
|
||||
void unadv()
|
||||
{
|
||||
pub_.shutdown();
|
||||
}
|
||||
|
||||
protected:
|
||||
Publications() {}
|
||||
void SetUp()
|
||||
{
|
||||
advertised = false;
|
||||
failure = false;
|
||||
|
||||
ASSERT_TRUE(g_argc == 1);
|
||||
}
|
||||
void TearDown()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(Publications, pubUnadvertise)
|
||||
{
|
||||
advertised = true;
|
||||
ROS_INFO("advertising");
|
||||
ASSERT_TRUE(adv());
|
||||
ros::Time t1(ros::Time::now()+ros::Duration(2.0));
|
||||
|
||||
while(ros::Time::now() < t1 && !failure)
|
||||
{
|
||||
ros::WallDuration(0.01).sleep();
|
||||
ros::spinOnce();
|
||||
}
|
||||
|
||||
unadv();
|
||||
|
||||
ROS_INFO("unadvertised");
|
||||
advertised = false;
|
||||
|
||||
ros::Time t2(ros::Time::now()+ros::Duration(2.0));
|
||||
while(ros::Time::now() < t2 && !failure)
|
||||
{
|
||||
ros::WallDuration(0.01).sleep();
|
||||
ros::spinOnce();
|
||||
}
|
||||
|
||||
advertised = true;
|
||||
ASSERT_TRUE(adv());
|
||||
unadv();
|
||||
ASSERT_TRUE(adv());
|
||||
|
||||
if(failure)
|
||||
FAIL();
|
||||
else
|
||||
SUCCEED();
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
ros::init(argc, argv, "publish_unadvertise");
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
g_argc = argc;
|
||||
g_argv = argv;
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
35
thirdparty/ros/ros_comm/test/test_roscpp/test/src/publisher.cpp
vendored
Normal file
35
thirdparty/ros/ros_comm/test/test_roscpp/test/src/publisher.cpp
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
// Publish big data chunks
|
||||
// Author: Max Schwarz <max.schwarz@uni-bonn.de>
|
||||
|
||||
#include <ros/publisher.h>
|
||||
#include <ros/init.h>
|
||||
#include <ros/node_handle.h>
|
||||
|
||||
#include <std_msgs/Int8MultiArray.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
ros::init(argc, argv, "publisher");
|
||||
ros::NodeHandle n;
|
||||
|
||||
const size_t NUM_BYTES = 4000;
|
||||
std_msgs::Int8MultiArray data;
|
||||
data.data.reserve(NUM_BYTES);
|
||||
|
||||
ros::Publisher pub = n.advertise<std_msgs::Int8MultiArray>("data", 1);
|
||||
ros::Rate rate(10.0);
|
||||
|
||||
size_t start = 0;
|
||||
while(ros::ok())
|
||||
{
|
||||
data.data.clear();
|
||||
for(size_t i = 0; i < NUM_BYTES; ++i)
|
||||
{
|
||||
data.data.push_back(start + i);
|
||||
}
|
||||
pub.publish(data);
|
||||
rate.sleep();
|
||||
start++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
73
thirdparty/ros/ros_comm/test/test_roscpp/test/src/publisher_for_star_subscriber.cpp
vendored
Normal file
73
thirdparty/ros/ros_comm/test/test_roscpp/test/src/publisher_for_star_subscriber.cpp
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (c) 2010, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Author: Josh Faust
|
||||
*/
|
||||
|
||||
#include <ros/ros.h>
|
||||
#include <std_srvs/Empty.h>
|
||||
#include <test_roscpp/TestEmpty.h>
|
||||
#include <test_roscpp/TestArray.h>
|
||||
|
||||
ros::Publisher g_pub;
|
||||
int8_t type = 0;
|
||||
|
||||
bool switchPublisherType(std_srvs::EmptyRequest&, std_srvs::EmptyResponse&)
|
||||
{
|
||||
ros::NodeHandle nh;
|
||||
g_pub.shutdown();
|
||||
type = (type + 1) % 2;
|
||||
switch (type)
|
||||
{
|
||||
case 0:
|
||||
g_pub = nh.advertise<test_roscpp::TestEmpty>("test_star_inter", 0);
|
||||
break;
|
||||
case 1:
|
||||
g_pub = nh.advertise<test_roscpp::TestArray>("test_star_inter", 0);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void pubTimer(const ros::TimerEvent&)
|
||||
{
|
||||
g_pub.publish(test_roscpp::TestEmpty());
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
ros::init(argc, argv, "publisher_for_star_subscriber");
|
||||
ros::NodeHandle nh;
|
||||
|
||||
g_pub = nh.advertise<test_roscpp::TestEmpty>("test_star_inter", 0);
|
||||
ros::Timer t = nh.createTimer(ros::Duration(0.01), pubTimer);
|
||||
ros::ServiceServer s = nh.advertiseService("switch_publisher_type", switchPublisherType);
|
||||
ros::spin();
|
||||
}
|
||||
114
thirdparty/ros/ros_comm/test/test_roscpp/test/src/real_time_test.cpp
vendored
Normal file
114
thirdparty/ros/ros_comm/test/test_roscpp/test/src/real_time_test.cpp
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Software License Agreement (BSD License)
|
||||
*
|
||||
* Copyright (c) 2008, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Author: Tony Pratkanis */
|
||||
|
||||
/*
|
||||
* Subscribe to a topic multiple times
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <gtest/gtest.h>
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
#include "ros/ros.h"
|
||||
#include <rosgraph_msgs/Clock.h>
|
||||
|
||||
int g_argc;
|
||||
char** g_argv;
|
||||
|
||||
|
||||
class RosTimeTest : public testing::Test
|
||||
{
|
||||
public:
|
||||
void setTime(ros::Time t)
|
||||
{
|
||||
rosgraph_msgs::Clock message;
|
||||
message.clock = t;
|
||||
pub_.publish(message);
|
||||
}
|
||||
|
||||
protected:
|
||||
RosTimeTest()
|
||||
{
|
||||
pub_ = nh_.advertise<rosgraph_msgs::Clock>("/clock", 1);
|
||||
}
|
||||
|
||||
ros::NodeHandle nh_;
|
||||
ros::Publisher pub_;
|
||||
|
||||
};
|
||||
|
||||
TEST_F(RosTimeTest, RealTimeTest)
|
||||
{
|
||||
//Get the start time.
|
||||
ros::Time start = ros::Time::now();
|
||||
|
||||
//Checks to see if the time is larger than a thousand seconds
|
||||
//this is a good indication that we are getting the system time.
|
||||
ASSERT_TRUE(start.toSec() > 1000.0);
|
||||
|
||||
//Wait a second
|
||||
ros::Duration wait(1, 0); wait.sleep();
|
||||
ros::Time end = ros::Time::now();
|
||||
ros::Duration d = end - start;
|
||||
|
||||
//After waiting one second, see if we really waited on second.
|
||||
ASSERT_LT(d.toSec(), 1.1);
|
||||
ASSERT_GT(d.toSec(), 0.9);
|
||||
|
||||
//Publish a rostime of 42.
|
||||
setTime(ros::Time(42, 0));
|
||||
|
||||
//Wait half a second to make sure we get the message.
|
||||
ros::WallDuration(0.5).sleep();
|
||||
ros::spinOnce();
|
||||
|
||||
//Make sure that it has not been set
|
||||
ASSERT_NE(ros::Time::now().toSec(), 42.0);
|
||||
|
||||
|
||||
SUCCEED();
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
ros::init(argc, argv, "real_time_test");
|
||||
g_argc = argc;
|
||||
g_argv = argv;
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
||||
89
thirdparty/ros/ros_comm/test/test_roscpp/test/src/service_adv.cpp
vendored
Normal file
89
thirdparty/ros/ros_comm/test/test_roscpp/test/src/service_adv.cpp
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Author: Brian Gerkey */
|
||||
|
||||
/*
|
||||
* Advertise a service
|
||||
*/
|
||||
|
||||
#include "ros/ros.h"
|
||||
#include <test_roscpp/TestStringString.h>
|
||||
|
||||
bool caseFlip(test_roscpp::TestStringString::Request &req,
|
||||
test_roscpp::TestStringString::Response &res)
|
||||
{
|
||||
// copy over the request and overwrite the letters with their case-flip
|
||||
res.str = req.str;
|
||||
for (size_t i = 0; i < res.str.length(); i++)
|
||||
{
|
||||
char c = res.str[i];
|
||||
if (islower(c))
|
||||
c = toupper(c);
|
||||
else if (isupper(c))
|
||||
c = tolower(c);
|
||||
res.str[i] = c;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool caseFlipLongRunning(test_roscpp::TestStringString::Request &req,
|
||||
test_roscpp::TestStringString::Response &res)
|
||||
{
|
||||
caseFlip(req, res);
|
||||
|
||||
ros::Duration(2).sleep();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool caseFlipUnadvertise(test_roscpp::TestStringString::Request &req,
|
||||
test_roscpp::TestStringString::Response &res, ros::ServiceServer& srv)
|
||||
{
|
||||
caseFlip(req, res);
|
||||
|
||||
srv.shutdown();
|
||||
|
||||
ros::Duration(2).sleep();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
ros::init(argc, argv, "service_adv");
|
||||
ros::NodeHandle nh;
|
||||
|
||||
ros::ServiceServer srv1, srv2, srv3;
|
||||
srv1 = nh.advertiseService("service_adv", caseFlip);
|
||||
srv2 = nh.advertiseService("service_adv_long", caseFlipLongRunning);
|
||||
srv3 = nh.advertiseService<test_roscpp::TestStringString::Request, test_roscpp::TestStringString::Response>("service_adv_unadv_in_callback", boost::bind(caseFlipUnadvertise, _1, _2, boost::ref(srv3)));
|
||||
ros::spin();
|
||||
}
|
||||
|
||||
62
thirdparty/ros/ros_comm/test/test_roscpp/test/src/service_adv_a.cpp
vendored
Normal file
62
thirdparty/ros/ros_comm/test/test_roscpp/test/src/service_adv_a.cpp
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Author: Josh Faust */
|
||||
|
||||
/*
|
||||
* Advertise a service, then run another app that advertises another service
|
||||
*/
|
||||
|
||||
#include "ros/ros.h"
|
||||
#include <test_roscpp/TestStringString.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <cstdlib>
|
||||
|
||||
bool srvCallback(test_roscpp::TestStringString::Request &,
|
||||
test_roscpp::TestStringString::Response &res)
|
||||
{
|
||||
res.str = "A";
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
ros::init(argc, argv, "service_adv_a");
|
||||
ros::NodeHandle nh;
|
||||
|
||||
ros::ServiceServer srv = nh.advertiseService("service_adv", srvCallback);
|
||||
|
||||
ros::spin();
|
||||
}
|
||||
|
||||
68
thirdparty/ros/ros_comm/test/test_roscpp/test/src/service_adv_multiple.cpp
vendored
Normal file
68
thirdparty/ros/ros_comm/test/test_roscpp/test/src/service_adv_multiple.cpp
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Author: Josh Faust */
|
||||
|
||||
/*
|
||||
* Advertise a service twice, making sure the first succeeds and second fails
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "ros/ros.h"
|
||||
#include "ros/service.h"
|
||||
#include <test_roscpp/TestStringString.h>
|
||||
|
||||
bool srvCallback(test_roscpp::TestStringString::Request &,
|
||||
test_roscpp::TestStringString::Response &)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
TEST(SrvCall, advertiseMultiple)
|
||||
{
|
||||
ros::NodeHandle nh;
|
||||
ros::ServiceServer srv = nh.advertiseService("service_adv", srvCallback);
|
||||
ASSERT_TRUE(srv);
|
||||
ros::ServiceServer srv2 = nh.advertiseService("service_adv", srvCallback);
|
||||
ASSERT_FALSE(srv2);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
ros::init(argc, argv, "service_adv_multiple");
|
||||
ros::NodeHandle nh;
|
||||
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
||||
|
||||
127
thirdparty/ros/ros_comm/test/test_roscpp/test/src/service_adv_unadv.cpp
vendored
Normal file
127
thirdparty/ros/ros_comm/test/test_roscpp/test/src/service_adv_unadv.cpp
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Author: Brian Gerkey */
|
||||
|
||||
/*
|
||||
* Advertise a service
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "ros/ros.h"
|
||||
#include <test_roscpp/TestStringString.h>
|
||||
|
||||
|
||||
static int g_argc;
|
||||
static char** g_argv;
|
||||
|
||||
class ServiceAdvertiser : public testing::Test
|
||||
{
|
||||
public:
|
||||
ros::NodeHandle nh_;
|
||||
ros::ServiceServer srv_;
|
||||
|
||||
bool advertised_;
|
||||
bool failure_;
|
||||
|
||||
bool srvCallback(test_roscpp::TestStringString::Request &,
|
||||
test_roscpp::TestStringString::Response &)
|
||||
{
|
||||
ROS_INFO("in callback");
|
||||
if(!advertised_)
|
||||
{
|
||||
ROS_INFO("but not advertised!");
|
||||
failure_ = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
protected:
|
||||
ServiceAdvertiser() {}
|
||||
void SetUp()
|
||||
{
|
||||
failure_ = false;
|
||||
advertised_ = false;
|
||||
|
||||
ASSERT_TRUE(g_argc == 1);
|
||||
}
|
||||
|
||||
bool adv()
|
||||
{
|
||||
ROS_INFO("advertising");
|
||||
srv_ = nh_.advertiseService("service_adv", &ServiceAdvertiser::srvCallback, this);
|
||||
ROS_INFO("advertised");
|
||||
return srv_;
|
||||
}
|
||||
bool unadv()
|
||||
{
|
||||
ROS_INFO("unadvertising");
|
||||
srv_.shutdown();
|
||||
ROS_INFO("unadvertised");
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(ServiceAdvertiser, advUnadv)
|
||||
{
|
||||
advertised_ = true;
|
||||
ASSERT_TRUE(adv());
|
||||
|
||||
for(int i=0;i<100;i++)
|
||||
{
|
||||
if(advertised_)
|
||||
{
|
||||
ASSERT_TRUE(unadv());
|
||||
advertised_ = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
advertised_ = true;
|
||||
ASSERT_TRUE(adv());
|
||||
}
|
||||
|
||||
ros::WallDuration(0.01).sleep();
|
||||
}
|
||||
|
||||
if(failure_)
|
||||
FAIL();
|
||||
else
|
||||
SUCCEED();
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
ros::init(argc, argv, "service_adv_unadv");
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
g_argc = argc;
|
||||
g_argv = argv;
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
||||
61
thirdparty/ros/ros_comm/test/test_roscpp/test/src/service_adv_zombie.cpp
vendored
Normal file
61
thirdparty/ros/ros_comm/test/test_roscpp/test/src/service_adv_zombie.cpp
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 2014 Max Schwarz <max.schwarz@uni-bonn.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// Advertise a service, then crash horribly and leaving a "zombie service"
|
||||
// behind. Needed for service_call_zombie test.
|
||||
|
||||
#include <ros/ros.h>
|
||||
#include <test_roscpp/TestStringString.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
bool srvCallback(test_roscpp::TestStringString::Request &,
|
||||
test_roscpp::TestStringString::Response &res)
|
||||
{
|
||||
res.str = "B";
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
ros::init(argc, argv, "dying_node");
|
||||
|
||||
ros::NodeHandle nh;
|
||||
ros::ServiceServer srv = nh.advertiseService("phantom_service", srvCallback);
|
||||
|
||||
// Allow for some time for registering on the master
|
||||
for(int i = 0; i < 10; ++i)
|
||||
{
|
||||
ros::spinOnce();
|
||||
usleep(100*1000);
|
||||
}
|
||||
|
||||
// Exit immediately without calling any atexit hooks
|
||||
_Exit(0);
|
||||
}
|
||||
239
thirdparty/ros/ros_comm/test/test_roscpp/test/src/service_call.cpp
vendored
Normal file
239
thirdparty/ros/ros_comm/test/test_roscpp/test/src/service_call.cpp
vendored
Normal file
@@ -0,0 +1,239 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Author: Brian Gerkey */
|
||||
|
||||
/*
|
||||
* Call a service
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "ros/ros.h"
|
||||
#include "ros/time.h"
|
||||
#include "ros/service.h"
|
||||
#include "ros/connection.h"
|
||||
#include "ros/service_client.h"
|
||||
#include <test_roscpp/TestStringString.h>
|
||||
#include <test_roscpp/BadTestStringString.h>
|
||||
|
||||
TEST(SrvCall, callSrv)
|
||||
{
|
||||
test_roscpp::TestStringString::Request req;
|
||||
test_roscpp::TestStringString::Response res;
|
||||
|
||||
req.str = std::string("case_FLIP");
|
||||
|
||||
ASSERT_TRUE(ros::service::waitForService("service_adv"));
|
||||
ASSERT_TRUE(ros::service::call("service_adv", req, res));
|
||||
|
||||
ASSERT_STREQ(res.str.c_str(), "CASE_flip");
|
||||
}
|
||||
|
||||
TEST(SrvCall, callSrvUnicode)
|
||||
{
|
||||
test_roscpp::TestStringString::Request req;
|
||||
test_roscpp::TestStringString::Response res;
|
||||
|
||||
req.str = std::string("ロボット");
|
||||
|
||||
ASSERT_TRUE(ros::service::waitForService("service_adv"));
|
||||
ASSERT_TRUE(ros::service::call("service_adv", req, res));
|
||||
|
||||
ASSERT_STREQ(res.str.c_str(), "ロボット");
|
||||
}
|
||||
|
||||
TEST(SrvCall, callSrvMultipleTimes)
|
||||
{
|
||||
test_roscpp::TestStringString::Request req;
|
||||
test_roscpp::TestStringString::Response res;
|
||||
|
||||
req.str = std::string("case_FLIP");
|
||||
|
||||
ASSERT_TRUE(ros::service::waitForService("service_adv"));
|
||||
|
||||
ros::Time start = ros::Time::now();
|
||||
|
||||
for (int i = 0; i < 100; ++i)
|
||||
{
|
||||
ASSERT_TRUE(ros::service::call("service_adv", req, res));
|
||||
}
|
||||
|
||||
ros::Time end = ros::Time::now();
|
||||
ros::Duration d = end - start;
|
||||
printf("100 calls took %f secs\n", d.toSec());
|
||||
|
||||
ASSERT_STREQ(res.str.c_str(), "CASE_flip");
|
||||
}
|
||||
|
||||
TEST(SrvCall, callSrvWithWrongType)
|
||||
{
|
||||
test_roscpp::BadTestStringString::Request req;
|
||||
test_roscpp::BadTestStringString::Response res;
|
||||
|
||||
ASSERT_TRUE(ros::service::waitForService("service_adv"));
|
||||
|
||||
for ( int i = 0; i < 4; ++i )
|
||||
{
|
||||
bool call_result = ros::service::call("service_adv", req, res);
|
||||
ASSERT_FALSE(call_result);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(SrvCall, callSrvHandle)
|
||||
{
|
||||
test_roscpp::TestStringString::Request req;
|
||||
test_roscpp::TestStringString::Response res;
|
||||
|
||||
req.str = std::string("case_FLIP");
|
||||
|
||||
std::map<std::string, std::string> header;
|
||||
header["test1"] = "testing 1";
|
||||
header["test2"] = "testing 2";
|
||||
ros::NodeHandle nh;
|
||||
ros::ServiceClient handle = nh.serviceClient<test_roscpp::TestStringString>("service_adv", false, header);
|
||||
ASSERT_TRUE(handle.waitForExistence());
|
||||
|
||||
ros::Time start = ros::Time::now();
|
||||
|
||||
for (int i = 0; i < 100; ++i)
|
||||
{
|
||||
ASSERT_TRUE(handle.call(req, res));
|
||||
}
|
||||
|
||||
ros::Time end = ros::Time::now();
|
||||
ros::Duration d = end - start;
|
||||
printf("100 calls took %f secs\n", d.toSec());
|
||||
|
||||
ASSERT_STREQ(res.str.c_str(), "CASE_flip");
|
||||
}
|
||||
|
||||
TEST(SrvCall, callSrvPersistentHandle)
|
||||
{
|
||||
test_roscpp::TestStringString::Request req;
|
||||
test_roscpp::TestStringString::Response res;
|
||||
|
||||
req.str = std::string("case_FLIP");
|
||||
|
||||
ASSERT_TRUE(ros::service::waitForService("service_adv"));
|
||||
|
||||
std::map<std::string, std::string> header;
|
||||
header["test1"] = "testing 1";
|
||||
header["test2"] = "testing 2";
|
||||
ros::NodeHandle nh;
|
||||
ros::ServiceClient handle = nh.serviceClient<test_roscpp::TestStringString>("service_adv", true, header);
|
||||
|
||||
ros::Time start = ros::Time::now();
|
||||
|
||||
for (int i = 0; i < 10000; ++i)
|
||||
{
|
||||
ASSERT_TRUE(handle.call(req, res));
|
||||
}
|
||||
|
||||
ros::Time end = ros::Time::now();
|
||||
ros::Duration d = end - start;
|
||||
printf("10000 calls took %f secs\n", d.toSec());
|
||||
|
||||
ASSERT_STREQ(res.str.c_str(), "CASE_flip");
|
||||
}
|
||||
|
||||
TEST(SrvCall, callSrvLongRunning)
|
||||
{
|
||||
test_roscpp::TestStringString::Request req;
|
||||
test_roscpp::TestStringString::Response res;
|
||||
|
||||
req.str = std::string("case_FLIP");
|
||||
|
||||
ASSERT_TRUE(ros::service::waitForService("service_adv_long"));
|
||||
ASSERT_TRUE(ros::service::call("service_adv_long", req, res));
|
||||
|
||||
ASSERT_STREQ(res.str.c_str(), "CASE_flip");
|
||||
}
|
||||
|
||||
TEST(SrvCall, callSrvWhichUnadvertisesInCallback)
|
||||
{
|
||||
test_roscpp::TestStringString::Request req;
|
||||
test_roscpp::TestStringString::Response res;
|
||||
|
||||
req.str = std::string("case_FLIP");
|
||||
|
||||
ASSERT_TRUE(ros::service::waitForService("service_adv_unadv_in_callback"));
|
||||
ASSERT_FALSE(ros::service::call("service_adv_unadv_in_callback", req, res));
|
||||
}
|
||||
|
||||
TEST(SrvCall, handleValid)
|
||||
{
|
||||
test_roscpp::TestStringString::Request req;
|
||||
test_roscpp::TestStringString::Response res;
|
||||
|
||||
req.str = std::string("case_FLIP");
|
||||
|
||||
ASSERT_TRUE(ros::service::waitForService("service_adv"));
|
||||
|
||||
std::map<std::string, std::string> header;
|
||||
header["test1"] = "testing 1";
|
||||
header["test2"] = "testing 2";
|
||||
ros::NodeHandle nh;
|
||||
ros::ServiceClient handle = nh.serviceClient<test_roscpp::TestStringString>("service_adv", true, header);
|
||||
ASSERT_TRUE(handle.call(req, res));
|
||||
ASSERT_TRUE(handle.isValid());
|
||||
handle.shutdown();
|
||||
ASSERT_FALSE(handle.isValid());
|
||||
|
||||
ASSERT_STREQ(res.str.c_str(), "CASE_flip");
|
||||
}
|
||||
|
||||
TEST(SrvCall, waitForServiceTimeout)
|
||||
{
|
||||
ros::NodeHandle nh;
|
||||
ASSERT_FALSE(ros::service::waitForService("iojergoiwjoiewg", 1000));
|
||||
ASSERT_FALSE(ros::service::waitForService("iojergoiwjoiewg", ros::Duration(1)));
|
||||
|
||||
ros::ServiceClient handle = nh.serviceClient<test_roscpp::TestStringString>("migowiowejowieuhwejg", false);
|
||||
ASSERT_FALSE(handle.waitForExistence(ros::Duration(1)));
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
|
||||
ros::init(argc, argv, "service_call");
|
||||
ros::NodeHandle nh;
|
||||
|
||||
int ret = RUN_ALL_TESTS();
|
||||
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
72
thirdparty/ros/ros_comm/test/test_roscpp/test/src/service_call_expect_b.cpp
vendored
Normal file
72
thirdparty/ros/ros_comm/test/test_roscpp/test/src/service_call_expect_b.cpp
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Author: Josh Faust */
|
||||
|
||||
/*
|
||||
* Call a service, expecting a specific value
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "ros/ros.h"
|
||||
#include "ros/service.h"
|
||||
#include <test_roscpp/TestStringString.h>
|
||||
|
||||
TEST(SrvCall, callSrv)
|
||||
{
|
||||
test_roscpp::TestStringString::Request req;
|
||||
test_roscpp::TestStringString::Response res;
|
||||
|
||||
req.str = "nothing";
|
||||
ros::NodeHandle nh;
|
||||
|
||||
int param;
|
||||
while(!nh.getParam("advertisers_ready", param))
|
||||
ros::Duration(0.01).sleep();
|
||||
bool call_result = ros::service::call("service_adv", req, res);
|
||||
ASSERT_TRUE(call_result);
|
||||
|
||||
ASSERT_STREQ(res.str.c_str(), "B");
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
|
||||
ros::init(argc, argv, "service_call_expect_b");
|
||||
ros::NodeHandle nh;
|
||||
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
||||
|
||||
60
thirdparty/ros/ros_comm/test/test_roscpp/test/src/service_call_repeatedly.cpp
vendored
Normal file
60
thirdparty/ros/ros_comm/test/test_roscpp/test/src/service_call_repeatedly.cpp
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Author: Brian Gerkey */
|
||||
|
||||
/*
|
||||
* Call a service repeatedly
|
||||
*/
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#include "ros/ros.h"
|
||||
#include "ros/service.h"
|
||||
#include <test_roscpp/TestStringString.h>
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
ros::init(argc, argv, "service_call_repeatedly");
|
||||
ros::NodeHandle nh;
|
||||
|
||||
test_roscpp::TestStringString::Request req;
|
||||
test_roscpp::TestStringString::Response res;
|
||||
|
||||
while(ros::ok())
|
||||
{
|
||||
ros::service::call("service_adv", req, res);
|
||||
ros::Duration(0.01).sleep();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user