klisp

an open source interpreter for the Kernel Programming Language.
git clone http://git.hanabi.in/repos/klisp.git
Log | Files | Refs | README

system.k (994B)


      1 ;; check.k & test-helpers.k should be loaded
      2 ;;
      3 ;; Tests of system features.
      4 ;;
      5 
      6 ;; (R7RS 3rd draft, section 6.7.4) get-current-second
      7 
      8 ($check-predicate (applicative? get-current-second))
      9 ($check-predicate (number? (get-current-second)))
     10 
     11 ;; TODO: Update before the year 2031....
     12 
     13 ($let ((T-2011-01-01 1293836400) (T-2031-01-01 1924988400))
     14   ($check-predicate (<? T-2011-01-01 (get-current-second)))
     15   ($check-predicate (>? T-2031-01-01 (get-current-second))))
     16 
     17 ;; (R7RS 3rd draft, section 6.7.4) get-current-jiffy get-jiffies-per-second
     18 
     19 ($check-predicate (applicative? get-current-jiffy get-jiffies-per-second))
     20 ($check-predicate (exact-integer? (get-current-jiffy) (get-jiffies-per-second)))
     21 ($check-predicate (positive? (get-current-jiffy) (get-jiffies-per-second)))
     22 
     23 ($let* ((jiffy1 (get-current-jiffy)) (jiffy2 (get-current-jiffy)))
     24   ($check-predicate (<=? jiffy1 jiffy2)))
     25 
     26 ($let* ((jps1 (get-jiffies-per-second)) (jps2 (get-jiffies-per-second)))
     27   ($check-predicate (=? jps1 jps2)))