Add second, non-dataspace, test case to illustrate correct behaviour
This commit is contained in:
parent
852eff8d0b
commit
fa3505e3a6
|
@ -16,6 +16,20 @@
|
||||||
|
|
||||||
(assertion-struct researcher (name topic))
|
(assertion-struct researcher (name topic))
|
||||||
|
|
||||||
|
(define no-mention-of-discard
|
||||||
|
(lambda ()
|
||||||
|
(not (memf (lambda (line) (string-contains? line "#s(discard)"))
|
||||||
|
(collected-lines)))))
|
||||||
|
|
||||||
|
(define-syntax-rule (correct-topics-and-researchers)
|
||||||
|
(expected-output-set "Added researcher: Alice"
|
||||||
|
"Added researcher: Eve"
|
||||||
|
"Added researcher: Tony"
|
||||||
|
"Added topic: Bicycling"
|
||||||
|
"Added topic: Computering"
|
||||||
|
"Added topic: Cryptography"
|
||||||
|
"Added topic: Evil"))
|
||||||
|
|
||||||
(test-case
|
(test-case
|
||||||
[(spawn #:name 'tony
|
[(spawn #:name 'tony
|
||||||
(assert (researcher "Tony" "Computering"))
|
(assert (researcher "Tony" "Computering"))
|
||||||
|
@ -38,8 +52,31 @@
|
||||||
(on-start (printf "Added researcher: ~a\n" name))
|
(on-start (printf "Added researcher: ~a\n" name))
|
||||||
(on-stop (printf "Removed researcher: ~a\n" name)))))]
|
(on-stop (printf "Removed researcher: ~a\n" name)))))]
|
||||||
no-crashes
|
no-crashes
|
||||||
(procedure-rename
|
no-mention-of-discard
|
||||||
(lambda ()
|
(correct-topics-and-researchers))
|
||||||
(not (memf (lambda (line) (string-contains? line "#s(discard)"))
|
|
||||||
(collected-lines))))
|
(test-case
|
||||||
'no-mention-of-discard))
|
;; This one is just like the one above, but doesn't have the
|
||||||
|
;; nested dataspace, so the right answers are given.
|
||||||
|
[(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")))
|
||||||
|
|
||||||
|
(spawn #:name 'all-topics
|
||||||
|
(during (researcher _ $topic)
|
||||||
|
(on-start (printf "Added topic: ~a\n" topic))
|
||||||
|
(on-stop (printf "Removed topic: ~a\n" topic))))
|
||||||
|
(spawn #:name 'all-researchers
|
||||||
|
(during (researcher $name _)
|
||||||
|
(on-start (printf "Added researcher: ~a\n" name))
|
||||||
|
(on-stop (printf "Removed researcher: ~a\n" name))))]
|
||||||
|
no-crashes
|
||||||
|
no-mention-of-discard
|
||||||
|
(correct-topics-and-researchers))
|
||||||
|
|
Loading…
Reference in New Issue