mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
* tests/numbers.test: Added more division by zero tests.
This commit is contained in:
parent
5eec27e9c5
commit
80074d7799
2 changed files with 67 additions and 1 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2001-11-22 Dirk Herrmann <D.Herrmann@tu-bs.de>
|
||||||
|
|
||||||
|
* tests/numbers.test: Added more division by zero tests.
|
||||||
|
|
||||||
2001-11-22 Dirk Herrmann <D.Herrmann@tu-bs.de>
|
2001-11-22 Dirk Herrmann <D.Herrmann@tu-bs.de>
|
||||||
|
|
||||||
* tests/numbers.test: Added division by zero tests.
|
* tests/numbers.test: Added division by zero tests.
|
||||||
|
|
|
@ -303,6 +303,16 @@
|
||||||
|
|
||||||
;; Are numerical overflows detected correctly?
|
;; Are numerical overflows detected correctly?
|
||||||
|
|
||||||
|
(with-test-prefix "division by zero"
|
||||||
|
|
||||||
|
(pass-if-exception "(quotient 1 0)"
|
||||||
|
exception:numerical-overflow
|
||||||
|
(quotient 1 0))
|
||||||
|
|
||||||
|
(pass-if-exception "(quotient bignum 0)"
|
||||||
|
exception:numerical-overflow
|
||||||
|
(quotient (+ fixnum-max 1) 0)))
|
||||||
|
|
||||||
;; Are wrong type arguments detected correctly?
|
;; Are wrong type arguments detected correctly?
|
||||||
|
|
||||||
)
|
)
|
||||||
|
@ -478,6 +488,16 @@
|
||||||
|
|
||||||
;; Are numerical overflows detected correctly?
|
;; Are numerical overflows detected correctly?
|
||||||
|
|
||||||
|
(with-test-prefix "division by zero"
|
||||||
|
|
||||||
|
(pass-if-exception "(remainder 1 0)"
|
||||||
|
exception:numerical-overflow
|
||||||
|
(remainder 1 0))
|
||||||
|
|
||||||
|
(pass-if-exception "(remainder bignum 0)"
|
||||||
|
exception:numerical-overflow
|
||||||
|
(remainder (+ fixnum-max 1) 0)))
|
||||||
|
|
||||||
;; Are wrong type arguments detected correctly?
|
;; Are wrong type arguments detected correctly?
|
||||||
|
|
||||||
)
|
)
|
||||||
|
@ -665,6 +685,16 @@
|
||||||
|
|
||||||
;; Are numerical overflows detected correctly?
|
;; Are numerical overflows detected correctly?
|
||||||
|
|
||||||
|
(with-test-prefix "division by zero"
|
||||||
|
|
||||||
|
(pass-if-exception "(modulo 1 0)"
|
||||||
|
exception:numerical-overflow
|
||||||
|
(modulo 1 0))
|
||||||
|
|
||||||
|
(pass-if-exception "(modulo bignum 0)"
|
||||||
|
exception:numerical-overflow
|
||||||
|
(modulo (+ fixnum-max 1) 0)))
|
||||||
|
|
||||||
;; Are wrong type arguments detected correctly?
|
;; Are wrong type arguments detected correctly?
|
||||||
|
|
||||||
)
|
)
|
||||||
|
@ -1357,9 +1387,41 @@
|
||||||
exception:numerical-overflow
|
exception:numerical-overflow
|
||||||
(/ 0))
|
(/ 0))
|
||||||
|
|
||||||
|
(pass-if-exception "(/ 0.0)"
|
||||||
|
exception:numerical-overflow
|
||||||
|
(/ 0.0))
|
||||||
|
|
||||||
(pass-if-exception "(/ 1 0)"
|
(pass-if-exception "(/ 1 0)"
|
||||||
exception:numerical-overflow
|
exception:numerical-overflow
|
||||||
(/ 1 0))))
|
(/ 1 0))
|
||||||
|
|
||||||
|
(pass-if-exception "(/ 1 0.0)"
|
||||||
|
exception:numerical-overflow
|
||||||
|
(/ 1 0.0))
|
||||||
|
|
||||||
|
(pass-if-exception "(/ bignum 0)"
|
||||||
|
exception:numerical-overflow
|
||||||
|
(/ (+ fixnum-max 1) 0))
|
||||||
|
|
||||||
|
(pass-if-exception "(/ bignum 0.0)"
|
||||||
|
exception:numerical-overflow
|
||||||
|
(/ (+ fixnum-max 1) 0.0))
|
||||||
|
|
||||||
|
(pass-if-exception "(/ 1.0 0)"
|
||||||
|
exception:numerical-overflow
|
||||||
|
(/ 1.0 0))
|
||||||
|
|
||||||
|
(pass-if-exception "(/ 1.0 0.0)"
|
||||||
|
exception:numerical-overflow
|
||||||
|
(/ 1.0 0.0))
|
||||||
|
|
||||||
|
(pass-if-exception "(/ +i 0)"
|
||||||
|
exception:numerical-overflow
|
||||||
|
(/ +i 0))
|
||||||
|
|
||||||
|
(pass-if-exception "(/ +i 0.0)"
|
||||||
|
exception:numerical-overflow
|
||||||
|
(/ +i 0.0))))
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
;;; truncate
|
;;; truncate
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue