Fix a bug in fibers-batch-map (and related procedures)

And add more tests.
This commit is contained in:
Christopher Baines 2024-12-27 22:14:51 +00:00
parent e8ab6f23d8
commit 4e791aff68
2 changed files with 21 additions and 1 deletions

View file

@ -79,7 +79,10 @@
(define result-vec (define result-vec
(make-vector vecs-length)) (make-vector vecs-length))
(let loop ((next-to-process-index 0) (let loop ((next-to-process-index
(if (= 0 vecs-length)
#f
0))
(channel-indexes '())) (channel-indexes '()))
(if (and (eq? #f next-to-process-index) (if (and (eq? #f next-to-process-index)
(null? channel-indexes)) (null? channel-indexes))

View file

@ -24,6 +24,16 @@
100 100
(iota 34)))))) (iota 34))))))
;; Test fibers-map with an empty list
(run-fibers-for-tests
(lambda ()
(fibers-map identity '())))
;; Test fibers-map with an empty vector
(run-fibers-for-tests
(lambda ()
(fibers-map identity #())))
;; Test fibers-map with vectors ;; Test fibers-map with vectors
(run-fibers-for-tests (run-fibers-for-tests
(lambda () (lambda ()
@ -43,4 +53,11 @@
(* 2 i)) (* 2 i))
(iota 34)))) (iota 34))))
;; Test fibers-map-with-progress with an empty list
(run-fibers-for-tests
(lambda ()
(fibers-map-with-progress
identity
'(()))))
(display "parallelism test finished successfully\n") (display "parallelism test finished successfully\n")