-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4d45a0d
commit add0271
Showing
4 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env roseus | ||
(require :unittest "lib/llib/unittest.l") | ||
(init-unit-test) | ||
|
||
(ros::roseus "test_memory_subscriber") | ||
(ros::rate 200) | ||
|
||
(defclass my-srv :slots (req)) | ||
(defmethod my-srv | ||
(:update (_req) | ||
(setq req _req) | ||
(send _req :response)) | ||
(:get () req)) | ||
|
||
(sys:make-thread 1) | ||
(defun test-once (topic) | ||
(let ((srv (instance my-srv))) | ||
(ros::advertise-service topic std_srvs::Empty #'send srv :update) | ||
(ros::wait-for-service topic) | ||
(sys:thread-no-wait #'ros::service-call topic (instance std_srvs::EmptyRequest :init)) | ||
(while (not (send srv :get)) | ||
(ros::spin-once)) | ||
(ros::unadvertise-service topic))) | ||
|
||
(deftest test-service () | ||
(dotimes (i 5000) | ||
(if (zerop (mod i 100)) (ros::ros-warn "service: ~A~%" i)) | ||
(test-once "/roseus_test/srv"))) | ||
|
||
(run-all-tests) | ||
(exit) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env roseus | ||
(require :unittest "lib/llib/unittest.l") | ||
(init-unit-test) | ||
|
||
(ros::roseus "test_memory_subscriber") | ||
(ros::rate 200) | ||
|
||
(defclass my-sub :slots (msg)) | ||
(defmethod my-sub | ||
(:update (_msg) (setq msg _msg)) | ||
(:get () msg)) | ||
|
||
(defun test-once (topic msgtype) | ||
(let ((sub (instance my-sub))) | ||
(ros::subscribe topic msgtype #'send sub :update) | ||
(while (not (send sub :get)) | ||
(ros::spin-once) | ||
(ros::sleep)) | ||
(send sub :get))) | ||
|
||
(deftest test-subscriber () | ||
(dotimes (i 5000) | ||
(if (zerop (mod i 100)) (ros::ros-warn "subscriber: ~A" i)) | ||
(test-once "/roseus_test/msg" std_msgs::String))) | ||
|
||
(run-all-tests) | ||
(exit) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env roseus | ||
(require :unittest "lib/llib/unittest.l") | ||
(init-unit-test) | ||
|
||
(ros::roseus "test_memory_timer") | ||
(ros::rate 200) | ||
|
||
(defclass my-cb :slots (done)) | ||
(defmethod my-cb | ||
(:update (event) (setq done t)) | ||
(:get () done)) | ||
|
||
(defun test-once () | ||
(let ((tm (instance my-cb))) | ||
(ros::create-timer 0.001 #'send tm :update :oneshot t) | ||
(while (not (send tm :get)) | ||
(ros::spin-once) | ||
(ros::sleep)))) | ||
|
||
(deftest test-timer () | ||
(dotimes (i 3000) | ||
(if (zerop (mod i 100)) (ros::ros-warn "timer: ~A~%" i)) | ||
(test-once))) | ||
|
||
(run-all-tests) | ||
(exit) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<launch> | ||
<node name="publisher" pkg="rostopic" type="rostopic" | ||
args='pub /roseus_test/msg std_msgs/String "Hello" -r 100' /> | ||
<test test-name="roseus_subscriber" pkg="roseus" type="roseus" args="$(find roseus)/test/test-memory-subscriber.l" | ||
time-limit="600" /> | ||
<test test-name="roseus_service" pkg="roseus" type="roseus" args="$(find roseus)/test/test-memory-service.l" | ||
time-limit="600" /> | ||
<test test-name="roseus_timer" pkg="roseus" type="roseus" args="$(find roseus)/test/test-memory-timer.l" | ||
time-limit="600" /> | ||
</launch> | ||
|