diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/calc/calc-tests.el | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/lisp/calc/calc-tests.el b/test/lisp/calc/calc-tests.el index c5aa5a31eb2..13dd228d3b3 100644 --- a/test/lisp/calc/calc-tests.el +++ b/test/lisp/calc/calc-tests.el | |||
| @@ -191,6 +191,33 @@ An existing calc stack is reused, otherwise a new one is created." | |||
| 191 | (let ((calc-number-radix 36)) | 191 | (let ((calc-number-radix 36)) |
| 192 | (should (equal (math-format-number 12345678901) "36#5,O6A,QT1"))))) | 192 | (should (equal (math-format-number 12345678901) "36#5,O6A,QT1"))))) |
| 193 | 193 | ||
| 194 | (ert-deftest calc-digit-after-point () | ||
| 195 | "Test display of trailing 0 after decimal point (bug#47302)." | ||
| 196 | (let ((calc-digit-after-point nil)) | ||
| 197 | ;; Integral floats have no digits after the decimal point (default). | ||
| 198 | (should (equal (math-format-number '(float 0 0)) "0.")) | ||
| 199 | (should (equal (math-format-number '(float 5 0)) "5.")) | ||
| 200 | (should (equal (math-format-number '(float 3 1)) "30.")) | ||
| 201 | (should (equal (math-format-number '(float 23 0)) "23.")) | ||
| 202 | (should (equal (math-format-number '(float 123 0)) "123.")) | ||
| 203 | (should (equal (math-format-number '(float 1 -1)) "0.1")) | ||
| 204 | (should (equal (math-format-number '(float 54 -1)) "5.4")) | ||
| 205 | (should (equal (math-format-number '(float 1 -4)) "1e-4")) | ||
| 206 | (should (equal (math-format-number '(float 1 14)) "1e14")) | ||
| 207 | (should (equal (math-format-number 12) "12"))) | ||
| 208 | (let ((calc-digit-after-point t)) | ||
| 209 | ;; Integral floats have at least one digit after the decimal point. | ||
| 210 | (should (equal (math-format-number '(float 0 0)) "0.0")) | ||
| 211 | (should (equal (math-format-number '(float 5 0)) "5.0")) | ||
| 212 | (should (equal (math-format-number '(float 3 1)) "30.0")) | ||
| 213 | (should (equal (math-format-number '(float 23 0)) "23.0")) | ||
| 214 | (should (equal (math-format-number '(float 123 0)) "123.0")) | ||
| 215 | (should (equal (math-format-number '(float 1 -1)) "0.1")) | ||
| 216 | (should (equal (math-format-number '(float 54 -1)) "5.4")) | ||
| 217 | (should (equal (math-format-number '(float 1 -4)) "1e-4")) | ||
| 218 | (should (equal (math-format-number '(float 1 14)) "1e14")) | ||
| 219 | (should (equal (math-format-number 12) "12")))) | ||
| 220 | |||
| 194 | (ert-deftest calc-calendar () | 221 | (ert-deftest calc-calendar () |
| 195 | "Test calendar conversions (bug#36822)." | 222 | "Test calendar conversions (bug#36822)." |
| 196 | (should (equal (calcFunc-julian (math-parse-date "2019-07-27")) 2458692)) | 223 | (should (equal (calcFunc-julian (math-parse-date "2019-07-27")) 2458692)) |