mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 05:39:18 +02:00
By convention, a library meant for testing exports "run-tests". Also by convention, assume the test for (foo bar) is (foo bar-test), keeping the test in the same directory and avoiding confusion since (chibi test) is not a test for (chibi). - Avoids the hack of "load"ing test, with resulting namespace complications. - Allows keeping tests together with the libraries. - Allows setting up test hooks before running. - Allows implicit inference of test locations when using above conventions.
25 lines
1.2 KiB
Scheme
25 lines
1.2 KiB
Scheme
(define-library (chibi process-test)
|
|
(export run-tests)
|
|
(import (chibi) (chibi process) (only (chibi test) test-begin test test-end))
|
|
(begin
|
|
(define (run-tests)
|
|
(test-begin "processes")
|
|
(test #t (process-running? (current-process-id)))
|
|
(test #t (process-running? (parent-process-id)))
|
|
(test #f (signal-set-contains? (current-signal-mask) signal/alarm))
|
|
(test #t (signal-set? (make-signal-set)))
|
|
(test #t (signal-set? (current-signal-mask)))
|
|
(test #f (signal-set? #f))
|
|
(test #f (signal-set? '(#f)))
|
|
(test #f (signal-set-contains? (make-signal-set) signal/interrupt))
|
|
(test #t (let ((sset (make-signal-set)))
|
|
(signal-set-fill! sset)
|
|
(signal-set-contains? sset signal/interrupt)))
|
|
(test #t (let ((sset (make-signal-set)))
|
|
(signal-set-add! sset signal/interrupt)
|
|
(signal-set-contains? sset signal/interrupt)))
|
|
(test #f (let ((sset (make-signal-set)))
|
|
(signal-set-fill! sset)
|
|
(signal-set-delete! sset signal/interrupt)
|
|
(signal-set-contains? sset signal/interrupt)))
|
|
(test-end))))
|