Skip to content

Commit

Permalink
add before/after-hook-func in test
Browse files Browse the repository at this point in the history
  • Loading branch information
knorth55 committed Oct 20, 2022
1 parent 32901f6 commit e4355a9
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions roseus_smach/test/test-samples.l
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,26 @@
(run-test-smach exec-smach-simple-nested :outcome5 '(nil (FOO) (BAR) (FOO) (BAR) (FOO) (BAR) nil (BAS) nil))

(run-test-smach exec-smach-userdata :outcome4 '((FOO) (BAR) (FOO) (BAR) (FOO)))
(run-test-smach exec-smach-userdata-hook :outcome4 '((FOO) (BAR) (FOO) (BAR) (FOO)))

(deftest test-smach-sample-userdata ()
; (assert (eq (send (exec-smach-userdata) :name) :outcome4)
; "sample of smach with userdata")
(assert (eq (send (exec-state-machine (smach-userdata)) :name) :outcome4)
"exec (smach-userdata) without initial userdata"))

(deftest test-smach-sample-userdata-hook ()
(let ((mydata '((count . 1))))
(exec-state-machine
(smach-userdata) mydata
:before-hook-func
#'(lambda (userdata) (incf (cdr (assoc 'count userdata))))
:after-hook-func
#'(lambda (userdata) (incf (cdr (assoc 'count userdata))))
)
(assert (eq (cdr (assoc 'count mydata)) 8)
"exec (smach-userdata) with hook failed")))

(run-test-smach exec-sample-parallel-state-machine :success '((PRESS-BUTTON) (CLOSE-DOOR) (PUT-SOAP PUT-CLOTH) (OPEN-DOOR)))

(deftest test-smach-action-client-state ()
Expand Down

0 comments on commit e4355a9

Please sign in to comment.