summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2020-08-05 10:07:13 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2020-08-05 10:07:13 +0200
commit1f3e2ac4b62e38af2d9424f2a4fcc1515a4c0b30 (patch)
tree96a4cb668edba38f83ffefe6b88d050b4486d979 /test
parent398242bb3f08db3be4d8f1a7a95ba44f7aea995c (diff)
downloademacs-1f3e2ac4b62e38af2d9424f2a4fcc1515a4c0b30.tar.gz
Add new function decoded-time-period
* lisp/calendar/time-date.el (decoded-time-period): New function.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/calendar/time-date-tests.el14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/lisp/calendar/time-date-tests.el b/test/lisp/calendar/time-date-tests.el
index 3eecc67eb53..fe1460cf29e 100644
--- a/test/lisp/calendar/time-date-tests.el
+++ b/test/lisp/calendar/time-date-tests.el
@@ -109,4 +109,18 @@
(ert-deftest test-time-since ()
(should (time-equal-p 0 (time-since nil))))
+(ert-deftest test-time-decoded-period ()
+ (should (equal (decoded-time-period '(nil nil 1 nil nil nil nil nil nil))
+ 3600))
+
+ (should (equal (decoded-time-period '(1 0 0 0 0 0 nil nil nil)) 1))
+ (should (equal (decoded-time-period '(0 1 0 0 0 0 nil nil nil)) 60))
+ (should (equal (decoded-time-period '(0 0 1 0 0 0 nil nil nil)) 3600))
+ (should (equal (decoded-time-period '(0 0 0 1 0 0 nil nil nil)) 86400))
+ (should (equal (decoded-time-period '(0 0 0 0 1 0 nil nil nil)) 2592000))
+ (should (equal (decoded-time-period '(0 0 0 0 0 1 nil nil nil)) 31536000))
+
+ (should (equal (decoded-time-period '((135 . 10) 0 0 0 0 0 nil nil nil))
+ 13.5)))
+
;;; time-date-tests.el ends here