diff options
| author | Paul Eggert | 2022-04-14 19:03:41 -0700 |
|---|---|---|
| committer | Paul Eggert | 2022-04-14 19:09:51 -0700 |
| commit | 7c17bd2a6d8d7cf710051cd7ca00260c1e557609 (patch) | |
| tree | 3d9a870b3981f1ec2d058da18093762515a8da0b | |
| parent | 6c4559d13865cb5761071ac59f395718b85eb41c (diff) | |
| download | emacs-7c17bd2a6d8d7cf710051cd7ca00260c1e557609.tar.gz emacs-7c17bd2a6d8d7cf710051cd7ca00260c1e557609.zip | |
New time-equal-p test
* test/src/timefns-tests.el (time-equal-p-NaN-NaN): New test.
| -rw-r--r-- | src/timefns.c | 3 | ||||
| -rw-r--r-- | test/src/timefns-tests.el | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/timefns.c b/src/timefns.c index 6cfb787af8f..b061be0a786 100644 --- a/src/timefns.c +++ b/src/timefns.c | |||
| @@ -1221,7 +1221,8 @@ time_cmp (Lisp_Object a, Lisp_Object b) | |||
| 1221 | 1221 | ||
| 1222 | /* Compare nil to nil correctly, and handle other eq values quicker | 1222 | /* Compare nil to nil correctly, and handle other eq values quicker |
| 1223 | while we're at it. Compare here rather than earlier, to handle | 1223 | while we're at it. Compare here rather than earlier, to handle |
| 1224 | NaNs and check formats. */ | 1224 | NaNs. This means (time-equal-p X X) does not signal an error if |
| 1225 | X is not a valid time value, but that's OK. */ | ||
| 1225 | if (EQ (a, b)) | 1226 | if (EQ (a, b)) |
| 1226 | return 0; | 1227 | return 0; |
| 1227 | 1228 | ||
diff --git a/test/src/timefns-tests.el b/test/src/timefns-tests.el index 1b49e0622f5..e7c464472d0 100644 --- a/test/src/timefns-tests.el +++ b/test/src/timefns-tests.el | |||
| @@ -169,6 +169,10 @@ a fixed place on the right and are padded on the left." | |||
| 169 | (ert-deftest time-equal-p-nil-nil () | 169 | (ert-deftest time-equal-p-nil-nil () |
| 170 | (should (time-equal-p nil nil))) | 170 | (should (time-equal-p nil nil))) |
| 171 | 171 | ||
| 172 | (ert-deftest time-equal-p-NaN-NaN () | ||
| 173 | (let ((x 0.0e+NaN)) | ||
| 174 | (should (not (time-equal-p x x))))) | ||
| 175 | |||
| 172 | (ert-deftest time-arith-tests () | 176 | (ert-deftest time-arith-tests () |
| 173 | (let ((time-values (list 0 -1 1 0.0 -0.0 -1.0 1.0 | 177 | (let ((time-values (list 0 -1 1 0.0 -0.0 -1.0 1.0 |
| 174 | most-negative-fixnum most-positive-fixnum | 178 | most-negative-fixnum most-positive-fixnum |