Commit 85fee792 authored by pfdietz's avatar pfdietz

Initial checkin of tests for FLOAT, FLOATP

parent 46fc4961
;-*- Mode: Lisp -*-
;;;; Author: Paul Dietz
;;;; Created: Thu Sep 11 21:53:51 2003
;;;; Contains: Tests of FLOAT
(in-package :cl-test)
(deftest float.error.1
(classify-error (float))
program-error)
(deftest float.error.2
(classify-error (float 0 0.0 nil))
program-error)
;;;
(deftest float.1
(notnot (member (float 0) '(0.0f0 -0.0f0)))
t)
(deftest float.2
(float 1)
1.0f0)
(deftest float.3
(float -1)
-1.0f0)
(deftest float.4
(loop for i from -1000 to 1000
always
(loop for x in '(0.0s0 0.0f0 0.0d0 0.0l0)
for tp in '(short-float single-float double-float long-float)
for y = (float i x)
always (and (= i y) (typep y tp))))
t)
(deftest float.5
(loop for x in *reals*
always (or (not (floatp x))
(eql (float x) x)))
t)
(deftest float.6
(loop for x in *reals*
unless (or (not (typep x 'short-float))
(let ((y (float x 0.0f0)))
(and (typep y 'single-float)
(= x y))))
collect x)
nil)
(deftest float.7
(loop for x in *reals*
unless (or (not (typep x 'short-float))
(let ((y (float x 0.0d0)))
(and (typep y 'double-float)
(= x y))))
collect x)
nil)
(deftest float.8
(loop for x in *reals*
unless (or (not (typep x 'short-float))
(let ((y (float x 0.0l0)))
(and (typep y 'long-float)
(= x y))))
collect x)
nil)
(deftest float.9
(loop for x in *reals*
unless (or (not (typep x 'single-float))
(let ((y (float x 0.0d0)))
(and (typep y 'double-float)
(= x y))))
collect x)
nil)
(deftest float.10
(loop for x in *reals*
unless (or (not (typep x 'single-float))
(let ((y (float x 0.0l0)))
(and (typep y 'long-float)
(= x y))))
collect x)
nil)
(deftest float.11
(loop for x in *reals*
unless (or (not (typep x 'double-float))
(let ((y (float x 0.0l0)))
(and (typep y 'long-float)
(= x y))))
collect x)
nil)
;-*- Mode: Lisp -*-
;;;; Author: Paul Dietz
;;;; Created: Thu Sep 11 23:07:33 2003
;;;; Contains: Tests of FLOATP
(in-package :cl-test)
(deftest floatp.error.1
(classify-error (floatp))
program-error)
(deftest floatp.error.2
(classify-error (floatp 1.0 nil))
program-error)
(deftest floatp.1
(notnot-mv (floatp 1.0))
t)
(deftest floatp.2
(floatp nil)
nil)
(deftest floatp.3
(loop for x in *universe*
for vals = (multiple-value-list (floatp x))
unless (and (= (length vals) 1)
(if (car vals)
(typep x 'float)
(not (typep x 'float))))
collect x)
nil)
......@@ -82,6 +82,9 @@
(load "ldb.lsp")
(load "mask-field.lsp")
(load "float.lsp")
(load "floatp.lsp")
(load "rational.lsp")
(load "rationalize.lsp")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment