Skip to content

Commit

Permalink
[pr2eus/test/robot-init-test.*, pr2eus/CMakeLists.txt] Add robot-init…
Browse files Browse the repository at this point in the history
… function rostest. Add rostest execution for it in CMakeLists.txt.
  • Loading branch information
snozawa committed Apr 26, 2016
1 parent b40ee3b commit 1df781c
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions pr2eus/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ if(CATKIN_ENABLE_TESTING)
add_rostest(test/robot-no-clock.test)
add_rostest(test/default-ri-test.test)
add_rostest(test/speak-test.test)
add_rostest(test/robot-init-test.test)
endif()

generate_eusdoc(robot-interface.l)
Expand Down
34 changes: 34 additions & 0 deletions pr2eus/test/robot-init-test.l
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/env roseus

;; robot-init test

(require :unittest "lib/llib/unittest.l")

(load "package://pr2eus/robot-interface.l")
(ros::roseus "test_robot_init")

(init-unit-test)

;;(deftest test-robot-init-without-param-and-argument ()
;; (assert (not (robot-init)) "This should invoke error."))

(deftest test-robot-init-with-argument ()
(assert (progn
(robot-init "pr2")
(and *ri* *pr2*))
"This should return pr2 and ri.")
)

(deftest test-robot-init-without-argument-with-param ()
(makunbound '*ri*)
(makunbound '*pr2*)
(ros::set-param "/robot/type" "pr2")
(assert (progn
(robot-init)
(and *ri* *pr2*))
"This should return pr2 and ri.")
)

(run-all-tests)
(exit)

4 changes: 4 additions & 0 deletions pr2eus/test/robot-init-test.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<launch>
<test test-name="robot_init_test_node" pkg="roseus" type="roseus"
args="$(find pr2eus)/test/robot-init-test.l" time-limit="600" />
</launch>

0 comments on commit 1df781c

Please sign in to comment.