New (failing) test case re: the approach to relaying

This commit is contained in:
Tony Garnock-Jones 2018-05-02 18:23:02 +01:00
parent bc5b28c403
commit 852eff8d0b
1 changed files with 45 additions and 0 deletions

View File

@ -0,0 +1,45 @@
#lang imperative-syndicate/test-implementation
;; Uhoh! The current (2018-05-02) scheme for relaying between
;; dataspaces instantiates each pattern when a matching assertion
;; appears and then relays the result on via an ordinary assertion.
;; However, this is probably wrong! If one inner observer monitors
;;
;; (inbound (x _ $y))
;;
;; while another monitors
;;
;; (inbound (x $z _))
;;
;; then the second one will see a literal `(discard)` for `z`!
(require racket/string)
(assertion-struct researcher (name topic))
(test-case
[(spawn #:name 'tony
(assert (researcher "Tony" "Computering"))
(assert (researcher "Tony" "Bicycling")))
(spawn #:name 'alice
(assert (researcher "Alice" "Cryptography"))
(assert (researcher "Alice" "Bicycling")))
(spawn #:name 'eve
(assert (researcher "Eve" "Cryptography"))
(assert (researcher "Eve" "Computering"))
(assert (researcher "Eve" "Evil")))
(dataspace #:name 'inner-dataspace
(spawn #:name 'all-topics
(during (inbound (researcher _ $topic))
(on-start (printf "Added topic: ~a\n" topic))
(on-stop (printf "Removed topic: ~a\n" topic))))
(spawn #:name 'all-researchers
(during (inbound (researcher $name _))
(on-start (printf "Added researcher: ~a\n" name))
(on-stop (printf "Removed researcher: ~a\n" name)))))]
no-crashes
(procedure-rename
(lambda ()
(not (memf (lambda (line) (string-contains? line "#s(discard)"))
(collected-lines))))
'no-mention-of-discard))