Box-and-client speed test

This commit is contained in:
Tony Garnock-Jones 2018-04-27 23:59:04 +01:00
parent 290170f450
commit 3a857db4b9
1 changed files with 20 additions and 0 deletions

View File

@ -931,4 +931,24 @@
"box: terminating"
"client: box has gone"))
(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))))))
)