diff options
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/timefns-tests.el | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/src/timefns-tests.el b/test/src/timefns-tests.el index feb8fc7905e..1b1032deaa1 100644 --- a/test/src/timefns-tests.el +++ b/test/src/timefns-tests.el | |||
| @@ -150,3 +150,21 @@ | |||
| 150 | (should (time-equal-p | 150 | (should (time-equal-p |
| 151 | (encode-time '(29 31 17 30 4 2019 2 t 7200 0)) | 151 | (encode-time '(29 31 17 30 4 2019 2 t 7200 0)) |
| 152 | '(23752 27217)))) | 152 | '(23752 27217)))) |
| 153 | |||
| 154 | (ert-deftest float-time-precision () | ||
| 155 | (should (< 0 (float-time '(1 . 10000000000)))) | ||
| 156 | (should (< (float-time '(-1 . 10000000000)) 0)) | ||
| 157 | |||
| 158 | (let ((x 1.0)) | ||
| 159 | (while (not (zerop x)) | ||
| 160 | (dolist (multiplier '(-1.9 -1.5 -1.1 -1 1 1.1 1.5 1.9)) | ||
| 161 | (let ((xmult (* x multiplier))) | ||
| 162 | (should (= xmult (float-time (time-convert xmult t)))))) | ||
| 163 | (setq x (/ x 2)))) | ||
| 164 | |||
| 165 | (let ((x 1.0)) | ||
| 166 | (while (ignore-errors (time-convert x t)) | ||
| 167 | (dolist (divisor '(-1.9 -1.5 -1.1 -1 1 1.1 1.5 1.9)) | ||
| 168 | (let ((xdiv (/ x divisor))) | ||
| 169 | (should (= xdiv (float-time (time-convert xdiv t)))))) | ||
| 170 | (setq x (* x 2))))) | ||