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

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

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

File size: 1.8 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Sun Dec 12 09:43:47 2004
4;;;; Contains: Tests of TIME
5
6(in-package :cl-test)
7
8(deftest time.1
9  (let ((s (with-output-to-string
10             (*trace-output*)
11             (assert (null (time nil))))))
12    (= (length s) 0))
13  nil)
14
15(deftest time.2
16  (let ((s (with-output-to-string
17             (*trace-output*)
18             (let ((x (cons 'a 'b)))
19               (assert (eq (time x) x))))))
20    (= (length s) 0))
21  nil)
22
23(deftest time.3
24  (let ((s (with-output-to-string
25             (*trace-output*)
26             (let ((x (cons 'a 'b)))
27               (flet ((%f () x))
28                 (assert (eq (time (%f)) x)))))))
29    (= (length s) 0))
30  nil)
31
32(deftest time.4
33  (let ((s (with-output-to-string
34             (*trace-output*)
35             (assert (null (multiple-value-list (time (values))))))))
36    (= (length s) 0))
37  nil)
38
39(deftest time.5
40  (let ((s (with-output-to-string
41             (*trace-output*)
42             (assert (equal '(a b c d)
43                            (multiple-value-list (time (values 'a 'b 'c 'd))))))))
44    (= (length s) 0))
45  nil)
46
47(deftest time.6
48  (let ((fn (compile nil '(lambda () (time nil)))))
49    (let ((s (with-output-to-string
50               (*trace-output*)
51               (assert (null (funcall fn))))))
52      (= (length s) 0)))
53  nil)
54
55(deftest time.7
56  (flet ((%f () (time nil)))
57    (let ((s (with-output-to-string
58               (*trace-output*)
59               (assert (null (%f))))))
60      (= (length s) 0)))
61  nil)
62
63(deftest time.8
64  (let ((s (with-output-to-string
65             (*trace-output*)
66             (macrolet ((%m () 1))
67               (assert (eql (time (%m)) 1))))))
68    (= (length s) 0))
69  nil)
70
71;;; The TIME definition is weasely, so strenuous complaints from
72;;; implementors about specific tests lead me to remove them.
73;;; Someone didn't like this one at all.
74#|
75(deftest time.9
76  (let ((s (with-output-to-string
77             (*trace-output*)
78             (block done
79               (time (return-from done nil))))))
80    (= (length s) 0))
81  nil)
82|#
83
84 
Note: See TracBrowser for help on using the repository browser.