--- srfi-19.test.~1.1.~ Sat Jun 16 16:11:39 2001 +++ srfi-19.test Mon Aug 20 22:34:10 2001 @@ -80,6 +80,14 @@ (let ((time (make-time ,a 12345 67890123))) (time=? time (,b->a-sym (,a->b-sym time))))))) +(define (test-time-comparison cmp a b) + (pass-if (format #f "~A works" cmp) + (cmp a b))) + +(define (test-time-arithmetic op a b res) + (pass-if (format #f "~A works" op) + (time=? (op a b) res))) + (with-test-prefix "SRFI date/time library" ;; check for typos and silly errors (pass-if "date-zone-offset is defined" @@ -126,7 +134,23 @@ (with-tz "CET" (string->date "address@hidden:00" "address@hidden:~M"))) (date->time-utc - (make-date 0 0 0 12 1 6 2001 0))))) + (make-date 0 0 0 12 1 6 2001 0)))) + ;; check time comparison procedures + (let* ((time1 (make-time time-monotonic 0 0)) + (time2 (make-time time-monotonic 0 0)) + (time3 (make-time time-monotonic 385907 998360432)) + (time4 (make-time time-monotonic 385907 998360432))) + (test-time-comparison time<=? time1 time3) + (test-time-comparison time=? time3 time3) + (test-time-comparison time>? time3 time2)) + ;; check time arithmetic procedures + (let* ((time1 (make-time time-monotonic 0 0)) + (time2 (make-time time-monotonic 385907 998360432)) + (diff (time-difference time2 time1))) + (test-time-arithmetic add-duration time1 diff time2) + (test-time-arithmetic subtract-duration time2 diff time1))) ;; Local Variables: ;; eval: (put 'with-tz 'scheme-indent-function 1)