23 lines
849 B
Racket
23 lines
849 B
Racket
#lang imperative-syndicate/test-implementation
|
|
|
|
(let ((N 25000))
|
|
(test-case
|
|
;; Box-and-client speed test
|
|
[(message-struct set-box (new-value))
|
|
(assertion-struct box-state (value))
|
|
(spawn (field [current-value 0])
|
|
(assert (box-state (current-value)))
|
|
(stop-when-true (= (current-value) N))
|
|
(on (message (set-box $new-value))
|
|
(current-value new-value)))
|
|
(spawn (stop-when (retracted (observe (set-box _))))
|
|
(on (asserted (box-state $v))
|
|
(send! (set-box (+ v 1)))))]
|
|
no-crashes
|
|
(expected-output)
|
|
(it "should be reasonably quick"
|
|
(log-info "Rough box-and-client speed: ~a cycles in ~a ms = ~a Hz"
|
|
N
|
|
(test-run-time)
|
|
(/ N (/ (test-run-time) 1000.0))))))
|