source: trunk/source/tests/ansi-tests/get-universal-time.lsp @ 8991

Last change on this file since 8991 was 8991, checked in by gz, 11 years ago

Check in the gcl ansi test suite (original, in preparation for making local changes)

File size: 1.5 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Sun May  8 19:25:41 2005
4;;;; Contains: Tests of GET-UNIVERSAL-TIME, GET-DECODED-TIME
5
6(in-package :cl-test)
7
8;;; Note -- this ignores the possibilty that the time cannot
9;;; be determined.
10
11(deftest get-universal-time.1
12  (notnot-mv (typep (get-universal-time) 'unsigned-byte))
13  t)
14
15(deftest get-universal-time.2
16  (let* ((time1 (get-universal-time))
17         (vals (multiple-value-list (get-decoded-time)))
18         (time2 (get-universal-time)))
19    (when (= time1 time2)
20      (let ((vals2 (multiple-value-list (decode-universal-time time1))))
21        (assert (= (length vals) 9))
22        (assert (= (length vals2) 9))
23        (assert (equal (subseq vals 0 7)
24                       (subseq vals2 0 7)))
25        (assert (if (elt vals 7) (elt vals2 7) (not (elt vals2 7))))
26        (assert (= (elt vals 8) (elt vals2 8)))))
27    (values)))
28
29(deftest get-universal-time.3
30  (let* ((first (get-universal-time))
31         (prev first))
32    (loop for time = (get-universal-time)
33          do (assert (>= time prev))
34          do (setf prev time)
35          until (>= time (+ 5 first))))
36  nil)
37
38;;; Error tests
39
40(deftest get-universal-time.error.1
41  (signals-error (get-universal-time nil) program-error)
42  t)
43
44(deftest get-universal-time.error.2
45  (signals-error (get-universal-time :allow-other-keys t) program-error)
46  t)
47
48(deftest get-decoded-time.error.1
49  (signals-error (get-decoded-time nil) program-error)
50  t)
51
52(deftest get-decoded-time.error.2
53  (signals-error (get-decoded-time :allow-other-keys t) program-error)
54  t)
55
56
57
58               
59
Note: See TracBrowser for help on using the repository browser.