plusp.lsp 1.43 KB
Newer Older
pfdietz's avatar
pfdietz committed
1 2 3 4 5
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Mon Aug  4 21:42:14 2003
;;;; Contains: Tests for PLUSP

6

pfdietz's avatar
pfdietz committed
7

8 9
;;; Error tests

pfdietz's avatar
pfdietz committed
10
(deftest plusp.error.1
11 12
  (signals-error (plusp) program-error)
  t)
pfdietz's avatar
pfdietz committed
13 14

(deftest plusp.error.2
15 16
  (signals-error (plusp 0 0) program-error)
  t)
pfdietz's avatar
pfdietz committed
17 18

(deftest plusp.error.3
19 20
  (signals-error (plusp 0 nil) program-error)
  t)
pfdietz's avatar
pfdietz committed
21 22

(deftest plusp.error.4
pfdietz's avatar
pfdietz committed
23
  (check-type-error #'plusp #'realp)
pfdietz's avatar
pfdietz committed
24 25
  nil)

26 27
;;; Non-error tests

pfdietz's avatar
pfdietz committed
28 29 30 31 32 33 34 35 36 37 38 39 40 41
(deftest plusp.1
  (plusp 0)
  nil)

(deftest plusp.2
  (plusp -1)
  nil)

(deftest plusp.3
  (notnot-mv (plusp 1))
  t)

(deftest plusp.4
  (loop for x in *reals*
sds's avatar
sds committed
42 43
        when (if (plusp x) (<= x 0) (> x 0))
        collect x)
pfdietz's avatar
pfdietz committed
44 45 46 47 48 49 50 51 52 53 54 55
  nil)

(deftest plusp.5
  (some #'plusp '(-0.0s0 -0.0f0 -0.0d0 -0.0l0))
  nil)

(deftest plusp.6
  (some #'plusp '(0.0s0 0.0f0 0.0d0 0.0l0))
  nil)

(deftest plusp.7
  (remove-if #'plusp
sds's avatar
sds committed
56 57 58 59 60 61 62 63 64 65 66 67
             (list least-positive-short-float
                   least-positive-normalized-short-float
                   least-positive-single-float
                   least-positive-normalized-single-float
                   least-positive-double-float
                   least-positive-normalized-double-float
                   least-positive-long-float
                   least-positive-normalized-long-float
                   most-positive-short-float
                   most-positive-single-float
                   most-positive-double-float
                   most-positive-long-float))
pfdietz's avatar
pfdietz committed
68 69
  nil)