source: trunk/source/tests/ansi-tests/zerop.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.9 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Mon Aug  4 21:47:34 2003
4;;;; Contains: Tests of ZEROP
5
6(in-package :cl-test)
7
8(deftest zerop.error.1
9  (signals-error (zerop) program-error)
10  t)
11
12(deftest zerop.error.2
13  (signals-error (zerop 0 1) program-error)
14  t)
15
16(deftest zerop.error.3
17  (signals-error (zerop 1 0) program-error)
18  t)
19
20(deftest zerop.error.4
21  (check-type-error #'zerop #'numberp)
22  nil)
23
24(deftest zerop.1
25  (loop for x in *numbers*
26        when (if (zerop x) (/= x 0) (= x 0))
27        collect x)
28  nil)
29
30(deftest zerop.2
31  (zerop 1)
32  nil)
33
34(deftest zerop.3
35  (zerop -1)
36  nil)
37
38(deftest zerop.4
39  (notnot-mv (zerop 0))
40  t)
41
42(deftest zerop.5
43  (notnot-mv (zerop 0.0s0))
44  t)
45
46(deftest zerop.6
47  (notnot-mv (zerop 0.0f0))
48  t)
49
50(deftest zerop.7
51  (notnot-mv (zerop 0.0d0))
52  t)
53
54(deftest zerop.7a
55  (notnot-mv (zerop 0.0l0))
56  t)
57
58(deftest zerop.8
59  (remove-if-not #'zerop
60                 (list least-negative-short-float
61                       least-negative-normalized-short-float
62                       least-negative-single-float
63                       least-negative-normalized-single-float
64                       least-negative-double-float
65                       least-negative-normalized-double-float
66                       least-negative-long-float
67                       least-negative-normalized-long-float
68                       most-negative-short-float
69                       most-negative-single-float
70                       most-negative-double-float
71                       most-negative-long-float))
72  nil)
73
74(deftest zerop.9
75  (remove-if-not #'zerop
76                 (list least-positive-short-float
77                       least-positive-normalized-short-float
78                       least-positive-single-float
79                       least-positive-normalized-single-float
80                       least-positive-double-float
81                       least-positive-normalized-double-float
82                       least-positive-long-float
83                       least-positive-normalized-long-float
84                       most-positive-short-float
85                       most-positive-single-float
86                       most-positive-double-float
87                       most-positive-long-float))
88  nil)
89
90(deftest zerop.10
91  (notevery #'zerop (list -0.0s0 -0.0f0 -0.0d0 -0.0l0))
92  nil)
93
Note: See TracBrowser for help on using the repository browser.