rationalp.lsp 938 Bytes
Newer Older
1 2 3 4 5 6 7 8
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Sun Sep  7 08:36:31 2003
;;;; Contains: Tests of RATIONALP

(in-package :cl-test)

(deftest rationalp.error.1
9 10
  (signals-error (rationalp) program-error)
  t)
11 12

(deftest rationalp.error.2
13 14
  (signals-error (rationalp 0 nil) program-error)
  t)
15 16

(deftest rationalp.error.3
17 18
  (signals-error (rationalp 'a 0) program-error)
  t)
19 20 21

(deftest rationalp.1
  (loop for x in *rationals*
sds's avatar
sds committed
22 23 24 25
        for vals = (multiple-value-list (rationalp x))
        unless (and (= (length vals) 1)
                    (first vals))
        collect (cons x vals))
26 27 28 29
  nil)

(deftest rationalp.2
  (loop for x in (set-difference *universe* *rationals*)
sds's avatar
sds committed
30 31 32 33
        for vals = (multiple-value-list (rationalp x))
        unless (and (= (length vals) 1)
                    (null (first vals)))
        collect (cons x vals))
34 35 36
  nil)

(deftest rationalp.3
37
  (check-type-predicate #'rationalp 'rational)
38 39 40
  nil)