1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-07 18:30:25 +02:00

And still more of

(exp, log, log10, sqrt): New tests.
This commit is contained in:
Kevin Ryde 2006-09-23 01:08:57 +00:00
parent d9849f45cf
commit 10a7fe4c1a

View file

@ -88,7 +88,7 @@
;; return true if OBJ is negative infinity ;; return true if OBJ is negative infinity
(define (negative-infinity? obj) (define (negative-infinity? obj)
(and (number? obj) (and (real? obj)
(negative? obj) (negative? obj)
(inf? obj))) (inf? obj)))
@ -231,6 +231,9 @@
;;; ;;;
(with-test-prefix "exp" (with-test-prefix "exp"
(pass-if "documented?"
(documented? exp))
(pass-if-exception "no args" exception:wrong-num-args (pass-if-exception "no args" exception:wrong-num-args
(exp)) (exp))
(pass-if-exception "two args" exception:wrong-num-args (pass-if-exception "two args" exception:wrong-num-args
@ -2988,12 +2991,16 @@
;;; ;;;
(with-test-prefix "log" (with-test-prefix "log"
(pass-if "documented?"
(documented? log))
(pass-if-exception "no args" exception:wrong-num-args (pass-if-exception "no args" exception:wrong-num-args
(log)) (log))
(pass-if-exception "two args" exception:wrong-num-args (pass-if-exception "two args" exception:wrong-num-args
(log 123 456)) (log 123 456))
(pass-if (negative-infinity? (log 0))) (pass-if (negative-infinity? (log 0)))
(pass-if (negative-infinity? (log 0.0)))
(pass-if (eqv? 0.0 (log 1))) (pass-if (eqv? 0.0 (log 1)))
(pass-if (eqv? 0.0 (log 1.0))) (pass-if (eqv? 0.0 (log 1.0)))
(pass-if (eqv-loosely? 1.0 (log const-e))) (pass-if (eqv-loosely? 1.0 (log const-e)))
@ -3001,19 +3008,27 @@
(pass-if (eqv-loosely? -1.0 (log const-1/e))) (pass-if (eqv-loosely? -1.0 (log const-1/e)))
(pass-if (eqv-loosely? 1.0+1.57079i (log 0+2.71828i))) (pass-if (eqv-loosely? 1.0+1.57079i (log 0+2.71828i)))
(pass-if (eqv-loosely? 1.0-1.57079i (log 0-2.71828i)))) (pass-if (eqv-loosely? 1.0-1.57079i (log 0-2.71828i)))
(pass-if (eqv-loosely? 0.0+3.14159i (log -1.0)))
(pass-if (eqv-loosely? 1.0+3.14159i (log -2.71828)))
(pass-if (eqv-loosely? 2.0+3.14159i (log (* -2.71828 2.71828)))))
;;; ;;;
;;; log10 ;;; log10
;;; ;;;
(with-test-prefix "log10" (with-test-prefix "log10"
(pass-if "documented?"
(documented? log10))
(pass-if-exception "no args" exception:wrong-num-args (pass-if-exception "no args" exception:wrong-num-args
(log10)) (log10))
(pass-if-exception "two args" exception:wrong-num-args (pass-if-exception "two args" exception:wrong-num-args
(log10 123 456)) (log10 123 456))
(pass-if (negative-infinity? (log10 0))) (pass-if (negative-infinity? (log10 0)))
(pass-if (negative-infinity? (log10 0.0)))
(pass-if (eqv? 0.0 (log10 1))) (pass-if (eqv? 0.0 (log10 1)))
(pass-if (eqv? 0.0 (log10 1.0))) (pass-if (eqv? 0.0 (log10 1.0)))
(pass-if (eqv-loosely? 1.0 (log10 10.0))) (pass-if (eqv-loosely? 1.0 (log10 10.0)))
@ -3021,7 +3036,11 @@
(pass-if (eqv-loosely? -1.0 (log10 0.1))) (pass-if (eqv-loosely? -1.0 (log10 0.1)))
(pass-if (eqv-loosely? 1.0+0.68218i (log10 0+10.0i))) (pass-if (eqv-loosely? 1.0+0.68218i (log10 0+10.0i)))
(pass-if (eqv-loosely? 1.0-0.68218i (log10 0-10.0i)))) (pass-if (eqv-loosely? 1.0-0.68218i (log10 0-10.0i)))
(pass-if (eqv-loosely? 0.0+1.36437i (log10 -1)))
(pass-if (eqv-loosely? 1.0+1.36437i (log10 -10)))
(pass-if (eqv-loosely? 2.0+1.36437i (log10 -100))))
;;; ;;;
;;; logbit? ;;; logbit?
@ -3134,6 +3153,9 @@
;;; ;;;
(with-test-prefix "sqrt" (with-test-prefix "sqrt"
(pass-if "documented?"
(documented? sqrt))
(pass-if-exception "no args" exception:wrong-num-args (pass-if-exception "no args" exception:wrong-num-args
(sqrt)) (sqrt))
(pass-if-exception "two args" exception:wrong-num-args (pass-if-exception "two args" exception:wrong-num-args