2020-03-01 19:05:28 +01:00
|
|
|
#lang typed/racket
|
|
|
|
|
|
|
|
;;; Tests for dds/rs.
|
|
|
|
|
|
|
|
(require typed/rackunit "rs.rkt")
|
|
|
|
|
|
|
|
(test-case "Basic definitions"
|
2020-03-01 19:20:24 +01:00
|
|
|
(let* ([r1 (reaction (set 'x) (set 'y) (set 'z))]
|
|
|
|
[r2 (reaction (set 'x) (set) (set 'y))]
|
|
|
|
[rs (make-immutable-hash (list (cons 'a r1) (cons 'b r2)))]
|
|
|
|
[s1 (set 'x 'z)]
|
|
|
|
[s2 (set 'x 'y)])
|
|
|
|
(check-true (enabled? r1 s1))
|
|
|
|
(check-false (enabled? r1 s2))
|
|
|
|
(check-equal? (list-enabled rs s1) '(a b))
|
|
|
|
(check-equal? (list-enabled rs s2) '(b))))
|