Update testing code
This commit is contained in:
parent
3b98769e8d
commit
fe88c1cbb6
|
@ -6,11 +6,16 @@
|
|||
|
||||
(provide check-message-handler)
|
||||
|
||||
(define (flatten-transition t)
|
||||
(if (transition? t)
|
||||
(transition (transition-state t) (transition-actions t)) ;; autoflattens
|
||||
(transition t '()))) ;; wrap for convenient comparison
|
||||
|
||||
(define (check-message-handler mh initial-w message final-w expected-actions)
|
||||
(match-define (on-message pattern handler) mh)
|
||||
(check-true (pattern message) "Message-handler pattern did not match message provided")
|
||||
(define v (match (handler message initial-w)
|
||||
[(? transition? t) t]
|
||||
[new-w (transition new-w '())]))
|
||||
(check-equal? v (transition final-w expected-actions)
|
||||
(check-equal? (flatten-transition v) (transition final-w expected-actions)
|
||||
"Produced world-and-actions did not match expected world-and-actions"))
|
||||
|
|
Loading…
Reference in New Issue