conjugate.lsp 1.46 KB
Newer Older
1 2 3 4 5 6 7
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Sat Sep  6 21:07:36 2003
;;;; Contains: Tests of CONJUGATE

(in-package :cl-test)

8 9
;;; Error tests

10
(deftest conjugate.error.1
11 12
  (signals-error (conjugate) program-error)
  t)
13 14

(deftest conjugate.error.2
15 16 17 18
  (signals-error (conjugate 0 0) program-error)
  t)

;;; Non-error tests
19 20 21

(deftest conjugate.1
  (loop for x in *reals*
sds's avatar
sds committed
22 23 24 25
        for vals = (multiple-value-list (conjugate x))
        for xc = (car vals)
        always (and (= (length vals) 1)
                    (eql x xc)))
26 27 28 29
  t)

(deftest conjugate.2
  (loop for x in *complexes*
sds's avatar
sds committed
30 31 32 33 34
        for vals = (multiple-value-list (conjugate x))
        for xc = (car vals)
        always (and (= (length vals) 1)
                    (eql (realpart x) (realpart xc))
                    (eql (- (imagpart x)) (imagpart xc))))
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
  t)

(deftest conjugate.3
  (eqlt (conjugate #c(0.0s0 0.0s0)) #c(0.0s0 -0.0s0))
  t)

(deftest conjugate.4
  (eqlt (conjugate #c(1.0s0 0.0s0)) #c(1.0s0 -0.0s0))
  t)

(deftest conjugate.5
  (eqlt (conjugate #c(0.0f0 0.0f0)) #c(0.0f0 -0.0f0))
  t)

(deftest conjugate.6
  (eqlt (conjugate #c(1.0f0 0.0f0)) #c(1.0f0 -0.0f0))
  t)

(deftest conjugate.7
  (eqlt (conjugate #c(0.0d0 0.0d0)) #c(0.0d0 -0.0d0))
  t)

(deftest conjugate.8
  (eqlt (conjugate #c(1.0d0 0.0d0)) #c(1.0d0 -0.0d0))
  t)

(deftest conjugate.9
  (eqlt (conjugate #c(0.0l0 0.0l0)) #c(0.0l0 -0.0l0))
  t)

(deftest conjugate.10
  (eqlt (conjugate #c(1.0l0 0.0l0)) #c(1.0l0 -0.0l0))
  t)