get-internal-time.lsp 1.69 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Sun May  8 20:28:21 2005
;;;; Contains: Tests of GET-INTERNAL-REAL-TIME, GET-INTERNAL-RUN-TIME

(in-package :cl-test)

(deftest get-internal-real-time.1
  (notnot-mv (typep (multiple-value-list (get-internal-real-time)) '(cons unsigned-byte null)))
  t)

(deftest get-internal-real-time.2
  (funcall
   (compile
    nil
    '(lambda ()
       (let ((prev (get-internal-real-time)))
sds's avatar
sds committed
18 19 20 21
         (loop for next = (get-internal-real-time)
               repeat 100000
               do (assert (>= next prev))
               do (setf prev next))))))
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
  nil)

(deftest get-internal-real-time.error.1
  (signals-error (get-internal-real-time nil) program-error)
  t)

(deftest get-internal-real-time.error.2
  (signals-error (get-internal-real-time :allow-other-keys t) program-error)
  t)

;;;;;

(deftest get-internal-run-time.1
  (notnot-mv (typep (multiple-value-list (get-internal-run-time)) '(cons unsigned-byte null)))
  t)

(deftest get-internal-run-time.2
  (funcall
   (compile
    nil
    '(lambda ()
       (let ((prev (get-internal-run-time)))
sds's avatar
sds committed
44 45 46 47
         (loop for next = (get-internal-run-time)
               repeat 100000
               do (assert (>= next prev))
               do (setf prev next))))))
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
  nil)

(deftest get-internal-run-time.error.1
  (signals-error (get-internal-run-time nil) program-error)
  t)

(deftest get-internal-run-time.error.2
  (signals-error (get-internal-run-time :allow-other-keys t) program-error)
  t)

;;;

(deftest internal-time-units-per-second.1
  (notnot-mv (constantp 'internal-time-units-per-second))
  t)

(deftest internal-time-units-per-second.2
  (notnot-mv (typep internal-time-units-per-second '(integer 1)))
  t)