chibi-scheme/lib/chibi/process-test.sld
Alex Shinn 4e5cdedc03 Converting tests to modules instead of separate programs.
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.
2015-04-05 23:38:51 +09:00

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))))