(use-modules (tests) (fibers) (unit-test) (knots parallelism)) ;; Test fibers-map (run-fibers-for-tests (lambda () (assert-equal 1122 (apply + (fibers-map (lambda (i) (* 2 i)) (iota 34)))))) ;; Test fibers-batch-map with a large batch size (run-fibers-for-tests (lambda () (assert-equal 1122 (apply + (fibers-batch-map (lambda (i) (* 2 i)) 100 (iota 34)))))) ;; Test fibers-map with vectors (run-fibers-for-tests (lambda () (assert-equal 1122 (apply + (vector->list (fibers-map (lambda (i) (* 2 i)) (list->vector (iota 34)))))))) ;; Test fibers-for-each (run-fibers-for-tests (lambda () (fibers-for-each (lambda (i) (* 2 i)) (iota 34)))) (display "parallelism test finished successfully\n")