diff options
Diffstat (limited to 'tests/test-chime-time-utilities.el')
| -rw-r--r-- | tests/test-chime-time-utilities.el | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/tests/test-chime-time-utilities.el b/tests/test-chime-time-utilities.el index 4e14df2..26e4d96 100644 --- a/tests/test-chime-time-utilities.el +++ b/tests/test-chime-time-utilities.el @@ -20,9 +20,9 @@ ;;; Commentary: ;; Unit tests for chime time utility functions: -;; - chime-get-minutes-into-day -;; - chime-get-hours-minutes-from-time -;; - chime-set-hours-minutes-for-time +;; - chime--get-minutes-into-day +;; - chime--get-hours-minutes-from-time +;; - chime--set-hours-minutes-for-time ;;; Code: @@ -32,78 +32,78 @@ (require 'testutil-general (expand-file-name "testutil-general.el")) (require 'testutil-time (expand-file-name "testutil-time.el")) -;;;; Tests for chime-get-minutes-into-day +;;;; Tests for chime--get-minutes-into-day ;;; Normal Cases -(ert-deftest test-chime-get-minutes-into-day-noon () +(ert-deftest test-chime--get-minutes-into-day-noon () "Noon (12:00) should be 720 minutes into the day." - (should (= 720 (chime-get-minutes-into-day "12:00")))) + (should (= 720 (chime--get-minutes-into-day "12:00")))) -(ert-deftest test-chime-get-minutes-into-day-afternoon () +(ert-deftest test-chime--get-minutes-into-day-afternoon () "14:30 should be 870 minutes into the day." - (should (= 870 (chime-get-minutes-into-day "14:30")))) + (should (= 870 (chime--get-minutes-into-day "14:30")))) -(ert-deftest test-chime-get-minutes-into-day-morning () +(ert-deftest test-chime--get-minutes-into-day-morning () "8:00 should be 480 minutes into the day." - (should (= 480 (chime-get-minutes-into-day "8:00")))) + (should (= 480 (chime--get-minutes-into-day "8:00")))) ;;; Boundary Cases -(ert-deftest test-chime-get-minutes-into-day-midnight () +(ert-deftest test-chime--get-minutes-into-day-midnight () "Midnight (0:00) should be 0 minutes into the day." - (should (= 0 (chime-get-minutes-into-day "0:00")))) + (should (= 0 (chime--get-minutes-into-day "0:00")))) -(ert-deftest test-chime-get-minutes-into-day-end-of-day () +(ert-deftest test-chime--get-minutes-into-day-end-of-day () "23:59 should be 1439 minutes into the day." - (should (= 1439 (chime-get-minutes-into-day "23:59")))) + (should (= 1439 (chime--get-minutes-into-day "23:59")))) -(ert-deftest test-chime-get-minutes-into-day-one-minute-past-midnight () +(ert-deftest test-chime--get-minutes-into-day-one-minute-past-midnight () "0:01 should be 1 minute into the day." - (should (= 1 (chime-get-minutes-into-day "0:01")))) + (should (= 1 (chime--get-minutes-into-day "0:01")))) -;;;; Tests for chime-get-hours-minutes-from-time +;;;; Tests for chime--get-hours-minutes-from-time ;;; Normal Cases (ert-deftest test-chime-get-hours-minutes-afternoon () "14:30 should return (14 30)." - (should (equal '(14 30) (chime-get-hours-minutes-from-time "14:30")))) + (should (equal '(14 30) (chime--get-hours-minutes-from-time "14:30")))) (ert-deftest test-chime-get-hours-minutes-morning () "8:00 should return (8 0)." - (should (equal '(8 0) (chime-get-hours-minutes-from-time "8:00")))) + (should (equal '(8 0) (chime--get-hours-minutes-from-time "8:00")))) (ert-deftest test-chime-get-hours-minutes-with-minutes () "9:45 should return (9 45)." - (should (equal '(9 45) (chime-get-hours-minutes-from-time "9:45")))) + (should (equal '(9 45) (chime--get-hours-minutes-from-time "9:45")))) ;;; Boundary Cases (ert-deftest test-chime-get-hours-minutes-midnight () "0:00 should return (0 0)." - (should (equal '(0 0) (chime-get-hours-minutes-from-time "0:00")))) + (should (equal '(0 0) (chime--get-hours-minutes-from-time "0:00")))) (ert-deftest test-chime-get-hours-minutes-exact-hour () "10:00 should return (10 0) with no leftover minutes." - (should (equal '(10 0) (chime-get-hours-minutes-from-time "10:00")))) + (should (equal '(10 0) (chime--get-hours-minutes-from-time "10:00")))) (ert-deftest test-chime-get-hours-minutes-end-of-day () "23:59 should return (23 59)." - (should (equal '(23 59) (chime-get-hours-minutes-from-time "23:59")))) + (should (equal '(23 59) (chime--get-hours-minutes-from-time "23:59")))) (ert-deftest test-chime-get-hours-minutes-noon () "12:00 should return (12 0)." - (should (equal '(12 0) (chime-get-hours-minutes-from-time "12:00")))) + (should (equal '(12 0) (chime--get-hours-minutes-from-time "12:00")))) -;;;; Tests for chime-set-hours-minutes-for-time +;;;; Tests for chime--set-hours-minutes-for-time ;;; Normal Cases (ert-deftest test-chime-set-hours-minutes-preserves-date () "Setting hours/minutes should preserve the date." (let* ((base (test-time-tomorrow-at 10 0)) - (result (chime-set-hours-minutes-for-time base 14 30)) + (result (chime--set-hours-minutes-for-time base 14 30)) (decoded (decode-time result)) (base-decoded (decode-time base))) ;; Date should be the same @@ -118,7 +118,7 @@ (ert-deftest test-chime-set-hours-minutes-changes-time () "Setting different hours/minutes should produce different time." (let* ((base (test-time-tomorrow-at 10 0)) - (result (chime-set-hours-minutes-for-time base 15 45)) + (result (chime--set-hours-minutes-for-time base 15 45)) (decoded (decode-time result))) (should (= 15 (decoded-time-hour decoded))) (should (= 45 (decoded-time-minute decoded))))) @@ -128,7 +128,7 @@ (ert-deftest test-chime-set-hours-minutes-midnight () "Setting to midnight (0, 0) should work." (let* ((base (test-time-tomorrow-at 10 0)) - (result (chime-set-hours-minutes-for-time base 0 0)) + (result (chime--set-hours-minutes-for-time base 0 0)) (decoded (decode-time result))) (should (= 0 (decoded-time-hour decoded))) (should (= 0 (decoded-time-minute decoded))))) @@ -136,7 +136,7 @@ (ert-deftest test-chime-set-hours-minutes-end-of-day () "Setting to 23:59 should work." (let* ((base (test-time-tomorrow-at 10 0)) - (result (chime-set-hours-minutes-for-time base 23 59)) + (result (chime--set-hours-minutes-for-time base 23 59)) (decoded (decode-time result))) (should (= 23 (decoded-time-hour decoded))) (should (= 59 (decoded-time-minute decoded))))) @@ -144,8 +144,8 @@ (ert-deftest test-chime-set-hours-minutes-roundtrip () "Extracting hours/minutes and setting them back should produce same time-of-day." (let* ((base (test-time-tomorrow-at 14 30)) - (hm (chime-get-hours-minutes-from-time "14:30")) - (result (chime-set-hours-minutes-for-time base (car hm) (cadr hm))) + (hm (chime--get-hours-minutes-from-time "14:30")) + (result (chime--set-hours-minutes-for-time base (car hm) (cadr hm))) (decoded (decode-time result))) (should (= 14 (decoded-time-hour decoded))) (should (= 30 (decoded-time-minute decoded))))) @@ -153,7 +153,7 @@ (ert-deftest test-chime-set-hours-minutes-seconds-always-zero () "Seconds should always be set to 0 regardless of base time." (let* ((base (test-time-now)) ;; may have non-zero seconds internally - (result (chime-set-hours-minutes-for-time base 10 0)) + (result (chime--set-hours-minutes-for-time base 10 0)) (decoded (decode-time result))) (should (= 0 (decoded-time-second decoded))))) |
