Skip to content

Commit

Permalink
Add test for #609
Browse files Browse the repository at this point in the history
  • Loading branch information
Affonso-Gui committed Apr 2, 2019
1 parent 63aeadf commit e59b5d6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
1 change: 1 addition & 0 deletions roseus/msg/TestName.msg
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
roseus/StringStamped name
roseus/String string
19 changes: 13 additions & 6 deletions roseus/test/test-name-pub.l
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,18 @@
(ros::advertise "test_name" roseus::TestName)
(ros::rate 1)
(setq i 0)

;; Test for name clashing in ROS messages
;; `name' tests for name clashing in slot names
;; `string' tests for name clashing in message names

(while (ros::ok)
(setq ss (instance roseus::StringStamped :init :data (format nil "test ~A" (incf i))))
(setq msg (instance roseus::TestName :init :name ss))
(ros::ros-info "pub ~A" msg)
(ros::publish "test_name" msg)
(ros::sleep)
(ros::spin-once))
(let* ((str (format nil "test ~A" (incf i)))
(s (instance roseus::String :init :data str))
(ss (instance roseus::StringStamped :init :data str))
(msg (instance roseus::TestName :init :name ss :string s)))
(ros::ros-info "pub ~A" msg)
(ros::publish "test_name" msg)
(ros::sleep)
(ros::spin-once)))

5 changes: 4 additions & 1 deletion roseus/test/test-name-sub.l
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/usr/bin/env roseus

(ros::load-ros-manifest "roseus")
;; It is important to load `TestName.l' before `String.l' to test for name clashing
;; between roseus::String and lisp::string
(flet ((directory (dir) (list "TestName.l" "StringStamped.l" "String.l")))
(ros::roseus-add-files "roseus" "msg"))

(ros::roseus "test_name_sub")
(ros::subscribe "test_name" roseus::TestName #'(lambda (msg) (ros::ros-info "sub ~A" msg)))
Expand Down

0 comments on commit e59b5d6

Please sign in to comment.