Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Karsten Poeck
ansi-test
Commits
686f9c63
Commit
686f9c63
authored
Sep 07, 2003
by
pfdietz
Browse files
More tests for PHASE, initial checkin of tests for REALPART, IMAGPART.
parent
3c2e6b25
Changes
4
Hide whitespace changes
Inline
Side-by-side
ansi-tests/imagpart.lsp
0 → 100644
View file @
686f9c63
;-*- Mode: Lisp -*-
;;;; Author: Paul Dietz
;;;; Created: Sun Sep 7 07:47:43 2003
;;;; Contains: Tests of IMAGPART
(in-package :cl-test)
(deftest imagpart.error.1
(classify-error (imagpart))
program-error)
(deftest imagpart.error.2
(classify-error (imagpart #c(1.0 2.0) nil))
program-error)
(deftest imagpart.error.3
(loop for x in *mini-universe*
unless (or (numberp x)
(eq (eval `(classify-error (imagpart ',x))) 'type-error))
collect x)
nil)
(deftest imagpart.1
(loop for x in *reals*
for c = (complex 0 x)
for ip = (imagpart c)
unless (eql x ip)
collect (list x c ip))
nil)
(deftest imagpart.2
(loop for x in *reals*
for c = (complex 1 x)
for ip = (imagpart c)
unless (eql x ip)
collect (list x c ip))
nil)
(deftest imagpart.3
(loop for x in *reals*
for c = (complex x x)
for ip = (imagpart c)
unless (eql x ip)
collect (list x c ip))
nil)
(deftest imagpart.4
(loop for x in *reals*
for ip = (imagpart x)
unless (eql (* 0 x) ip)
collect (list x ip (* 0 x)))
nil)
ansi-tests/load-numbers.lsp
View file @
686f9c63
...
@@ -48,6 +48,8 @@
...
@@ -48,6 +48,8 @@
(load "complexp.lsp")
(load "complexp.lsp")
(load "conjugate.lsp")
(load "conjugate.lsp")
(load "phase.lsp")
(load "phase.lsp")
(load "realpart.lsp")
(load "imagpart.lsp")
(load "rational.lsp")
(load "rational.lsp")
(load "rationalize.lsp")
(load "rationalize.lsp")
...
...
ansi-tests/phase.lsp
View file @
686f9c63
...
@@ -99,3 +99,24 @@
...
@@ -99,3 +99,24 @@
(let ((p (phase #c(1.0l0 1.0l0))))
(let ((p (phase #c(1.0l0 1.0l0))))
(approx= p (/ pi 4)))
(approx= p (/ pi 4)))
t)
t)
;;; Negative zeros
(deftest phase.18
(or (eqlt -0.0s0 0.0s0)
(approx= (phase #c(-1.0 -0.0)) (coerce (- pi) 'short-float)))
t)
(deftest phase.19
(or (eqlt -0.0f0 0.0f0)
(approx= (phase #c(-1.0 -0.0)) (coerce (- pi) 'single-float)))
t)
(deftest phase.20
(or (eqlt -0.0d0 0.0d0)
(approx= (phase #c(-1.0 -0.0)) (coerce (- pi) 'double-float)))
t)
(deftest phase.21
(or (eqlt -0.0l0 0.0l0)
(approx= (phase #c(-1.0 -0.0)) (coerce (- pi) 'long-float)))
t)
ansi-tests/realpart.lsp
0 → 100644
View file @
686f9c63
;-*- Mode: Lisp -*-
;;;; Author: Paul Dietz
;;;; Created: Sun Sep 7 07:41:15 2003
;;;; Contains: Tests of REALPART
(in-package :cl-test)
(deftest realpart.error.1
(classify-error (realpart))
program-error)
(deftest realpart.error.2
(classify-error (realpart #c(1.0 2.0) nil))
program-error)
(deftest realpart.error.3
(loop for x in *mini-universe*
unless (or (numberp x)
(eq (eval `(classify-error (realpart ',x))) 'type-error))
collect x)
nil)
(deftest realpart.1
(loop for x in *reals*
for c = (complex x 0)
for rp = (realpart c)
unless (eql x rp)
collect (list x c rp))
nil)
(deftest realpart.2
(loop for x in *reals*
for c = (complex x 1)
for rp = (realpart c)
unless (eql x rp)
collect (list x c rp))
nil)
(deftest realpart.3
(loop for x in *reals*
for c = (complex x x)
for rp = (realpart c)
unless (eql x rp)
collect (list x c rp))
nil)
;;; Should move this to complex.lsp
(deftest realpart.4
(loop for c in *complexes*
for rp = (realpart c)
for ip = (imagpart c)
for c2 = (complex rp ip)
unless (eql c c2)
collect (list c rp ip c2))
nil)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment