diff options
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/floatfns-tests.el | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/test/src/floatfns-tests.el b/test/src/floatfns-tests.el index 7f1d4691bf0..0eef3de75f7 100644 --- a/test/src/floatfns-tests.el +++ b/test/src/floatfns-tests.el | |||
| @@ -106,19 +106,17 @@ | |||
| 106 | (zerop (% (round n d) 2))))))))))) | 106 | (zerop (% (round n d) 2))))))))))) |
| 107 | 107 | ||
| 108 | (ert-deftest special-round () | 108 | (ert-deftest special-round () |
| 109 | (let ((ns '(-1e+INF 1e+INF -1 1 -1e+NaN 1e+NaN))) | 109 | (dolist (f '(ceiling floor round truncate)) |
| 110 | (dolist (n ns) | 110 | (let ((ns '(-1e+INF 1e+INF -1 -0.0 0.0 0 1 -1e+NaN 1e+NaN))) |
| 111 | (unless (<= (abs n) 1) | 111 | (dolist (n ns) |
| 112 | (should-error (ceiling n)) | 112 | (if (not (<= (abs n) 1)) |
| 113 | (should-error (floor n)) | 113 | (should-error (funcall f n)) |
| 114 | (should-error (round n)) | 114 | (should (= n (funcall f n))) |
| 115 | (should-error (truncate n))) | 115 | (dolist (d '(-1e+INF 1e+INF)) |
| 116 | (dolist (d ns) | 116 | (should (eq 0 (funcall f n d))))) |
| 117 | (unless (<= (abs (/ n d)) 1) | 117 | (dolist (d ns) |
| 118 | (should-error (ceiling n d)) | 118 | (when (or (zerop d) (= (abs n) 1e+INF) (not (= n n)) (not (= d d))) |
| 119 | (should-error (floor n d)) | 119 | (should-error (funcall f n d)))))))) |
| 120 | (should-error (round n d)) | ||
| 121 | (should-error (truncate n d))))))) | ||
| 122 | 120 | ||
| 123 | (ert-deftest big-round () | 121 | (ert-deftest big-round () |
| 124 | (should (= (floor 54043195528445955 3) | 122 | (should (= (floor 54043195528445955 3) |