;;;; srfi-174-test.scm -*- Scheme -*- ;;;; Kon Lovett, Aug '23 ;;;; ;;;; (from SRFI 174 sample implementation srfi-174-chibi-tests.scm) (import (scheme base)) (import test) (import (srfi 174)) (define ts1 (timespec 1 2)) (define ts2 (timespec 1 2)) (define ts3 (timespec 1 3)) (define ts4 (timespec 2 2)) (define ts-neg1 (timespec -1 2)) (define ts-neg2 (timespec -1 5)) (define ts-neg3 (timespec -2 0)) (test-group "srfi-174" (test-assert "timespec?" (timespec? ts1)) (test-assert "not timespec?" (not (timespec? #f))) (test "seconds" 1 (timespec-seconds ts1)) (test "nanos" 2 (timespec-nanoseconds ts1)) (test-assert "equal" (timespec=? ts1 ts2)) (test-assert "less nanos" (timespecinexact (timespec 1 #e1e8))) (let ((t (timespec 1 1)) (u (inexact->timespec #i1.000000001))) (test "from inexact" t u)) ) (test-exit)